pub fn push_xy_arc(
radius: f32,
nsubdiv: u32,
dtheta: f32,
out: &mut Vec<Point<f32>>,
)Expand description
Pushes a discretized counterclockwise arc to a buffer.
This function generates points along an arc in the XY plane (2D). The arc is contained on the plane spanned by the X and Y axes. Points are generated counter-clockwise starting from angle 0 (positive X axis).
§Arguments
radius- The radius of the arcnsubdiv- Number of subdivisions (points to generate)dtheta- Angle increment between consecutive points (in radians)out- Output buffer where arc points will be pushed
§Example
use parry2d::transformation::utils::push_xy_arc;
use parry2d::math::Point;
use std::f32::consts::PI;
let mut points = Vec::new();
let radius = 3.0;
let nsubdiv = 4; // Quarter circle
let dtheta = PI / 2.0 / (nsubdiv - 1) as f32;
push_xy_arc(radius, nsubdiv, dtheta, &mut points);
assert_eq!(points.len(), 4);
// First point is approximately at (radius, 0)
assert!((points[0].x - radius).abs() < 1e-6);
assert!((points[0].y).abs() < 1e-6);