# [−][src]Trait vector2math::Circle

```pub trait Circle: Copy {
type Scalar: FloatingScalar;
type Vector: FloatingVector2<Scalar = Self::Scalar>;
fn new(center: Self::Vector, radius: Self::Scalar) -> Self;
fn center(self) -> Self::Vector;

fn map<C>(self) -> C    where        C: Circle,        C::Scalar: From<Self::Scalar>,
{ ... }
fn map_with<C, F>(self, f: F) -> C    where        C: Circle,        F: FnMut(Self::Scalar) -> <<C as Circle>::Vector as Vector2>::Scalar,
{ ... }
fn with_center(self, center: Self::Vector) -> Self { ... }
fn diameter(self) -> Self::Scalar { ... }
fn circumference(self) -> Self::Scalar { ... }
fn area(self) -> Self::Scalar { ... }
fn translated(self, offset: Self::Vector) -> Self { ... }
fn scaled(self, scale: Self::Scalar) -> Self { ... }
fn to_square<R>(self) -> R    where        R: Rectangle<Scalar = Self::Scalar, Vector = Self::Vector>,
{ ... }
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>,
{ ... }
}```

Trait for manipulating circles

The scalar type

The vector type

## Required methods

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

Create a new circle from a center coordinate and a radius

### `fn center(self) -> Self::Vector`

Get the circle's center

## Provided methods

### `fn map<C>(self) -> C where    C: Circle,    C::Scalar: From<Self::Scalar>, `

Map this circle to a circle of another type

### `fn map_with<C, F>(self, f: F) -> C where    C: Circle,    F: FnMut(Self::Scalar) -> <<C as Circle>::Vector as Vector2>::Scalar, `

Map this circle to a circle of another type using a function

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

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

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

Transform the circle into one with a different size

### `fn diameter(self) -> Self::Scalar`

Get the circle's diameter

### `fn circumference(self) -> Self::Scalar`

Get the circle's circumference

### `fn area(self) -> Self::Scalar`

Get the circle's area

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

Get the circle that is this one translated by some vector

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

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

### `fn to_square<R>(self) -> R where    R: Rectangle<Scalar = Self::Scalar, Vector = Self::Vector>, `

Get the smallest square that this circle fits inside

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

Check that the circle contains the given point

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

Alias for `Rectangle::contains`

Useful when `contains` is ambiguous

### `fn contains_all<I>(self, points: I) -> bool where    I: IntoIterator<Item = Self::Vector>, `

Check that the circle contains all points

### `fn contains_any<I>(self, points: I) -> bool where    I: IntoIterator<Item = Self::Vector>, `

Check that the circle contains any point