/** * Sets this line to be the same as the given line. * * @param other the other line to copy. Not modified. */ @Override public void set(Line3D other) { Line3DBasics.super.set(other); }
/** * Redefines this line with a new point and a new direction vector. * * @param pointOnLine new point on this line. Not modified. * @param lineDirection new direction of this line. Not modified. */ default void set(Point3DReadOnly pointOnLine, Vector3DReadOnly lineDirection) { setPoint(pointOnLine); setDirection(lineDirection); }
/** * Tests on a per-component basis on the point and vector if this line is equal to {@code other} * with the tolerance {@code epsilon}. This method will return {@code false} if the two lines are * physically the same but either the point or vector of each line is different. For instance, if * {@code this.point == other.point} and {@code this.direction == - other.direction}, the two lines * are physically the same but this method returns {@code false}. * * @param other the query. Not modified. * @param epsilon the tolerance to use. * @return {@code true} if the two lines are equal, {@code false} otherwise. */ @Override public boolean epsilonEquals(Line3D other, double epsilon) { return Line3DBasics.super.epsilonEquals(other, epsilon); }
/** * Sets the point and vector of this line to zero. After calling this method, this line becomes * invalid. A new valid point and valid vector will have to be set so this line is again usable. */ @Override default void setToZero() { getPoint().setToZero(); getDirection().setToZero(); }
/** * Redefines this line such that it goes through the two given points. * * @param firstPointOnLine first point on this line. Not modified. * @param secondPointOnLine second point on this line. Not modified. * @throws RuntimeException if the two given points are exactly equal. */ default void set(Point3DReadOnly firstPointOnLine, Point3DReadOnly secondPointOnLine) { // checkDistinctPoints if (firstPointOnLine.equals(secondPointOnLine)) { throw new RuntimeException("Tried to create a line from two coincidal points"); } setPoint(firstPointOnLine); getDirection().sub(secondPointOnLine, firstPointOnLine); getDirection().normalize(); }
/** * Changes the point through which this line has to go. * * @param pointOnLine new point on this line. Not modified. * @throws ReferenceFrameMismatchException if {@code this} and {@code pointOnLine} are not expressed * in the same reference frame. */ default void setPoint(FramePoint3DReadOnly pointOnLine) { checkReferenceFrameMatch(pointOnLine); Line3DBasics.super.setPoint(pointOnLine); }
/** * Changes the direction of this line by setting it to the normalized value of the given vector. * * @param lineDirection new direction of this line. Not modified. * @throws ReferenceFrameMismatchException if {@code this} and {@code lineDirection} are not * expressed in the same reference frame. */ default void setDirection(FrameVector3DReadOnly lineDirection) { checkReferenceFrameMatch(lineDirection); Line3DBasics.super.setDirection(lineDirection); }
/** * Changes the direction of this line by setting it to the normalized value of the given vector. * * @param lineDirection new direction of this line. Not modified. */ default void setDirection(Vector3DReadOnly lineDirection) { getDirection().set(lineDirection); getDirection().normalize(); }
/** * Changes the point through which this line has to go. * * @param pointOnLineX the new x-coordinate of the point on this line. * @param pointOnLineY the new y-coordinate of the point on this line. * @param pointOnLineZ the new z-coordinate of the point on this line. */ default void setPoint(double pointOnLineX, double pointOnLineY, double pointOnLineZ) { getPoint().set(pointOnLineX, pointOnLineY, pointOnLineZ); }
/** * Compares {@code this} to {@code other} to determine if the two lines are geometrically similar. * <p> * Two lines are considered geometrically equal is they are collinear, pointing toward the same or * opposite direction. * </p> * * @param other the line to compare to. Not modified. * @param epsilon the tolerance of the comparison. * @return {@code true} if the two lines represent the same geometry, {@code false} otherwise. */ @Override public boolean geometricallyEquals(Line3D other, double epsilon) { return Line3DBasics.super.geometricallyEquals(other, epsilon); }
/** * Transforms this line using the given homogeneous transformation matrix. * * @param transform the transform to apply on this line's point and vector. Not modified. */ @Override default void applyTransform(Transform transform) { getPoint().applyTransform(transform); getDirection().applyTransform(transform); }
/** * Changes the direction of this line by setting it to the normalized values provided. * * @param lineDirectionX the new x-component of the direction of this line. * @param lineDirectionY the new y-component of the direction of this line. * @param lineDirectionZ the new z-component of the direction of this line. */ default void setDirection(double lineDirectionX, double lineDirectionY, double lineDirectionZ) { getDirection().set(lineDirectionX, lineDirectionY, lineDirectionZ); getDirection().normalize(); }
/** * Changes the point through which this line has to go. * * @param pointOnLine new point on this line. Not modified. */ default void setPoint(Point3DReadOnly pointOnLine) { getPoint().set(pointOnLine); }
/** * Sets the point and vector of this line to {@link Double#NaN}. After calling this method, this * line becomes invalid. A new valid point and valid vector will have to be set so this line is * again usable. */ @Override default void setToNaN() { getPoint().setToNaN(); getDirection().setToNaN(); }
/** * Redefines this line with a new point and a new direction vector. * * @param pointOnLineX the new x-coordinate of the point on this line. * @param pointOnLineY the new y-coordinate of the point on this line. * @param pointOnLineZ the new z-coordinate of the point on this line. * @param lineDirectionX the new x-component of the direction of this line. * @param lineDirectionY the new y-component of the direction of this line. * @param lineDirectionZ the new z-component of the direction of this line. */ default void set(double pointOnLineX, double pointOnLineY, double pointOnLineZ, double lineDirectionX, double lineDirectionY, double lineDirectionZ) { setPoint(pointOnLineX, pointOnLineY, pointOnLineZ); setDirection(lineDirectionX, lineDirectionY, lineDirectionZ); }
/** * Sets this line to go through the endpoints of the given line segment. * <p> * After calling this method this line is in the XY-plane. * </p> * * @param lineSegment2DReadOnly the line segment to get the endpoints from. Not modified. */ default void set(LineSegment2DReadOnly lineSegment2DReadOnly) { set(lineSegment2DReadOnly.getFirstEndpoint(), lineSegment2DReadOnly.getSecondEndpoint()); }
/** * Flips this line's direction. */ default void negateDirection() { getDirection().negate(); }
/** * Translates this line by the given (x, y, z). * <p> * Note that this line's direction remains unchanged. * </p> * * @param x the distance to translate this line along the x-axis. * @param y the distance to translate this line along the y-axis. * @param z the distance to translate this line along the z-axis. */ default void translate(double x, double y, double z) { getPoint().add(x, y, z); }
/** * Transforms this line using the inverse of the given homogeneous transformation matrix. * * @param transform the transform to apply on this line's point and vector. Not modified. */ @Override default void applyInverseTransform(Transform transform) { getPoint().applyInverseTransform(transform); getDirection().applyInverseTransform(transform); } }
/** * Sets this line to go through the endpoints of the given line segment. * * @param lineSegment3DReadOnly the line segment to get the endpoints from. Not modified. */ default void set(LineSegment3DReadOnly lineSegment3DReadOnly) { set(lineSegment3DReadOnly.getFirstEndpoint(), lineSegment3DReadOnly.getSecondEndpoint()); }