Skip to content
Snippets Groups Projects
Commit 8f9da2d0 authored by Edvard Granheim Harbo's avatar Edvard Granheim Harbo
Browse files

Merge branch 'task.1.3' into 'main'

Refactored: JuliaTransform method

See merge request !5
parents 21cc6668 9e4ad01d
No related branches found
No related tags found
1 merge request!5Refactored: JuliaTransform method
...@@ -11,18 +11,13 @@ public class JuliaTransform implements Transform2D{ ...@@ -11,18 +11,13 @@ public class JuliaTransform implements Transform2D{
@Override @Override
public Vector2D transform(Vector2D point) { public Vector2D transform(Vector2D point) {
double x = point.getX0(); if (!(point instanceof Complex)) {
double y = point.getX1(); throw new IllegalArgumentException("The point must be a complex number");
double newX = x * x - y * y + this.point.getX0();
double newY = 2 * x * y + this.point.getX1();
if (sign == -1) {
newX = -newX;
newY = -newY;
} }
return new Vector2D(newX, newY); Complex newVector = (Complex) point.subtract(this.point);
return newVector.sqrt();
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment