@Test public void testLeadPointOnLine() { ILine line = Line.fromPoints(Vector2f.ZERO_VECTOR, Vector2f.X_AXIS); for (double i = 0.0; i < 10; i += 0.1) { IVector2 point = Vector2.fromXY(i * i, Math.pow(10, i - 5)); IVector2 expected = Vector2.fromXY(i * i, 0); Assert.assertTrue(expected.isCloseTo(LineMath.leadPointOnLine(line, point), TEST_ACCURACY_SQR)); } line = Line.fromPoints(Vector2f.ZERO_VECTOR, Vector2f.Y_AXIS); for (double i = 0.0; i < 10; i += 0.1) { IVector2 point = Vector2.fromXY(Math.pow(10, i - 5), i * i); IVector2 expected = Vector2.fromXY(0, i * i); Assert.assertTrue(expected.isCloseTo(LineMath.leadPointOnLine(line, point), TEST_ACCURACY_SQR)); } for (double i = 0; i < (3 * (2 * Math.PI)); i += 0.1) { final double spiralCoeff = i + 1e-3; IVector2 linepoint = Vector2.fromXY(spiralCoeff * SumatraMath.cos(i), spiralCoeff * SumatraMath.sin(i)); IVector2 point = Vector2.fromXY(spiralCoeff * SumatraMath.cos(i + (Math.PI / 2)), spiralCoeff * SumatraMath.sin(i + (Math.PI / 2))); line = Line.fromPoints(Vector2f.ZERO_VECTOR, linepoint); Assert.assertTrue(Vector2f.ZERO_VECTOR.isCloseTo(LineMath.leadPointOnLine(line, point), TEST_ACCURACY_SQR)); } }
public static Vector2 leadPointOnLine(final ILine line, final IVector2 point) { return getPointOnLineForLambda( line, getLeadPointLambda(point, line)); }
LineMath { public static Vector2 leadPointOnLine(final ILine line, final IVector2 point) { return getPointOnLineForLambda( line, getLeadPointLambda(point, line)); } }
LineMath { public static Vector2 leadPointOnLine(final ILine line, final IVector2 point) { return getPointOnLineForLambda( line, getLeadPointLambda(point, line)); } @SuppressWarnings("unused") private  LineMath(); }
LineMath { public static Vector2 leadPointOnLine(final ILine line, final IVector2 point) { return getPointOnLineForLambda( line, getLeadPointLambda(point, line)); } @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 Vector2 leadPointOnLine(final ILine line, final IVector2 point) { return getPointOnLineForLambda( line, getLeadPointLambda(point, line)); } @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);  }