svenrathgeber commented on a change in pull request #31: Geometry 29 2 sven
URL: https://github.com/apache/commons-geometry/pull/31#discussion_r271839777
 
 

 ##########
 File path: 
commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Plane.java
 ##########
 @@ -16,174 +16,193 @@
  */
 package org.apache.commons.geometry.euclidean.threed;
 
+import java.util.Objects;
+
 import org.apache.commons.geometry.core.exception.IllegalNormException;
 import org.apache.commons.geometry.core.partitioning.Embedding;
 import org.apache.commons.geometry.core.partitioning.Hyperplane;
 import org.apache.commons.geometry.core.precision.DoublePrecisionContext;
-import org.apache.commons.geometry.euclidean.internal.Vectors;
 import org.apache.commons.geometry.euclidean.oned.Vector1D;
 import 
org.apache.commons.geometry.euclidean.threed.rotation.QuaternionRotation;
 import org.apache.commons.geometry.euclidean.twod.PolygonsSet;
 import org.apache.commons.geometry.euclidean.twod.Vector2D;
 
-/** The class represent planes in a three dimensional space.
+/**
+ * The class represents a plane in a three dimensional space.
  */
-public class Plane implements Hyperplane<Vector3D>, Embedding<Vector3D, 
Vector2D> {
-
-    /** Offset of the origin with respect to the plane. */
-    private double originOffset;
+public final class Plane implements Hyperplane<Vector3D>, Embedding<Vector3D, 
Vector2D> {
 
-    /** Origin of the plane frame. */
-    private Vector3D origin;
+    /** First normalized vector of the plane frame (in plane). */
+    private final Vector3D u;
 
-    /** First vector of the plane frame (in plane). */
-    private Vector3D u;
+    /** Second normalized vector of the plane frame (in plane). */
+    private final Vector3D v;
 
-    /** Second vector of the plane frame (in plane). */
-    private Vector3D v;
+    /** Normalized plane normal. */
+    private final Vector3D w;
 
-    /** Third vector of the plane frame (plane normal). */
-    private Vector3D w;
+    /** Offset of the origin with respect to the plane. */
+    private final double originOffset;
 
+    /** orthogonal projection of the 3D-space origin in the plane. */
+    private final Vector3D projectedOrigin;
+    
     /** Precision context used to compare floating point numbers. */
     private final DoublePrecisionContext precision;
 
-    /** Build a plane normal to a given direction and containing the origin.
-     * @param normal normal direction to the plane
+    /** 
+     * Constructor to build a new plane with the given values.
+     * Made private to prevent inheritance.
+     * @param u u vector (on plane)
+     * @param v v vector (on plane)
+     * @param w unit normal vector
+     * @param projectedOrigin orthogonal projection of the 3D-space origin in 
the plane.
      * @param precision precision context used to compare floating point values
-     * @exception IllegalArgumentException if the normal norm is too small
+     * @throws IllegalArgumentException if the provided vectors are coplanar 
or not normalized
      */
-    public Plane(final Vector3D normal, final DoublePrecisionContext precision)
-        throws IllegalArgumentException {
-        setNormal(normal);
+    private Plane(Vector3D u, Vector3D v, Vector3D w, Vector3D 
projectedOrigin, double originOffset,
+            DoublePrecisionContext precision) {
+        this.u = u;
+        this.v = v;
+        this.w = w;
+        
+        if (!areVectorsNormalized(u, v, w, precision))
 
 Review comment:
   done

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to