implement Bounded2d
for ConvexPolygon
(#18286)
# Objective - Implement `Bounded2d` for `ConvexPolygon`
This commit is contained in:
parent
2c22bc12a0
commit
f245490e4a
@ -4,8 +4,9 @@ use crate::{
|
||||
bounding::BoundingVolume,
|
||||
ops,
|
||||
primitives::{
|
||||
Annulus, Arc2d, Capsule2d, Circle, CircularSector, CircularSegment, Ellipse, Line2d,
|
||||
Plane2d, Polygon, Polyline2d, Rectangle, RegularPolygon, Rhombus, Segment2d, Triangle2d,
|
||||
Annulus, Arc2d, Capsule2d, Circle, CircularSector, CircularSegment, ConvexPolygon, Ellipse,
|
||||
Line2d, Plane2d, Polygon, Polyline2d, Rectangle, RegularPolygon, Rhombus, Segment2d,
|
||||
Triangle2d,
|
||||
},
|
||||
Dir2, Isometry2d, Mat2, Rot2, Vec2,
|
||||
};
|
||||
@ -375,6 +376,16 @@ impl<const N: usize> Bounded2d for Polygon<N> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<const N: usize> Bounded2d for ConvexPolygon<N> {
|
||||
fn aabb_2d(&self, isometry: impl Into<Isometry2d>) -> Aabb2d {
|
||||
Aabb2d::from_point_cloud(isometry, self.vertices().as_slice())
|
||||
}
|
||||
|
||||
fn bounding_circle(&self, isometry: impl Into<Isometry2d>) -> BoundingCircle {
|
||||
BoundingCircle::from_point_cloud(isometry, self.vertices().as_slice())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "alloc")]
|
||||
impl Bounded2d for BoxedPolygon {
|
||||
fn aabb_2d(&self, isometry: impl Into<Isometry2d>) -> Aabb2d {
|
||||
|
Loading…
Reference in New Issue
Block a user