@Test public void testIntersectLine() { ILine line = Line.fromPoints(Vector2f.ZERO_VECTOR, Vector2f.X_AXIS); rotateSegment(0, 360, ((degAngle, radAngle, segment) -> { Optional<IVector2> intersection = segment.intersectLine(line); if (degAngle < 210 || degAngle > 330) { assertThat(intersection, isNotPresent()); } else { double xVal = -1.0d / SumatraMath.tan(radAngle); IVector2 expected = Vector2.fromXY(xVal, 0); assertThat(intersection, isPresentAnd(is(expected))); } })); }
@Override public Optional<IVector2> intersectLine(final ILine line) { return line.intersectSegment(this); }
LineSegment extends ALine implements ILineSegment { @Override public Optional<IVector2> intersectLine(final ILine line) { return line.intersectSegment(this); } }
LineSegment extends ALine implements ILineSegment { @Override public Optional<IVector2> intersectLine(final ILine line) { return line.intersectSegment(this); } @SuppressWarnings("unused") private  LineSegment(); private  LineSegment(final IVector2 start, final IVector2 end); }
LineSegment extends ALine implements ILineSegment { @Override public Optional<IVector2> intersectLine(final ILine line) { return line.intersectSegment(this); } @SuppressWarnings("unused") private  LineSegment(); private  LineSegment(final IVector2 start, final IVector2 end); static ILineSegment fromOffset(final IVector2 supportVector, final IVector2 offset); static ILineSegment fromPoints(final IVector2 start, final IVector2 end); @Override boolean isValid(); @Override final boolean equals(final Object other); @Override final int hashCode(); @Override IVector2 getStart(); @Override IVector2 getEnd(); @Override IVector2 getCenter(); @Override double getLength(); @Override IVector2 directionVector(); @Override IVector2 closestPointOnLine(final IVector2 point); @Override ILine toLine(); @Override IHalfLine toHalfLine(); @Override ILineSegment copy(); @Override Optional<IVector2> intersectLine(final ILine line); @Override Optional<IVector2> intersectHalfLine(final IHalfLine halfLine); @Override Optional<IVector2> intersectSegment(final ILineSegment other); @Override IVector2 stepAlongLine(final double stepSize); @Override ILineSegment withMargin(final double margin); @Override String toString(); @Override List<IVector2> getSteps(final double stepSize); }
LineSegment extends ALine implements ILineSegment { @Override public Optional<IVector2> intersectLine(final ILine line) { return line.intersectSegment(this); } @SuppressWarnings("unused") private  LineSegment(); private  LineSegment(final IVector2 start, final IVector2 end); static ILineSegment fromOffset(final IVector2 supportVector, final IVector2 offset); static ILineSegment fromPoints(final IVector2 start, final IVector2 end); @Override boolean isValid(); @Override final boolean equals(final Object other); @Override final int hashCode(); @Override IVector2 getStart(); @Override IVector2 getEnd(); @Override IVector2 getCenter(); @Override double getLength(); @Override IVector2 directionVector(); @Override IVector2 closestPointOnLine(final IVector2 point); @Override ILine toLine(); @Override IHalfLine toHalfLine(); @Override ILineSegment copy(); @Override Optional<IVector2> intersectLine(final ILine line); @Override Optional<IVector2> intersectHalfLine(final IHalfLine halfLine); @Override Optional<IVector2> intersectSegment(final ILineSegment other); @Override IVector2 stepAlongLine(final double stepSize); @Override ILineSegment withMargin(final double margin); @Override String toString(); @Override List<IVector2> getSteps(final double stepSize);  }