/** * Changes the first endpoint of this line segment. * * @param firstEndpointX x-coordinate of the new first endpoint. * @param firstEndpointY y-coordinate of the new first endpoint. * @param firstEndpointZ z-coordinate of the new first endpoint. */ default void setFirstEndpoint(double firstEndpointX, double firstEndpointY, double firstEndpointZ) { getFirstEndpoint().set(firstEndpointX, firstEndpointY, firstEndpointZ); }
/** * Changes the first endpoint of this line segment. * * @param firstEndpoint new endpoint of this line segment. Not modified. */ default void setFirstEndpoint(Point3DReadOnly firstEndpoint) { getFirstEndpoint().set(firstEndpoint); }
/** * Transforms this line segment using the inverse of the given homogeneous transformation matrix. * * @param transform the transform to apply on the endpoints of this line segment. Not modified. */ @Override default void applyInverseTransform(Transform transform) { getFirstEndpoint().applyInverseTransform(transform); getSecondEndpoint().applyInverseTransform(transform); } }
/** * Sets both endpoints of this line segment to zero. */ @Override default void setToZero() { getFirstEndpoint().setToZero(); getSecondEndpoint().setToZero(); }
/** * Tests if this line segment contains {@link Double#NaN}. * * @return {@code true} if {@link #getFirstEndpoint()} and/or {@link #getSecondEndpoint()} contains * {@link Double#NaN}, {@code false} otherwise. */ @Override default boolean containsNaN() { return getFirstEndpoint().containsNaN() || getSecondEndpoint().containsNaN(); }
/** * Sets both endpoints of this line segment to {@link Double#NaN}. After calling this method, this * line segment becomes invalid. A new pair of valid endpoints will have to be set so this line * segment is again usable. */ @Override default void setToNaN() { getFirstEndpoint().setToNaN(); getSecondEndpoint().setToNaN(); }
/** * Transforms this line segment using the given homogeneous transformation matrix. * * @param transform the transform to apply on the endpoints of this line segment. Not modified. */ @Override default void applyTransform(Transform transform) { getFirstEndpoint().applyTransform(transform); getSecondEndpoint().applyTransform(transform); }
/** * Redefines this line segment with a new first endpoint and a vector going from the first to the * second endpoint. * * @param firstEndpoint new first endpoint. Not modified. * @param fromFirstToSecondEndpoint vector going from the first to the second endpoint. Not * modified. */ default void set(Point3DReadOnly firstEndpoint, Vector3DReadOnly fromFirstToSecondEndpoint) { getFirstEndpoint().set(firstEndpoint); getSecondEndpoint().add(firstEndpoint, fromFirstToSecondEndpoint); }
/** * Translates this line segment by the given (x, y, z). * <p> * Note that the length and direction of this line segment 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) { getFirstEndpoint().add(x, y, z); getSecondEndpoint().add(x, y, z); }