@Test public void testDistanceTo() { IVector2 sV = Vector2.fromXY(0, 0); IVector2 dV = Vector2.fromXY(0, 1); ILine line = Line.fromDirection(sV, dV); ILine invalidLine = Line.fromDirection(sV, Vector2f.ZERO_VECTOR); for (int i = -10; i <= 10; i += 1) { assertThat(line.distanceTo(Vector2.fromXY(1, i)), closeTo(1, ACCURACY)); assertThat(line.distanceTo(Vector2.fromXY(0, i)), closeTo(0, ACCURACY)); assertThat(line.distanceTo(Vector2.fromXY(i, 0)), closeTo(Math.abs(i), ACCURACY)); assertThat(invalidLine.distanceTo(Vector2.fromXY(1, i)), closeTo(Math.sqrt(1 + i * i), ACCURACY)); } }
public static ILine fromDirection(final IVector2 supportVector, final IVector2 directionVector) { return createNewFromVectorCopy(supportVector, directionVector); }
Line extends AUnboundedLine implements ILine { public static ILine fromDirection(final IVector2 supportVector, final IVector2 directionVector) { return createNewFromVectorCopy(supportVector, directionVector); } }
Line extends AUnboundedLine implements ILine { public static ILine fromDirection(final IVector2 supportVector, final IVector2 directionVector) { return createNewFromVectorCopy(supportVector, directionVector); } private  Line(final IVector2 supportVector, final IVector2 directionVector); }
Line extends AUnboundedLine implements ILine { public static ILine fromDirection(final IVector2 supportVector, final IVector2 directionVector) { return createNewFromVectorCopy(supportVector, directionVector); } private  Line(final IVector2 supportVector, final IVector2 directionVector); static ILine fromPoints(final IVector2 supportPointA, final IVector2 supportPointB); static ILine fromDirection(final IVector2 supportVector, final IVector2 directionVector); @Override ILine copy(); @Override final boolean equals(final Object other); @Override final int hashCode(); @Override Optional<Double> getYIntercept(); @Override Optional<Double> getXValue(final double y); @Override Optional<Double> getYValue(final double x); @Override ILine getOrthogonalLine(); @Override IVector2 closestPointOnLine(final IVector2 point); @Override ILine toLine(); @Override Optional<IVector2> intersectLine(final ILine other); @Override Optional<IVector2> intersectHalfLine(final IHalfLine halfLine); @Override Optional<IVector2> intersectSegment(final ILineSegment segment); @Override String toString(); }
Line extends AUnboundedLine implements ILine { public static ILine fromDirection(final IVector2 supportVector, final IVector2 directionVector) { return createNewFromVectorCopy(supportVector, directionVector); } private  Line(final IVector2 supportVector, final IVector2 directionVector); static ILine fromPoints(final IVector2 supportPointA, final IVector2 supportPointB); static ILine fromDirection(final IVector2 supportVector, final IVector2 directionVector); @Override ILine copy(); @Override final boolean equals(final Object other); @Override final int hashCode(); @Override Optional<Double> getYIntercept(); @Override Optional<Double> getXValue(final double y); @Override Optional<Double> getYValue(final double x); @Override ILine getOrthogonalLine(); @Override IVector2 closestPointOnLine(final IVector2 point); @Override ILine toLine(); @Override Optional<IVector2> intersectLine(final ILine other); @Override Optional<IVector2> intersectHalfLine(final IHalfLine halfLine); @Override Optional<IVector2> intersectSegment(final ILineSegment segment); @Override String toString();  }