pub fn push_circle(
radius: f32,
nsubdiv: u32,
dtheta: f32,
y: f32,
out: &mut Vec<Point<f32>>,
)Expand description
Pushes a discretized counterclockwise circle to a buffer.
This function generates points along a circle in the XZ plane at a given Y coordinate. Points are generated counter-clockwise when viewed from above (positive Y direction).
§Arguments
radius- The radius of the circlensubdiv- Number of subdivisions (points to generate)dtheta- Angle increment between consecutive points (in radians)y- The Y coordinate of the circle planeout- Output buffer where circle points will be pushed
§Example
use parry3d::transformation::utils::push_circle;
use parry3d::math::Point;
use std::f32::consts::PI;
let mut points = Vec::new();
let radius = 5.0;
let nsubdiv = 8; // Octagon
let dtheta = 2.0 * PI / nsubdiv as f32;
let y_level = 10.0;
push_circle(radius, nsubdiv, dtheta, y_level, &mut points);
assert_eq!(points.len(), 8);
// All points are at Y = 10.0
assert!(points.iter().all(|p| (p.y - 10.0).abs() < 1e-6));
// First point is at (radius, y, 0)
assert!((points[0].x - radius).abs() < 1e-6);
assert!((points[0].z).abs() < 1e-6);