You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2019/04/03 16:57:48 UTC

[GitHub] [commons-geometry] svenrathgeber commented on a change in pull request #31: Geometry 29 2 sven

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

 ##########
 File path: commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Plane.java
 ##########
 @@ -192,50 +211,104 @@ public Vector3D getU() {
         return u;
     }
 
-    /** Get the plane second canonical vector.
-     * <p>The frame defined by ({@link #getU getU}, {@link #getV getV},
-     * {@link #getNormal getNormal}) is a rigth-handed orthonormalized
-     * frame).</p>
+    /**
+     * Get the plane second canonical vector.
+     * <p>
+     * The frame defined by ({@link #getU getU}, {@link #getV getV},
+     * {@link #getNormal getNormal}) is a right-handed orthonormalized frame).
+     * </p>
+     * 
      * @return normalized second canonical vector
      * @see #getU
      * @see #getNormal
      */
     public Vector3D getV() {
         return v;
     }
-
+    
+    /**
+     * Get the normalized normal vector, alias for getNormal().
+     * <p>
+     * The frame defined by ({@link #getU getU}, {@link #getV getV},
+     * {@link #getNormal getNormal}) is a right-handed orthonormalized frame).
+     * </p>
+     * 
+     * @return normalized normal vector
+     * @see #getU
+     * @see #getV
+     */
+    public Vector3D getW() {
+        return w;
+    }
+    
+    /**
+     * Get the normalized normal vector.
+     * <p>
+     * The frame defined by ({@link #getU getU}, {@link #getV getV},
+     * {@link #getNormal getNormal}) is a right-handed orthonormalized frame).
+     * </p>
+     * 
+     * @return normalized normal vector
+     * @see #getU
+     * @see #getV
+     */
+    public Vector3D getNormal() {
+        return w;
+    }
+    
     /** {@inheritDoc} */
     @Override
     public Vector3D project(Vector3D point) {
         return toSpace(toSubSpace(point));
     }
 
+    /**
+     * 3D line projected onto plane
+     * @param line the line to project
+     * @return the projection of the given line onto the plane.
+     */
+    public Line project(Line line)
+    {
+        Vector3D direction = line.getDirection();
+        Vector3D projection = w.multiply(direction.dot(w)).multiply(1/Math.pow(w.norm(), 2));
 
 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:
users@infra.apache.org


With regards,
Apache Git Services