pub struct Convex {
pub sides: Vec<(Vector2, Scalar)>,
}Expand description
A convex polygon, as the half-planes it is the intersection of: each an
outward normal n and an offset c, the polygon lying where
n · p ≤ c. What a box drawn on screen covers of a plane it looks at.
Fields§
§sides: Vec<(Vector2, Scalar)>Implementations§
Source§impl Convex
impl Convex
Sourcepub fn new(corners: &[Vector2]) -> Option<Self>
pub fn new(corners: &[Vector2]) -> Option<Self>
The convex polygon of corners, in order either way round. None
where they could enclose no area: fewer than three, or all on a
line. Corners that do not go round convexly are no convex polygon,
and give one that contains less than they do.
Sourcepub fn past<'a>(&'a self, p: &'a Vector2) -> impl Iterator<Item = Scalar> + 'a
pub fn past<'a>(&'a self, p: &'a Vector2) -> impl Iterator<Item = Scalar> + 'a
How far p lies past each side, along its normal (not normalized):
positive outside it.
Sourcepub fn could_contain(&self, p: &Vector2) -> bool
pub fn could_contain(&self, p: &Vector2) -> bool
Whether p could lie in the polygon, its boundary included: past no
side definitely.
Trait Implementations§
impl StructuralPartialEq for Convex
Auto Trait Implementations§
impl Freeze for Convex
impl RefUnwindSafe for Convex
impl Send for Convex
impl Sync for Convex
impl Unpin for Convex
impl UnsafeUnpin for Convex
impl UnwindSafe for Convex
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more