@Test public void testStepAlongLine() { for (double length = 0.0; length < 1000; length += 1) { final double s1 = random.nextDouble() - 0.5; final double s2 = random.nextDouble() - 0.5; final double r1 = random.nextDouble(); final double r2 = random.nextDouble(); Vector2 start = Vector2.fromXY(s1 * 1e4, s2 * 1e4); if ((r1 + r2) < TEST_ACCURACY) { continue; } Vector2 endD = Vector2.fromXY(r1 - 0.5, r2 - 0.5); Vector2 end = endD.scaleToNew(length).add(start); for (double i = 0.0; i < length; i += (0.01 * length)) { final IVector2 result = LineMath.stepAlongLine(start, end, i); final IVector2 expected = endD.scaleToNew(i).add(start); assertThat(result).isEqualTo(expected); } } }
public static IVector2 stepAlongLine(final IVector2 start, final IVector2 end, final double stepSize) { return edu.tigers.sumatra.math.line.v2.LineMath.stepAlongLine(start, end, stepSize); }
LineMath { public static IVector2 stepAlongLine(final IVector2 start, final IVector2 end, final double stepSize) { return edu.tigers.sumatra.math.line.v2.LineMath.stepAlongLine(start, end, stepSize); } }
LineMath { public static IVector2 stepAlongLine(final IVector2 start, final IVector2 end, final double stepSize) { return edu.tigers.sumatra.math.line.v2.LineMath.stepAlongLine(start, end, stepSize); } @SuppressWarnings("unused") private  LineMath(); }
LineMath { public static IVector2 stepAlongLine(final IVector2 start, final IVector2 end, final double stepSize) { return edu.tigers.sumatra.math.line.v2.LineMath.stepAlongLine(start, end, stepSize); } @SuppressWarnings("unused") private  LineMath(); static Optional<Double> getSlope(ILine line); static Optional<Double> getYIntercept(ILine line); static Optional<Double> getYValue(ILine line, final double x); static Optional<Double> getXValue(ILine line, final double y); static Optional<Double> getAngle(ILine line); static Vector2 leadPointOnLine(final ILine line, final IVector2 point); static Optional<IVector2> intersectionPoint(final ILine line1, final ILine line2); static Optional<IVector2> intersectionPointOfSegments(
			final ILine line1,
			final ILine line2); static Optional<IVector2> intersectionPointWithSegment(final ILine line, final ILine segment); static Optional<IVector2> intersectionPointOfLineAndHalfLine(final ILine line, final ILine halfLine); static Optional<IVector2> intersectionPointOfHalfLineAndHalfLine(final ILine halfLineA, final ILine halfLineB); static boolean isPointOnLineSegment(ILine line, final IVector2 point, final double margin); static boolean isPointInFront(final ILine line, final IVector2 point); static Vector2 nearestPointOnLineSegment(final ILine line, final IVector2 point); static Vector2 nearestPointOnHalfLine(final ILine halfLine, final IVector2 point); static double distancePL(final IVector2 point, final ILine line); static double distancePointHalfLine(final IVector2 point, final ILine halfLine); static double distancePointLineSegment(final IVector2 point, final ILine lineSegment); static IVector2 stepAlongLine(final IVector2 start, final IVector2 end, final double stepSize); }
LineMath { public static IVector2 stepAlongLine(final IVector2 start, final IVector2 end, final double stepSize) { return edu.tigers.sumatra.math.line.v2.LineMath.stepAlongLine(start, end, stepSize); } @SuppressWarnings("unused") private  LineMath(); static Optional<Double> getSlope(ILine line); static Optional<Double> getYIntercept(ILine line); static Optional<Double> getYValue(ILine line, final double x); static Optional<Double> getXValue(ILine line, final double y); static Optional<Double> getAngle(ILine line); static Vector2 leadPointOnLine(final ILine line, final IVector2 point); static Optional<IVector2> intersectionPoint(final ILine line1, final ILine line2); static Optional<IVector2> intersectionPointOfSegments(
			final ILine line1,
			final ILine line2); static Optional<IVector2> intersectionPointWithSegment(final ILine line, final ILine segment); static Optional<IVector2> intersectionPointOfLineAndHalfLine(final ILine line, final ILine halfLine); static Optional<IVector2> intersectionPointOfHalfLineAndHalfLine(final ILine halfLineA, final ILine halfLineB); static boolean isPointOnLineSegment(ILine line, final IVector2 point, final double margin); static boolean isPointInFront(final ILine line, final IVector2 point); static Vector2 nearestPointOnLineSegment(final ILine line, final IVector2 point); static Vector2 nearestPointOnHalfLine(final ILine halfLine, final IVector2 point); static double distancePL(final IVector2 point, final ILine line); static double distancePointHalfLine(final IVector2 point, final ILine halfLine); static double distancePointLineSegment(final IVector2 point, final ILine lineSegment); static IVector2 stepAlongLine(final IVector2 start, final IVector2 end, final double stepSize);  }