/** * 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); }
/** * 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); }
/** * 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); }
/** * 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(); }