From 506719d5357c26469865a55190c582415bb745e1 Mon Sep 17 00:00:00 2001 From: Natalia Bebjakova <xbebjak@fi.muni.cz> Date: Sun, 5 Apr 2020 21:04:44 +0200 Subject: [PATCH] MeshPoint changed --- .../fidentis/analyst/mesh/core/MeshPoint.java | 45 ++++++++++++------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/MeshModel/src/main/java/cz/fidentis/analyst/mesh/core/MeshPoint.java b/MeshModel/src/main/java/cz/fidentis/analyst/mesh/core/MeshPoint.java index 73d74d4b..f38c39c0 100644 --- a/MeshModel/src/main/java/cz/fidentis/analyst/mesh/core/MeshPoint.java +++ b/MeshModel/src/main/java/cz/fidentis/analyst/mesh/core/MeshPoint.java @@ -128,18 +128,12 @@ public class MeshPoint { return new MeshPoint(new Vector3d(newPosition), null, null); } - /*public MeshPoint addPosition(MeshPoint b) { - return (new MeshPoint(new Vector3d(this.getPosition().x + b.getPosition().x, - this.getPosition().y + b.getPosition().y, this.getPosition().z + b.getPosition().z), - null, null)); - }*/ - - /* public MeshPoint subtractPosition(MeshPoint b) { - return (new MeshPoint(new Vector3d(this.getPosition().x - b.getPosition().x, - this.getPosition().y - b.getPosition().y, this.getPosition().z - b.getPosition().z), - null, null)); - }*/ - + /** + * returns new instance of MeshPoint with multiplied position by number + * + * @param number Number for multiplying + * @return multiplied MeshPoint + */ public MeshPoint multiplyPosition(double number) { if (normal != null) { if (texCoord != null) @@ -156,6 +150,12 @@ public class MeshPoint { null, null); } + /** + * returns new instance of MeshPoint with divided position by number + * + * @param number Number for division + * @return divided MeshPoint + */ public MeshPoint dividePosition(double number) { if (normal != null) { if (texCoord != null) @@ -169,11 +169,11 @@ public class MeshPoint { this.getPosition().z / number), null, null); } - /** - * Returns the cross product of two points. - @param meshPoint Second argument of the cross product operation. - * @return - @returns Point3D representing the resulting vector. + /** + * Returns the cross product of two points. + * + * @param meshPoint Second argument of the cross product operation. + * @return MeshPoint representing the resulting vector. */ public MeshPoint crossProduct(MeshPoint meshPoint) { if (normal != null) { @@ -197,10 +197,21 @@ public class MeshPoint { null, null); } + /** + * returns the dot product of two points + * + * @param meshPoint Second argument of the dot product operation + * @return dot product of two instances of MeshPoint + */ public double dotProduct(MeshPoint meshPoint) { return (this.position.x * meshPoint.position.x + this.position.y * meshPoint.position.y + this.position.z * meshPoint.position.z); } + /** + * returns absolute value of MeshPoint + * + * @return absolute value of MeshPoint + */ public double abs() { return Math.sqrt(this.getPosition().x * this.getPosition().x + this.getPosition().y * this.getPosition().y + this.getPosition().z * this.getPosition().z); -- GitLab