/** * 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. * @throws ReferenceFrameMismatchException if {@code this}, {@code firstEndpoint}, and * {@code secondEndpoint} are not expressed in the same reference frame. */ default void set(FramePoint3DReadOnly firstEndpoint, FramePoint3DReadOnly secondEndpoint) { checkReferenceFrameMatch(firstEndpoint); checkReferenceFrameMatch(secondEndpoint); LineSegment2DBasics.super.set(firstEndpoint, secondEndpoint); }
/** * Changes the first endpoint of this line segment. * * @param firstEndpoint new endpoint of this line segment. Not modified. * @throws ReferenceFrameMismatchException if {@code this} and {@code firstEndpoint} are not * expressed in the same reference frame. */ default void setFirstEndpoint(FramePoint2DReadOnly firstEndpoint) { setFirstEndpoint(firstEndpoint.getReferenceFrame(), firstEndpoint); }
/** * Changes the second endpoint of this line segment. * * @param secondEndpoint new second endpoint of this line segment. Not modified. * @throws ReferenceFrameMismatchException if {@code this} and {@code secondEndpoint} are not * expressed in the same reference frame. */ default void setSecondEndpoint(FramePoint2DReadOnly secondEndpoint) { setSecondEndpoint(secondEndpoint.getReferenceFrame(), secondEndpoint); }
/** * Sets this line segment to be same as the given line segment 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(FrameLineSegment2DReadOnly)}. * </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 segment to set this to. Not modified. */ default void setMatchingFrame(FrameLineSegment2DReadOnly other) { LineSegment2DBasics.super.set(other); other.getReferenceFrame().transformFromThisToDesiredFrame(getReferenceFrame(), this); }
@Test public void testSetMatchingFrame() throws Exception { Random random = new Random(544354); for (int i = 0; i < ITERATIONS; i++) { ReferenceFrame sourceFrame = EuclidFrameRandomTools.nextReferenceFrame(random, true); ReferenceFrame destinationFrame = EuclidFrameRandomTools.nextReferenceFrame(random, true); FrameLineSegment2DReadOnly source = EuclidFrameRandomTools.nextFrameLineSegment2D(random, sourceFrame); FixedFrameLineSegment2DBasics actual = EuclidFrameRandomTools.nextFrameLineSegment2D(random, destinationFrame); actual.setMatchingFrame(source); FrameLineSegment2D expected = new FrameLineSegment2D(source); expected.changeFrame(destinationFrame); EuclidGeometryTestTools.assertLineSegment2DEquals(expected, actual, EPSILON); } } }
/** * 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. * @throws ReferenceFrameMismatchException if {@code this}, {@code firstEndpoint}, and * {@code secondEndpoint} are not expressed in the same reference frame. */ default void set(FramePoint2DReadOnly firstEndpoint, FramePoint2DReadOnly secondEndpoint) { checkReferenceFrameMatch(firstEndpoint); checkReferenceFrameMatch(secondEndpoint); LineSegment2DBasics.super.set(firstEndpoint, secondEndpoint); }
/** * Changes the second endpoint of this line segment. * * @param secondEndpoint new second endpoint of this line segment. Not modified. * @throws ReferenceFrameMismatchException if {@code this} and {@code secondEndpoint} are not * expressed in the same reference frame. */ default void setSecondEndpoint(FramePoint3DReadOnly secondEndpoint) { setSecondEndpoint(secondEndpoint.getReferenceFrame(), secondEndpoint); }
/** * Changes the first endpoint of this line segment. * * @param firstEndpoint new endpoint of this line segment. Not modified. * @throws ReferenceFrameMismatchException if {@code this} and {@code firstEndpoint} are not * expressed in the same reference frame. */ default void setFirstEndpoint(FramePoint3DReadOnly firstEndpoint) { setFirstEndpoint(firstEndpoint.getReferenceFrame(), firstEndpoint); }
/** * 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. * @throws ReferenceFrameMismatchException if {@code this}, {@code firstEndpoint}, and * {@code fromFirstToSecondEndpoint} are not expressed in the same reference frame. */ default void set(FramePoint3DReadOnly firstEndpoint, FrameVector3DReadOnly fromFirstToSecondEndpoint) { checkReferenceFrameMatch(firstEndpoint); checkReferenceFrameMatch(fromFirstToSecondEndpoint); LineSegment2DBasics.super.set(firstEndpoint, fromFirstToSecondEndpoint); }
/** * 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. * @throws ReferenceFrameMismatchException if {@code this}, {@code firstEndpoint}, and * {@code fromFirstToSecondEndpoint} are not expressed in the same reference frame. */ default void set(FramePoint2DReadOnly firstEndpoint, FrameVector2DReadOnly fromFirstToSecondEndpoint) { checkReferenceFrameMatch(firstEndpoint); checkReferenceFrameMatch(fromFirstToSecondEndpoint); LineSegment2DBasics.super.set(firstEndpoint, fromFirstToSecondEndpoint); }
/** * 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 second endpoint of this line segment. * * @param referenceFrame the reference frame in which the given coordinates are expressed. * @param secondEndpoint new second endpoint of this line segment. Not modified. * @throws ReferenceFrameMismatchException if {@code this.getReferenceFrame() != referenceFrame}. */ default void setSecondEndpoint(ReferenceFrame referenceFrame, Point3DReadOnly secondEndpoint) { checkReferenceFrameMatch(referenceFrame); LineSegment2DBasics.super.setSecondEndpoint(secondEndpoint); }
/** * Changes the second endpoint of this line segment. * * @param referenceFrame the reference frame in which the given coordinates are expressed. * @param secondEndpoint new second endpoint of this line segment. Not modified. * @throws ReferenceFrameMismatchException if {@code this.getReferenceFrame() != referenceFrame}. */ default void setSecondEndpoint(ReferenceFrame referenceFrame, Point2DReadOnly secondEndpoint) { checkReferenceFrameMatch(referenceFrame); LineSegment2DBasics.super.setSecondEndpoint(secondEndpoint); }
/** * Sets this line segment to be same as the given line segment projected on the XY-plane. * * @param other the other line segment to copy. Not modified. * @throws ReferenceFrameMismatchException if {@code this} and {@code other} are not expressed in * the same reference frame. */ default void set(FrameLineSegment3DReadOnly other) { checkReferenceFrameMatch(other); LineSegment2DBasics.super.set(other); }
/** * Sets this line segment to be same as the given line segment. * * @param other the other line segment to copy. Not modified. * @throws ReferenceFrameMismatchException if {@code this} and {@code other} are not expressed in * the same reference frame. */ default void set(FrameLineSegment2DReadOnly other) { checkReferenceFrameMatch(other); LineSegment2DBasics.super.set(other); }
/** * 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. * @throws ReferenceFrameMismatchException if {@code this} and {@code secondEndpoint} are not * expressed in the same reference frame. */ default void set(Point2DReadOnly firstEndpoint, FramePoint2DReadOnly secondEndpoint) { checkReferenceFrameMatch(secondEndpoint); LineSegment2DBasics.super.set(firstEndpoint, secondEndpoint); }
/** * 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. * @throws ReferenceFrameMismatchException if {@code this} and {@code firstEndpoint} are not * expressed in the same reference frame. */ default void set(FramePoint2DReadOnly firstEndpoint, Point2DReadOnly secondEndpoint) { checkReferenceFrameMatch(firstEndpoint); LineSegment2DBasics.super.set(firstEndpoint, secondEndpoint); }
/** * Changes the second endpoint of this line segment. * * @param referenceFrame the reference frame in which the given coordinates are expressed. * @param secondEndpointX x-coordinate of the new second endpoint. * @param secondEndpointY y-coordinate of the new second endpoint. * @throws ReferenceFrameMismatchException if {@code this.getReferenceFrame() != referenceFrame}. */ default void setSecondEndpoint(ReferenceFrame referenceFrame, double secondEndpointX, double secondEndpointY) { checkReferenceFrameMatch(referenceFrame); LineSegment2DBasics.super.setSecondEndpoint(secondEndpointX, secondEndpointY); }