/** * Tests on a per component basis, if this line 3D is exactly equal to {@code other}. * <p> * If the two lines have different frames, this method returns {@code false}. * </p> * * @param other the other line 3D to compare against this. Not modified. * @return {@code true} if the two lines are exactly equal component-wise and are expressed in the * same reference frame, {@code false} otherwise. */ default boolean equals(FrameLine3DReadOnly other) { if (other == null || getReferenceFrame() != other.getReferenceFrame()) return false; else return Line3DReadOnly.super.equals(other); } }
/** * Sets this line to be the same as the given line projected onto the XY-plane. * * @param frameLine3DReadOnly the line to copy. Not modified. * @throws ReferenceFrameMismatchException if {@code this} and {@code frameLine3DReadOnly} are * not expressed in the same reference frame. */ default void set(FrameLine3DReadOnly frameLine3DReadOnly) { set(frameLine3DReadOnly.getReferenceFrame(), frameLine3DReadOnly); }
/** * Sets this line to be the same as the given line. * * @param other the other line to copy. Not modified. */ default void setIncludingFrame(FrameLine3DReadOnly other) { setIncludingFrame(other.getReferenceFrame(), other); }
/** * Sets this line to be the same as the given line. * * @param referenceFrame the reference frame in which the given line is expressed. * @param other the line to copy. Not modified. * @throws ReferenceFrameMismatchException if {@code this} and {@code other} are not expressed in * the same reference frame. */ default void set(FrameLine3DReadOnly other) { set(other.getReferenceFrame(), other); }
/** * Sets this line to be the same as the given line. * * @param frameLine3DReadOnly the line to copy. Not modified. */ default void setIncludingFrame(FrameLine3DReadOnly frameLine3DReadOnly) { setIncludingFrame(frameLine3DReadOnly.getReferenceFrame(), frameLine3DReadOnly); }
/** * Gets the coordinates of two distinct points this line goes through. * * @param firstPointOnLineToPack the coordinates of a first point located on this line. Modified. * @param secondPointOnLineToPack the coordinates of a second point located on this line. Modified. */ default void getTwoPointsOnLine(FramePoint3DBasics firstPointOnLineToPack, FramePoint3DBasics secondPointOnLineToPack) { firstPointOnLineToPack.setReferenceFrame(getReferenceFrame()); secondPointOnLineToPack.setReferenceFrame(getReferenceFrame()); Line3DReadOnly.super.getTwoPointsOnLine(firstPointOnLineToPack, secondPointOnLineToPack); }
/** * Gets the point and direction defining this line by storing their components in the given * arguments {@code pointToPack} and {@code directionToPack}. * * @param pointToPack point in which the coordinates of this line's point are stored. Modified. * @param directionToPack vector in which the components of this line's direction are stored. * Modified. */ default void get(FramePoint3DBasics pointToPack, FrameVector3DBasics directionToPack) { pointToPack.setReferenceFrame(getReferenceFrame()); directionToPack.setReferenceFrame(getReferenceFrame()); Line3DReadOnly.super.get(pointToPack, directionToPack); }
/** * This methods computes two points P ∈ this line and Q ∈ {@code otherLine} such that the * distance || P - Q || is the minimum distance between the two 3D lines. * <a href="http://geomalgorithms.com/a07-_distance.html"> Useful link</a>. * * @param otherLine the second line. Not modified. * @param closestPointOnThisLineToPack the 3D coordinates of the point P are packed in this 3D * point. Modified. Can be {@code null}. * @param closestPointOnOtherLineToPack the 3D coordinates of the point Q are packed in this 3D * point. Modified. Can be {@code null}. * @return the minimum distance between the two lines. */ default double closestPointsWith(Line3DReadOnly otherLine, FramePoint3DBasics closestPointOnThisLineToPack, FramePoint3DBasics closestPointOnOtherLineToPack) { closestPointOnThisLineToPack.setReferenceFrame(getReferenceFrame()); closestPointOnOtherLineToPack.setReferenceFrame(getReferenceFrame()); return Line3DReadOnly.super.closestPointsWith(otherLine, closestPointOnThisLineToPack, closestPointOnOtherLineToPack); }
/** * Gets the coordinates of two distinct points this line goes through. * * @param firstPointOnLineToPack the coordinates of a first point located on this line. Modified. * @param secondPointOnLineToPack the coordinates of a second point located on this line. Modified. */ default void getTwoPointsOnLine(FramePoint3DBasics firstPointOnLineToPack, Point3DBasics secondPointOnLineToPack) { firstPointOnLineToPack.setReferenceFrame(getReferenceFrame()); Line3DReadOnly.super.getTwoPointsOnLine(firstPointOnLineToPack, secondPointOnLineToPack); }
/** * Gets the coordinates of two distinct points this line goes through. * * @param firstPointOnLineToPack the coordinates of a first point located on this line. Modified. * @param secondPointOnLineToPack the coordinates of a second point located on this line. Modified. */ default void getTwoPointsOnLine(Point3DBasics firstPointOnLineToPack, FramePoint3DBasics secondPointOnLineToPack) { secondPointOnLineToPack.setReferenceFrame(getReferenceFrame()); Line3DReadOnly.super.getTwoPointsOnLine(firstPointOnLineToPack, secondPointOnLineToPack); }
/** * Gets the point and direction defining this line by storing their components in the given * arguments {@code pointToPack} and {@code directionToPack}. * * @param pointToPack point in which the coordinates of this line's point are stored. Modified. * @param directionToPack vector in which the components of this line's direction are stored. * Modified. */ default void get(Point3DBasics pointToPack, FrameVector3DBasics directionToPack) { directionToPack.setReferenceFrame(getReferenceFrame()); Line3DReadOnly.super.get(pointToPack, directionToPack); }
/** * Gets the point and direction defining this line by storing their components in the given * arguments {@code pointToPack} and {@code directionToPack}. * * @param pointToPack point in which the coordinates of this line's point are stored. Modified. * @param directionToPack vector in which the components of this line's direction are stored. * Modified. */ default void get(FramePoint3DBasics pointToPack, Vector3DBasics directionToPack) { pointToPack.setReferenceFrame(getReferenceFrame()); Line3DReadOnly.super.get(pointToPack, directionToPack); }
/** * This methods computes two points P ∈ this line and Q ∈ {@code otherLine} such that the * distance || P - Q || is the minimum distance between the two 3D lines. * <a href="http://geomalgorithms.com/a07-_distance.html"> Useful link</a>. * * @param otherLine the second line. Not modified. * @param closestPointOnThisLineToPack the 3D coordinates of the point P are packed in this 3D * point. Modified. Can be {@code null}. * @param closestPointOnOtherLineToPack the 3D coordinates of the point Q are packed in this 3D * point. Modified. Can be {@code null}. * @return the minimum distance between the two lines. */ default double closestPointsWith(Line3DReadOnly otherLine, FramePoint3DBasics closestPointOnThisLineToPack, Point3DBasics closestPointOnOtherLineToPack) { closestPointOnThisLineToPack.setReferenceFrame(getReferenceFrame()); return Line3DReadOnly.super.closestPointsWith(otherLine, closestPointOnThisLineToPack, closestPointOnOtherLineToPack); }
/** * This methods computes two points P ∈ this line and Q ∈ {@code otherLine} such that the * distance || P - Q || is the minimum distance between the two 3D lines. * <a href="http://geomalgorithms.com/a07-_distance.html"> Useful link</a>. * * @param otherLine the second line. Not modified. * @param closestPointOnThisLineToPack the 3D coordinates of the point P are packed in this 3D * point. Modified. Can be {@code null}. * @param closestPointOnOtherLineToPack the 3D coordinates of the point Q are packed in this 3D * point. Modified. Can be {@code null}. * @return the minimum distance between the two lines. */ default double closestPointsWith(Line3DReadOnly otherLine, Point3DBasics closestPointOnThisLineToPack, FramePoint3DBasics closestPointOnOtherLineToPack) { closestPointOnOtherLineToPack.setReferenceFrame(getReferenceFrame()); return Line3DReadOnly.super.closestPointsWith(otherLine, closestPointOnThisLineToPack, closestPointOnOtherLineToPack); }
/** * This methods computes two points P ∈ this line and Q ∈ {@code otherLine} such that the * distance || P - Q || is the minimum distance between the two 3D lines. * <a href="http://geomalgorithms.com/a07-_distance.html"> Useful link</a>. * * @param otherLine the second line. Not modified. * @param closestPointOnThisLineToPack the 3D coordinates of the point P are packed in this 3D * point. Modified. Can be {@code null}. * @param closestPointOnOtherLineToPack the 3D coordinates of the point Q are packed in this 3D * point. Modified. Can be {@code null}. * @return the minimum distance between the two lines. * @throws ReferenceFrameMismatchException if {@code this} and {@code otherLine} are not expressed * in the same reference frame. */ default double closestPointsWith(FrameLine3DReadOnly otherLine, FramePoint3DBasics closestPointOnThisLineToPack, FramePoint3DBasics closestPointOnOtherLineToPack) { checkReferenceFrameMatch(otherLine); closestPointOnThisLineToPack.setReferenceFrame(getReferenceFrame()); closestPointOnOtherLineToPack.setReferenceFrame(getReferenceFrame()); return Line3DReadOnly.super.closestPointsWith(otherLine, closestPointOnThisLineToPack, closestPointOnOtherLineToPack); }
/** * Calculates the coordinates of the point 'p' given the parameter 't' as follows:<br> * p = t * n + p<sub>0</sub><br> * where n is the unit-vector defining the direction of this line and p<sub>0</sub> is the point * defining this line which also corresponds to the point for which t=0. * <p> * Note that the absolute value of 't' is equal to the distance between the point 'p' and the point * p<sub>0</sub> defining this line. * </p> * * @param t the parameter used to calculate the point coordinates. * @param pointToPack the point in which the coordinates of 'p' are stored. Modified. */ default void pointOnLineGivenParameter(double t, FramePoint3DBasics pointToPack) { pointToPack.setReferenceFrame(getReferenceFrame()); Line3DReadOnly.super.pointOnLineGivenParameter(t, pointToPack); }
/** * Computes the orthogonal projection of the given 3D point on this 3D line. * <p> * Edge cases: * <ul> * <li>if the given line direction is too small, i.e. * {@code lineDirection.lengthSquared() < }{@value EuclidGeometryTools#ONE_TRILLIONTH}, this method fails and returns * {@code false}. * </ul> * </p> * * @param pointToProject the point to compute the projection of. 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. */ default boolean orthogonalProjection(Point3DReadOnly pointToProject, FramePoint3DBasics projectionToPack) { projectionToPack.setReferenceFrame(getReferenceFrame()); return Line3DReadOnly.super.orthogonalProjection(pointToProject, projectionToPack); }
/** * Sets this line to be the same as the given line expressed in the reference frame of this. * <p> * If {@code other} is expressed in the frame as {@code this}, then this method is equivalent to * {@link #set(FrameLine3DReadOnly)}. * </p> * <p> * If {@code other} is expressed in a different frame than {@code this}, then {@code this} is set to * {@code other} and then transformed to be expressed in {@code this.getReferenceFrame()}. * </p> * * @param other the other frame line to set this to. Not modified. */ default void setMatchingFrame(FrameLine3DReadOnly other) { Line3DBasics.super.set(other); other.getReferenceFrame().transformFromThisToDesiredFrame(getReferenceFrame(), this); }
/** * This methods computes two points P ∈ this line and Q ∈ {@code otherLine} such that the * distance || P - Q || is the minimum distance between the two 3D lines. * <a href="http://geomalgorithms.com/a07-_distance.html"> Useful link</a>. * * @param otherLine the second line. Not modified. * @param closestPointOnThisLineToPack the 3D coordinates of the point P are packed in this 3D * point. Modified. Can be {@code null}. * @param closestPointOnOtherLineToPack the 3D coordinates of the point Q are packed in this 3D * point. Modified. Can be {@code null}. * @return the minimum distance between the two lines. * @throws ReferenceFrameMismatchException if {@code this} and {@code otherLine} are not expressed * in the same reference frame. */ default double closestPointsWith(FrameLine3DReadOnly otherLine, FramePoint3DBasics closestPointOnThisLineToPack, Point3DBasics closestPointOnOtherLineToPack) { checkReferenceFrameMatch(otherLine); closestPointOnThisLineToPack.setReferenceFrame(getReferenceFrame()); return Line3DReadOnly.super.closestPointsWith(otherLine, closestPointOnThisLineToPack, closestPointOnOtherLineToPack); }
/** * This methods computes two points P ∈ this line and Q ∈ {@code otherLine} such that the * distance || P - Q || is the minimum distance between the two 3D lines. * <a href="http://geomalgorithms.com/a07-_distance.html"> Useful link</a>. * * @param otherLine the second line. Not modified. * @param closestPointOnThisLineToPack the 3D coordinates of the point P are packed in this 3D * point. Modified. Can be {@code null}. * @param closestPointOnOtherLineToPack the 3D coordinates of the point Q are packed in this 3D * point. Modified. Can be {@code null}. * @return the minimum distance between the two lines. * @throws ReferenceFrameMismatchException if {@code this} and {@code otherLine} are not expressed * in the same reference frame. */ default double closestPointsWith(FrameLine3DReadOnly otherLine, Point3DBasics closestPointOnThisLineToPack, FramePoint3DBasics closestPointOnOtherLineToPack) { checkReferenceFrameMatch(otherLine); closestPointOnOtherLineToPack.setReferenceFrame(getReferenceFrame()); return Line3DReadOnly.super.closestPointsWith(otherLine, closestPointOnThisLineToPack, closestPointOnOtherLineToPack); }