@Test public void nearestPointOutsideArc() { IArc arc = Arc.createArc(Vector2f.ZERO_VECTOR, 100, 0, Math.PI / 2); assertThat( CircleMath.nearestPointOutsideArc(arc, Vector2.fromXY(20, 20)).distanceTo(Vector2.fromXY(70.711, 70.711))) .isLessThan(1e-3); assertThat(CircleMath.nearestPointOutsideArc(arc, Vector2.fromXY(20, -1)).distanceTo(Vector2.fromXY(20, -1))) .isLessThan(1e-3); }
public static IVector2 nearestPointOutsideArc(final IArc arc, final IVector2 point) { IVector2 npo = nearestPointOutsideCircle(arc, point); if (isPointInArc(arc, npo, 1e-6)) { return npo; } return point; }
CircleMath { public static IVector2 nearestPointOutsideArc(final IArc arc, final IVector2 point) { IVector2 npo = nearestPointOutsideCircle(arc, point); if (isPointInArc(arc, npo, 1e-6)) { return npo; } return point; } }
CircleMath { public static IVector2 nearestPointOutsideArc(final IArc arc, final IVector2 point) { IVector2 npo = nearestPointOutsideCircle(arc, point); if (isPointInArc(arc, npo, 1e-6)) { return npo; } return point; } @SuppressWarnings("unused") private  CircleMath(); }
CircleMath { public static IVector2 nearestPointOutsideArc(final IArc arc, final IVector2 point) { IVector2 npo = nearestPointOutsideCircle(arc, point); if (isPointInArc(arc, npo, 1e-6)) { return npo; } return point; } @SuppressWarnings("unused") private  CircleMath(); static List<IVector2> tangentialIntersections(final ICircle circle, final IVector2 externalPoint); static List<IVector2> lineIntersections(final ICircular circle, final ILineBase line); static List<IVector2> circleIntersections(final ICircle firstCircle, final ICircle secondCircle); static IVector2 nearestPointOutsideCircle(final ICircular circle, final IVector2 point); static boolean isPointInCircle(ICircular circle, IVector2 point, double margin); static boolean isPointInArc(final IArc arc, final IVector2 point, double margin); static IVector2 nearestPointOutsideArc(final IArc arc, final IVector2 point); static Vector2 stepAlongCircle(final IVector2 current, final IVector2 center, final double angle); }
CircleMath { public static IVector2 nearestPointOutsideArc(final IArc arc, final IVector2 point) { IVector2 npo = nearestPointOutsideCircle(arc, point); if (isPointInArc(arc, npo, 1e-6)) { return npo; } return point; } @SuppressWarnings("unused") private  CircleMath(); static List<IVector2> tangentialIntersections(final ICircle circle, final IVector2 externalPoint); static List<IVector2> lineIntersections(final ICircular circle, final ILineBase line); static List<IVector2> circleIntersections(final ICircle firstCircle, final ICircle secondCircle); static IVector2 nearestPointOutsideCircle(final ICircular circle, final IVector2 point); static boolean isPointInCircle(ICircular circle, IVector2 point, double margin); static boolean isPointInArc(final IArc arc, final IVector2 point, double margin); static IVector2 nearestPointOutsideArc(final IArc arc, final IVector2 point); static Vector2 stepAlongCircle(final IVector2 current, final IVector2 center, final double angle);  }