parry2d/transformation/to_polyline/
cuboid_to_polyline.rs1use crate::math::Real;
2use crate::shape::Cuboid;
3use crate::transformation::utils;
4use alloc::{vec, vec::Vec};
5use na::{self, Point2};
6
7impl Cuboid {
8 pub fn to_polyline(&self) -> Vec<Point2<Real>> {
10 utils::scaled(unit_rectangle(), self.half_extents * 2.0)
11 }
12}
13
14fn unit_rectangle() -> Vec<Point2<Real>> {
16 vec![
17 Point2::new(-0.5, -0.5),
18 Point2::new(0.5, -0.5),
19 Point2::new(0.5, 0.5),
20 Point2::new(-0.5, 0.5),
21 ]
22}