/** * Computes the orthogonal projection of a 3D point on a given 3D plane defined by a 3D point and 3D normal. * <p> * Edge cases: * <ul> * <li> if the length of the plane normal is too small, i.e. less than {@link Epsilons#ONE_TRILLIONTH}, * this method fails and returns {@code false}. * </ul> * </p> * * @param pointToProject the point to compute the projection of. Not modified. * @param pointOnPlane a point on the plane. Not modified. * @param planeNormal the normal of the plane. Not modified. * @return the projection of the point onto the plane, or {@code null} if the method failed. */ public static Point3d getOrthogonalProjectionOnPlane(Point3d pointToProject, Point3d pointOnPlane, Vector3d planeNormal) { Point3d projection = new Point3d(); boolean success = getOrthogonalProjectionOnPlane(pointToProject, pointOnPlane, planeNormal, projection); if (!success) return null; else return projection; }
/** * Computes the orthogonal projection of a 3D point on a given 3D plane defined by a 3D point and 3D normal. * <p> * Edge cases: * <ul> * <li> if the length of the plane normal is too small, i.e. less than {@link Epsilons#ONE_TRILLIONTH}, * this method fails and returns {@code false}. * </ul> * </p> * * @param pointToProject the point to compute the projection of. Not modified. * @param pointOnPlane a point on the plane. Not modified. * @param planeNormal the normal of the plane. Not modified. * @return the projection of the point onto the plane, or {@code null} if the method failed. * @throws ReferenceFrameMismatchException if the arguments are not expressed in the same reference frame. */ public static FramePoint getOrthogonalProjectionOnPlane(FramePoint pointToProject, FramePoint pointOnPlane, FrameVector planeNormal) { FramePoint projection = new FramePoint(); boolean success = getOrthogonalProjectionOnPlane(pointToProject, pointOnPlane, planeNormal, projection); if (!success) return null; else return projection; }
/** * Computes the orthogonal projection of a 3D point on a given 3D plane defined by a 3D point and 3D normal. * <p> * Edge cases: * <ul> * <li> if the length of the plane normal is too small, i.e. less than {@link Epsilons#ONE_TRILLIONTH}, * this method fails and returns {@code false}. * </ul> * </p> * * @param pointToProject the point to compute the projection of. Not modified. * @param pointOnPlane a point on the plane. Not modified. * @param planeNormal the normal of the plane. Not modified. * @return the projection of the point onto the plane, or {@code null} if the method failed. * @throws ReferenceFrameMismatchException if the arguments are not expressed in the same reference frame. */ public static FramePoint3D getOrthogonalProjectionOnPlane(FramePoint3D pointToProject, FramePoint3D pointOnPlane, FrameVector3D planeNormal) { FramePoint3D projection = new FramePoint3D(); boolean success = getOrthogonalProjectionOnPlane(pointToProject, pointOnPlane, planeNormal, projection); if (!success) return null; else return projection; }
/** * Computes the orthogonal projection of a 3D point on a given 3D plane defined by a 3D point and 3D normal. * <p> * Edge cases: * <ul> * <li> if the length of the plane normal is too small, i.e. less than {@link Epsilons#ONE_TRILLIONTH}, * this method fails and returns {@code false}. * </ul> * </p> * * @param pointToProject the point to compute the projection of. Not modified. * @param pointOnPlane a point on the plane. Not modified. * @param planeNormal the normal of the plane. Not modified. * @param projectionToPack point in which the projection of the point onto the plane is stored. Modified. * @return whether the method succeeded or not. * @throws ReferenceFrameMismatchException if the arguments are not expressed in the same reference frame, * except for {@code projectionToPack}. */ public static boolean getOrthogonalProjectionOnPlane(FramePoint pointToProject, FramePoint pointOnPlane, FrameVector planeNormal, FramePoint projectionToPack) { pointToProject.checkReferenceFrameMatch(pointOnPlane); pointToProject.checkReferenceFrameMatch(planeNormal); projectionToPack.setToZero(pointToProject.getReferenceFrame()); return getOrthogonalProjectionOnPlane(pointToProject.getPoint(), pointOnPlane.getPoint(), planeNormal.getVector(), projectionToPack.getPoint()); }