/** * Redefines this line segments with new endpoints. * * @param firstEndpointX x-coordinate of the new first endpoint. * @param firstEndpointY y-coordinate of the new first endpoint. * @param secondEndpointX x-coordinate of the new second endpoint. * @param secondEndpointY y-coordinate of the new second endpoint. */ default void set(double firstEndpointX, double firstEndpointY, double secondEndpointX, double secondEndpointY) { setFirstEndpoint(firstEndpointX, firstEndpointY); setSecondEndpoint(secondEndpointX, secondEndpointY); }
/** * Changes the first endpoint of this line segment. * * @param referenceFrame the reference frame in which the given coordinates are expressed. * @param firstEndpointX x-coordinate of the new first endpoint. * @param firstEndpointY y-coordinate of the new first endpoint. * @throws ReferenceFrameMismatchException if {@code this.getReferenceFrame() != referenceFrame}. */ default void setFirstEndpoint(ReferenceFrame referenceFrame, double firstEndpointX, double firstEndpointY) { checkReferenceFrameMatch(referenceFrame); LineSegment2DBasics.super.setFirstEndpoint(firstEndpointX, firstEndpointY); }
/** * Redefines this line segment with new endpoints. * * @param firstEndpoint new endpoint of this line segment. Not modified * @param secondEndpoint new second endpoint of this line segment. Not modified. */ default void set(Point2DReadOnly firstEndpoint, Point2DReadOnly secondEndpoint) { setFirstEndpoint(firstEndpoint); setSecondEndpoint(secondEndpoint); }
/** * Redefines this line segment with new endpoints. * * @param firstEndpoint new endpoint of this line segment. Not modified * @param secondEndpoint new second endpoint of this line segment. Not modified. */ default void set(Point3DReadOnly firstEndpoint, Point3DReadOnly secondEndpoint) { setFirstEndpoint(firstEndpoint); setSecondEndpoint(secondEndpoint); }
/** * Changes the first endpoint of this line segment. * * @param referenceFrame the reference frame in which the given coordinates are expressed. * @param firstEndpoint new endpoint of this line segment. Not modified. * @throws ReferenceFrameMismatchException if {@code this.getReferenceFrame() != referenceFrame}. */ default void setFirstEndpoint(ReferenceFrame referenceFrame, Point2DReadOnly firstEndpoint) { checkReferenceFrameMatch(referenceFrame); LineSegment2DBasics.super.setFirstEndpoint(firstEndpoint); }
/** * Changes the first endpoint of this line segment. * * @param referenceFrame the reference frame in which the given coordinates are expressed. * @param firstEndpoint new endpoint of this line segment. Not modified. * @throws ReferenceFrameMismatchException if {@code this.getReferenceFrame() != referenceFrame}. */ default void setFirstEndpoint(ReferenceFrame referenceFrame, Point3DReadOnly firstEndpoint) { checkReferenceFrameMatch(referenceFrame); LineSegment2DBasics.super.setFirstEndpoint(firstEndpoint); }
/** * Changes the first endpoint of this line segment. * * @param firstEndpoint new endpoint of this line segment. Not modified */ default void setFirstEndpoint(Point3DReadOnly firstEndpoint) { setFirstEndpoint(firstEndpoint.getX(), firstEndpoint.getY()); }
/** * Changes the first endpoint of this line segment. * * @param firstEndpoint new endpoint of this line segment. Not modified */ default void setFirstEndpoint(Point2DReadOnly firstEndpoint) { setFirstEndpoint(firstEndpoint.getX(), firstEndpoint.getY()); }
/** * Swaps this line segment's endpoints. */ default void flipDirection() { double x = getFirstEndpointX(); double y = getFirstEndpointY(); setFirstEndpoint(getSecondEndpoint()); setSecondEndpoint(x, y); }
/** * Translates this line segment by the given (x, y). * <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. */ default void translate(double x, double y) { setFirstEndpoint(getFirstEndpointX() + x, getFirstEndpointY() + y); setSecondEndpoint(getSecondEndpointX() + x, getSecondEndpointY() + y); }
/** * 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) { setFirstEndpoint(firstEndpoint); setSecondEndpoint(firstEndpoint); getSecondEndpoint().add(fromFirstToSecondEndpoint.getX(), fromFirstToSecondEndpoint.getY()); }