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§

source

type Vector: FloatingVector2

The vector type

Required Methods§

source

fn new(center: Self::Vector, radius: Scalar<Self>) -> Self

Create a new circle from a center coordinate and a radius

source

fn center(self) -> Self::Vector

Get the circle’s center

source

fn radius(self) -> Scalar<Self>

Get the circle’s radius

Provided Methods§

source

fn map_into<C>(self) -> Cwhere C: Circle, Scalar<C>: FloatingScalar + From<Scalar<Self>>,

Map this circle to a circle of another type

source

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

source

fn with_center(self, center: Self::Vector) -> Self

Transform the circle into one with a different top-left corner position

source

fn with_radius(self, radius: Scalar<Self>) -> Self

Transform the circle into one with a different size

source

fn diameter(self) -> Scalar<Self>

Get the circle’s diameter

source

fn circumference(self) -> Scalar<Self>

Get the circle’s circumference

source

fn area(self) -> Scalar<Self>

Get the circle’s area

source

fn translated(self, offset: Self::Vector) -> Self

Get the circle that is this one translated by some vector

source

fn scaled(self, scale: Scalar<Self>) -> Self

Get the circle that is this one with a scalar-scaled size

source

fn to_square(self) -> [Scalar<Self>; 4]

Get the smallest square that this circle fits inside

source

fn contains(self, point: Self::Vector) -> bool

Check that the circle contains the given point

source

fn cntains(self, point: Self::Vector) -> bool

Alias for Rectangle::contains

Useful when contains is ambiguous

source

fn contains_all<I>(self, points: I) -> boolwhere I: IntoIterator<Item = Self::Vector>,

Check that the circle contains all points

source

fn contains_any<I>(self, points: I) -> boolwhere I: IntoIterator<Item = Self::Vector>,

Check that the circle contains any point

Implementations on Foreign Types§

source§

impl<S, V> Circle for (V, S)where S: FloatingScalar, V: FloatingVector2<Scalar = S>,

§

type Vector = V

source§

fn new(center: Self::Vector, radius: Scalar<Self>) -> Self

source§

fn center(self) -> Self::Vector

source§

fn radius(self) -> Scalar<Self>

Implementors§