Trait vector2math::circle::Circle
source · pub trait Circle: Copywhere
Scalar<Self>: FloatingScalar,{
type Vector: FloatingVector2;
Show 17 methods
// Required methods
fn new(center: Self::Vector, radius: Scalar<Self>) -> Self;
fn center(self) -> Self::Vector;
fn radius(self) -> Scalar<Self>;
// Provided methods
fn map_into<C>(self) -> C
where C: Circle,
Scalar<C>: FloatingScalar + From<Scalar<Self>> { ... }
fn map_with<C, F>(self, f: F) -> C
where C: Circle,
Scalar<C>: FloatingScalar,
F: FnMut(Scalar<Self>) -> <<C as Circle>::Vector as Vector2>::Scalar { ... }
fn with_center(self, center: Self::Vector) -> Self { ... }
fn with_radius(self, radius: Scalar<Self>) -> Self { ... }
fn diameter(self) -> Scalar<Self> { ... }
fn circumference(self) -> Scalar<Self> { ... }
fn area(self) -> Scalar<Self> { ... }
fn translated(self, offset: Self::Vector) -> Self { ... }
fn scaled(self, scale: Scalar<Self>) -> Self { ... }
fn to_square(self) -> [Scalar<Self>; 4] { ... }
fn contains(self, point: Self::Vector) -> bool { ... }
fn cntains(self, point: Self::Vector) -> bool { ... }
fn contains_all<I>(self, points: I) -> bool
where I: IntoIterator<Item = Self::Vector> { ... }
fn contains_any<I>(self, points: I) -> bool
where I: IntoIterator<Item = Self::Vector> { ... }
}
Expand description
Trait for manipulating circles
Required Associated Types§
sourcetype Vector: FloatingVector2
type Vector: FloatingVector2
The vector type
Required Methods§
Provided Methods§
sourcefn map_into<C>(self) -> Cwhere
C: Circle,
Scalar<C>: FloatingScalar + From<Scalar<Self>>,
fn map_into<C>(self) -> Cwhere C: Circle, Scalar<C>: FloatingScalar + From<Scalar<Self>>,
Map this circle to a circle of another type
sourcefn map_with<C, F>(self, f: F) -> Cwhere
C: Circle,
Scalar<C>: FloatingScalar,
F: FnMut(Scalar<Self>) -> <<C as Circle>::Vector as Vector2>::Scalar,
fn map_with<C, F>(self, f: F) -> Cwhere C: Circle, Scalar<C>: FloatingScalar, F: FnMut(Scalar<Self>) -> <<C as Circle>::Vector as Vector2>::Scalar,
Map this circle to a circle of another type using a function
sourcefn with_center(self, center: Self::Vector) -> Self
fn with_center(self, center: Self::Vector) -> Self
Transform the circle into one with a different top-left corner position
sourcefn with_radius(self, radius: Scalar<Self>) -> Self
fn with_radius(self, radius: Scalar<Self>) -> Self
Transform the circle into one with a different size
sourcefn circumference(self) -> Scalar<Self>
fn circumference(self) -> Scalar<Self>
Get the circle’s circumference
sourcefn translated(self, offset: Self::Vector) -> Self
fn translated(self, offset: Self::Vector) -> Self
Get the circle that is this one translated by some vector
sourcefn scaled(self, scale: Scalar<Self>) -> Self
fn scaled(self, scale: Scalar<Self>) -> Self
Get the circle that is this one with a scalar-scaled size
sourcefn cntains(self, point: Self::Vector) -> bool
fn cntains(self, point: Self::Vector) -> bool
Alias for Rectangle::contains
Useful when contains
is ambiguous
sourcefn contains_all<I>(self, points: I) -> boolwhere
I: IntoIterator<Item = Self::Vector>,
fn contains_all<I>(self, points: I) -> boolwhere I: IntoIterator<Item = Self::Vector>,
Check that the circle contains all points
sourcefn contains_any<I>(self, points: I) -> boolwhere
I: IntoIterator<Item = Self::Vector>,
fn contains_any<I>(self, points: I) -> boolwhere I: IntoIterator<Item = Self::Vector>,
Check that the circle contains any point