@Test public void isPointInCircle() { double radius = 300; double margin = 0.0; ICircle circle = Circle.createCircle(Vector2.fromXY(1000, 500), radius); assertThat(CircleMath.isPointInCircle(circle, Vector2.fromXY(1000, 500), margin)).isTrue(); assertThat(CircleMath.isPointInCircle(circle, Vector2.fromXY(1299, 500), margin)).isTrue(); assertThat(CircleMath.isPointInCircle(circle, Vector2.fromXY(1000, 799), margin)).isTrue(); assertThat(CircleMath.isPointInCircle(circle, Vector2.fromXY(1000, 201), margin)).isTrue(); assertThat(CircleMath.isPointInCircle(circle, Vector2.fromXY(701, 500), margin)).isTrue(); assertThat(CircleMath.isPointInCircle(circle, Vector2.fromXY(1301, 500), margin)).isFalse(); assertThat(CircleMath.isPointInCircle(circle, Vector2.fromXY(1000, 801), margin)).isFalse(); assertThat(CircleMath.isPointInCircle(circle, Vector2.fromXY(1000, 199), margin)).isFalse(); assertThat(CircleMath.isPointInCircle(circle, Vector2.fromXY(699, 500), margin)).isFalse(); assertThat(CircleMath.isPointInCircle(circle, Vector2.fromXY(1250, 750), margin)).isFalse(); assertOutsideCircle(circle); }
public static boolean isPointInCircle(ICircular circle, IVector2 point, double margin) { return point.distanceToSqr(circle.center()) <= Math.pow(circle.radius() + margin, 2); }
CircleMath { public static boolean isPointInCircle(ICircular circle, IVector2 point, double margin) { return point.distanceToSqr(circle.center()) <= Math.pow(circle.radius() + margin, 2); } }
CircleMath { public static boolean isPointInCircle(ICircular circle, IVector2 point, double margin) { return point.distanceToSqr(circle.center()) <= Math.pow(circle.radius() + margin, 2); } @SuppressWarnings("unused") private  CircleMath(); }
CircleMath { public static boolean isPointInCircle(ICircular circle, IVector2 point, double margin) { return point.distanceToSqr(circle.center()) <= Math.pow(circle.radius() + margin, 2); } @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 boolean isPointInCircle(ICircular circle, IVector2 point, double margin) { return point.distanceToSqr(circle.center()) <= Math.pow(circle.radius() + margin, 2); } @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);  }