From 156ba3d5f36f37ccf5210c602e9f2fbc0c0868ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Daleng?= <142524365+MrMarHVD@users.noreply.github.com> Date: Thu, 15 Feb 2024 12:30:36 +0100 Subject: [PATCH] Added AffineTransform2D-class and resolved issue with pom.xml. --- .../java/edu/ntnu/stud/chaosgame/Main.java | 3 + .../chaosgame/model/AffineTransform2D.java | 64 +++++++++++++++++++ .../ntnu/stud/chaosgame/model/Complex.java | 2 +- 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 src/main/java/edu/ntnu/stud/chaosgame/model/AffineTransform2D.java diff --git a/src/main/java/edu/ntnu/stud/chaosgame/Main.java b/src/main/java/edu/ntnu/stud/chaosgame/Main.java index 7514bb1..b178c70 100644 --- a/src/main/java/edu/ntnu/stud/chaosgame/Main.java +++ b/src/main/java/edu/ntnu/stud/chaosgame/Main.java @@ -1,5 +1,8 @@ package edu.ntnu.stud.chaosgame; +/** + * Main class for the Chaos Game application. + */ public class Main { public static void main(String[] args) { diff --git a/src/main/java/edu/ntnu/stud/chaosgame/model/AffineTransform2D.java b/src/main/java/edu/ntnu/stud/chaosgame/model/AffineTransform2D.java new file mode 100644 index 0000000..32950a9 --- /dev/null +++ b/src/main/java/edu/ntnu/stud/chaosgame/model/AffineTransform2D.java @@ -0,0 +1,64 @@ +package edu.ntnu.stud.chaosgame.model; + +/** + * Class representing an affine transformation in 2D. + + */ +public class AffineTransform2D { + + /** + * Matrix component of the affine transformation. + */ + private Matrix2x2 matrix; + + /** + * Vector component of the affine transformation. + */ + private Vector2D vector; + + /** + * Parameterized constructor for the affine transformation. + * @param matrix matrix + * @param vector vector + */ + public AffineTransform2D(Matrix2x2 matrix, Vector2D vector) { + this.matrix = matrix; + this.vector = vector; + } + + /** + * Getter for the matrix belonging to the affine transformation. + * + * @return the matrix + */ + public Matrix2x2 getMatrix() { + return matrix; + } + + /** + * Setter for the matrix belonging to the affine transformation. + * + * @param matrix the matrix to set + */ + public void setMatrix(Matrix2x2 matrix) { + this.matrix = matrix; + } + + /** + * Getter for the vector belonging to the affine transformation. + * + * @return the vector + */ + public Vector2D getVector() { + return vector; + } + + /** + * Setter for the vector belonging to the affine transformation. + * + * @param vector the vector to set + */ + public void setVector(Vector2D vector) { + this.vector = vector; + } +} \ No newline at end of file diff --git a/src/main/java/edu/ntnu/stud/chaosgame/model/Complex.java b/src/main/java/edu/ntnu/stud/chaosgame/model/Complex.java index fd9e506..8c71216 100644 --- a/src/main/java/edu/ntnu/stud/chaosgame/model/Complex.java +++ b/src/main/java/edu/ntnu/stud/chaosgame/model/Complex.java @@ -14,7 +14,7 @@ public class Complex extends Vector2D{ /** * Get the square root of the complex number. - * + * * @return The square root of the complex number. */ public Complex sqrt() { -- GitLab