/** * 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 EuclidGeometryTools#ONE_TRILLIONTH}, this method fails and returns {@code false}. * </ul> * </p> * * @param x the x-coordinate of the point to compute the projection of. Not modified. * @param y the y-coordinate of the point to compute the projection of. Not modified. * @param z the z-coordinate of 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 all expressed in the same * reference frame. */ public static boolean orthogonalProjectionOnPlane3D(double x, double y, double z, FramePoint3DReadOnly pointOnPlane, FrameVector3DReadOnly planeNormal, FixedFramePoint3DBasics projectionToPack) { pointOnPlane.checkReferenceFrameMatch(planeNormal); projectionToPack.checkReferenceFrameMatch(pointOnPlane); return EuclidGeometryTools.orthogonalProjectionOnPlane3D(x, y, z, pointOnPlane, planeNormal, projectionToPack); }
pointOnLine1.checkReferenceFrameMatch(lineDirection2); if (closestPointOnLine1ToPack != null) closestPointOnLine1ToPack.checkReferenceFrameMatch(pointOnLine1); if (closestPointOnLine2ToPack != null) closestPointOnLine2ToPack.checkReferenceFrameMatch(pointOnLine1); return EuclidGeometryTools.closestPoint3DsBetweenTwoLine3Ds(pointOnLine1, lineDirection1, pointOnLine2, lineDirection2, closestPointOnLine1ToPack, closestPointOnLine2ToPack);
lineSegmentStart1.checkReferenceFrameMatch(lineSegmentEnd2); if (closestPointOnLineSegment1ToPack != null) closestPointOnLineSegment1ToPack.checkReferenceFrameMatch(lineSegmentStart1); if (closestPointOnLineSegment2ToPack != null) closestPointOnLineSegment2ToPack.checkReferenceFrameMatch(lineSegmentStart1); return EuclidGeometryTools.closestPoint3DsBetweenTwoLineSegment3Ds(lineSegmentStart1, lineSegmentEnd1, lineSegmentStart2, lineSegmentEnd2, closestPointOnLineSegment1ToPack, closestPointOnLineSegment2ToPack);
/** * Assuming an isosceles triangle defined by three vertices A, B, and C, with |AB| == |BC|, this * methods computes the missing vertex B given the vertices A and C, the normal of the triangle, the * angle ABC that is equal to the angle at B from the the leg BA to the leg BC. * <a href="https://en.wikipedia.org/wiki/Isosceles_triangle"> Useful link</a>. * * @param baseVertexA the first base vertex of the isosceles triangle ABC. Not modified. * @param baseVertexC the second base vertex of the isosceles triangle ABC. Not modified. * @param trianglePlaneNormal the normal of the plane on which is lying. Not modified. * @param ccwAngleAboutNormalAtTopVertex the angle at B from the the leg BA to the leg BC. * @param topVertexBToPack the missing vertex B. Modified. * @throws ReferenceFrameMismatchException if the arguments are not all expressed in the same * reference frame. */ public static void topVertex3DOfIsoscelesTriangle3D(FramePoint3DReadOnly baseVertexA, FramePoint3DReadOnly baseVertexC, FrameVector3DReadOnly trianglePlaneNormal, double ccwAngleAboutNormalAtTopVertex, FixedFramePoint3DBasics topVertexBToPack) { baseVertexA.checkReferenceFrameMatch(baseVertexC); baseVertexA.checkReferenceFrameMatch(trianglePlaneNormal); topVertexBToPack.checkReferenceFrameMatch(baseVertexA); EuclidGeometryTools.topVertex3DOfIsoscelesTriangle3D(baseVertexA, baseVertexC, trianglePlaneNormal, ccwAngleAboutNormalAtTopVertex, topVertexBToPack); }
/** * 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 EuclidGeometryTools#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 all expressed in the same * reference frame. */ public static boolean orthogonalProjectionOnPlane3D(FramePoint3DReadOnly pointToProject, FramePoint3DReadOnly pointOnPlane, FrameVector3DReadOnly planeNormal, FixedFramePoint3DBasics projectionToPack) { pointToProject.checkReferenceFrameMatch(pointOnPlane); pointToProject.checkReferenceFrameMatch(planeNormal); projectionToPack.checkReferenceFrameMatch(pointToProject); return EuclidGeometryTools.orthogonalProjectionOnPlane3D(pointToProject, pointOnPlane, planeNormal, projectionToPack); }
/** * Computes the orthogonal projection of a 3D point on an infinitely long 3D line defined by a 3D * point and a 3D direction. * <p> * Edge cases: * <ul> * <li>if the given line direction is too small, i.e. * {@code lineDirection.lengthSquared() < }{@link EuclidGeometryTools#ONE_TRILLIONTH}, this method * fails and returns {@code false}. * </ul> * </p> * * @param pointToProject the point to compute the projection of. Not modified. * @param pointOnLine point located on the line. Not modified. * @param lineDirection direction of the line. Not modified. * @param projectionToPack point in which the projection of the point onto the line is stored. * Modified. * @return whether the method succeeded or not. * @throws ReferenceFrameMismatchException if the arguments are not all expressed in the same * reference frame. */ public static boolean orthogonalProjectionOnLine3D(FramePoint3DReadOnly pointToProject, FramePoint3DReadOnly pointOnLine, FrameVector3DReadOnly lineDirection, FixedFramePoint3DBasics projectionToPack) { pointToProject.checkReferenceFrameMatch(pointOnLine); pointToProject.checkReferenceFrameMatch(lineDirection); projectionToPack.checkReferenceFrameMatch(pointToProject); return EuclidGeometryTools.orthogonalProjectionOnLine3D(pointToProject, pointOnLine, lineDirection, projectionToPack); }
projectionToPack.checkReferenceFrameMatch(pointToProject); return EuclidGeometryTools.orthogonalProjectionOnLineSegment3D(pointToProject, lineSegmentStart, lineSegmentEnd, projectionToPack);
orthogonalProjectionToPack.checkReferenceFrameMatch(point); perpendicularVectorToPack.checkReferenceFrameMatch(point); return EuclidGeometryTools.perpendicularVector3DFromLine3DToPoint3D(point, firstPointOnLine, secondPointOnLine, orthogonalProjectionToPack,
orthogonalProjectionToPack.checkReferenceFrameMatch(point); Vector3D perpendicularVector = EuclidGeometryTools.perpendicularVector3DFromLine3DToPoint3D(point, firstPointOnLine, secondPointOnLine, orthogonalProjectionToPack);