Function cavalier_contours::polyline::seg_arc_radius_and_center
source · pub fn seg_arc_radius_and_center<T>(
v1: PlineVertex<T>,
v2: PlineVertex<T>
) -> (T, Vector2<T>)where
T: Real,
Expand description
Get the arc radius and center of an arc polyline segment defined by v1
to v2
.
Behavior undefined (may panic or return without error) if v1.bulge is zero.
Examples
// arc half circle arc segment going from (0, 0) to (1, 0) counter clockwise
let v1 = PlineVertex::new(0.0, 0.0, 1.0);
let v2 = PlineVertex::new(1.0, 0.0, 0.0);
let (arc_radius, arc_center) = seg_arc_radius_and_center(v1, v2);
assert!(arc_radius.fuzzy_eq(0.5));
assert!(arc_center.fuzzy_eq(Vector2::new(0.5, 0.0)));