pub enum DynShape<T> {
Circle(Circle<T>),
Triangle(Triangle<T>),
Rect(Rect<T>),
Quad(Quad<T>),
Polygon(Polygon<T>),
}Expand description
A circle, triangle, rect, quad, or polygon.
This itself implements Shape<T> and defers to each variant’s
implementation of the trait’s methods.
This is convenient when you want lists of shapes that can be one of any of the variants, rather than all being the same. For example, colliders for entities in a core engine.
Variants§
Implementations§
Source§impl<T: Float> DynShape<T>
impl<T: Float> DynShape<T>
Sourcepub fn extract_from(&self, other: &Self) -> Option<Vec2<T>>
pub fn extract_from(&self, other: &Self) -> Option<Vec2<T>>
If this shape overlaps the other, returns a push-out vector that can be used to translate it so they no longer overlap.
Sourcepub fn hull_points(&self, circle_seg_len: T, plot: impl FnMut(Vec2<T>))
pub fn hull_points(&self, circle_seg_len: T, plot: impl FnMut(Vec2<T>))
Plot the vertices of the shape. For polygons, it will be the vertices
of the polygon, and for circles it will be CAP points distributed
evenly along the circle’s radius.
Sourcepub fn hull_points_n(&self, circle_count: T, plot: impl FnMut(Vec2<T>))
pub fn hull_points_n(&self, circle_count: T, plot: impl FnMut(Vec2<T>))
Plot the vertices of the shape.
Sourcepub fn hull_edges(&self, circle_seg_len: T, plot: impl FnMut(Line<T>))
pub fn hull_edges(&self, circle_seg_len: T, plot: impl FnMut(Line<T>))
Plot the edges of the shape. For polygons, it will be the edges of
the polygon, and for circles it will be CAP edgds distributed
evenly along the circle’s radius.
Sourcepub fn hull_edges_n(&self, circle_count: T, plot: impl FnMut(Line<T>))
pub fn hull_edges_n(&self, circle_count: T, plot: impl FnMut(Line<T>))
Plot the edges of the shape. For polygons, it will be the edges of
the polygon, and for circles it will be CAP edgds distributed
evenly along the circle’s radius.