Function cavalier_contours::core::math::point_within_arc_sweep
source · pub fn point_within_arc_sweep<T>(
center: Vector2<T>,
arc_start: Vector2<T>,
arc_end: Vector2<T>,
is_clockwise: bool,
point: Vector2<T>,
epsilon: T
) -> boolwhere
T: Real,
Expand description
Test if a point
is within a arc sweep angle region.
Arc is defined by center
, arc_start
, arc_end
, and arc direction parameter is_clockwise
.
The angle region is defined as if the arc had infinite radius projected outward in a cone.
epsilon
is used for fuzzy comparing.
Examples
// defining an arc that projects an angle region covering all of
// quadrant I (x positive, y positive space)
let arc_center = Vector2::new(0.0, 0.0);
let arc_start = Vector2::new(1.0, 0.0);
let arc_end = Vector2::new(0.0, 1.0);
assert!(
point_within_arc_sweep(arc_center, arc_start, arc_end, false, Vector2::new(1.0, 1.0), 1e-5)
);
// check is fuzzy inclusive
assert!(
point_within_arc_sweep(arc_center, arc_start, arc_end, false, Vector2::new(1.0, 0.0), 1e-5)
);
assert!(
point_within_arc_sweep(arc_center, arc_start, arc_end, false, Vector2::new(0.0, 1.0), 1e-5)
);