pub fn push_arc(
center: Point<f32>,
start: Point<f32>,
end: Point<f32>,
nsubdivs: u32,
out: &mut Vec<Point<f32>>,
)Expand description
Pushes points forming an arc between two points around a center.
This function generates intermediate points along a circular arc from start to end,
rotating around center. The arc is approximated by nsubdivs points. The start and
end points themselves are NOT added to the output buffer - only intermediate points.
The function interpolates both the angle and the radius, so it can handle arcs where the start and end points are at different distances from the center (spiral-like paths).
§Arguments
center- The center point of rotationstart- Starting point of the arc (not included in output)end- Ending point of the arc (not included in output)nsubdivs- Number of intermediate points to generateout- Output buffer where arc points will be pushed
§Panics
Panics if nsubdivs is 0.
§Example
use parry2d::transformation::utils::push_arc;
use parry2d::math::Point;
let mut points = Vec::new();
let center = Point::new(0.0, 0.0);
let start = Point::new(5.0, 0.0); // 5 units to the right
let end = Point::new(0.0, 5.0); // 5 units up (90 degree arc)
// Generate 3 intermediate points
push_arc(center, start, end, 3, &mut points);
// Should have 2 intermediate points (nsubdivs - 1)
assert_eq!(points.len(), 2);