pub fn seg_midpoint<T>(v1: PlineVertex<T>, v2: PlineVertex<T>) -> Vector2<T>
where T: Real,
Expand description

Find the midpoint for the polyline segment defined by v1 to v2.

§Examples

// counter clockwise half circle arc going from (2, 2) to (2, 4)
let v1 = PlineVertex::new(2.0, 2.0, 1.0);
let v2 = PlineVertex::new(4.0, 2.0, 0.0);
assert!(seg_midpoint(v1, v2).fuzzy_eq(Vector2::new(3.0, 1.0)));

Also works with line segments.

// line segment going from (2, 2) to (4, 4)
let v1 = PlineVertex::new(2.0, 2.0, 0.0);
let v2 = PlineVertex::new(4.0, 4.0, 0.0);
assert!(seg_midpoint(v1, v2).fuzzy_eq(Vector2::new(3.0, 3.0)));