parry2d/transformation/to_polyline/
ball_to_polyline.rs1use crate::math::Real;
2use crate::shape::Ball;
3use crate::transformation::utils;
4use alloc::vec::Vec;
5use na::{self, Point2, RealField};
6
7impl Ball {
8 pub fn to_polyline(&self, nsubdivs: u32) -> Vec<Point2<Real>> {
10 let diameter = self.radius * 2.0;
11 let two_pi = Real::two_pi();
12 let dtheta = two_pi / (nsubdivs as Real);
13
14 let mut pts = Vec::with_capacity(nsubdivs as usize);
15 utils::push_xy_arc(diameter / 2.0, nsubdivs, dtheta, &mut pts);
16
17 pts
18 }
19}