Struct myelin_geometry::Polygon
source · pub struct Polygon { /* private fields */ }
Expand description
A convex polygon.
Can either be constructed using a PolygonBuilder
or with Polygon::try_new
.
Implementations§
source§impl Polygon
impl Polygon
sourcepub fn translate(&self, translation: Point) -> Self
pub fn translate(&self, translation: Point) -> Self
Apply translation specified by translation
, represented as
a relative point
sourcepub fn rotate_around_point(&self, rotation: Radians, point: Point) -> Self
pub fn rotate_around_point(&self, rotation: Radians, point: Point) -> Self
Rotate polygon by a rotation
around a point
sourcepub fn contains_point(&self, point: Point) -> bool
pub fn contains_point(&self, point: Point) -> bool
Checks if a given point rests inside the polygon
Trait Implementations§
source§impl<'de> Deserialize<'de> for Polygon
impl<'de> Deserialize<'de> for Polygon
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Intersects for Polygon
impl Intersects for Polygon
source§fn intersects(&self, other: &Polygon) -> bool
fn intersects(&self, other: &Polygon) -> bool
Returns wether this polygon touches, contains or is contained in another polygon
source§impl PartialEq for Polygon
impl PartialEq for Polygon
impl StructuralPartialEq for Polygon
Auto Trait Implementations§
impl Freeze for Polygon
impl RefUnwindSafe for Polygon
impl Send for Polygon
impl Sync for Polygon
impl Unpin for Polygon
impl UnwindSafe for Polygon
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
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more