pub struct Circle {
pub center: Point,
pub radius: f32,
}
Expand description
Circle
Fields§
§center: Point
§radius: f32
Implementations§
Source§impl Circle
impl Circle
pub fn try_new(center: Point, radius: f32) -> Result<Self>
Sourcepub fn bounding_circle<'a>(
circles: impl IntoIterator<Item = &'a Circle>,
) -> Circle
pub fn bounding_circle<'a>( circles: impl IntoIterator<Item = &'a Circle>, ) -> Circle
Returns the smallest possible circle that fully contains all circles
pub fn area(&self) -> f32
pub fn bbox(&self) -> Rect
pub fn diameter(&self) -> f32
Trait Implementations§
Source§impl CollidesWith<Circle> for Circle
impl CollidesWith<Circle> for Circle
fn collides_with(&self, other: &Circle) -> bool
Source§impl CollidesWith<Edge> for Circle
impl CollidesWith<Edge> for Circle
fn collides_with(&self, edge: &Edge) -> bool
Source§impl CollidesWith<Point> for Circle
impl CollidesWith<Point> for Circle
fn collides_with(&self, point: &Point) -> bool
Source§impl CollidesWith<Rect> for Circle
impl CollidesWith<Rect> for Circle
fn collides_with(&self, rect: &Rect) -> bool
Source§impl DistanceTo<Circle> for Circle
impl DistanceTo<Circle> for Circle
Source§fn distance_to(&self, other: &Circle) -> f32
fn distance_to(&self, other: &Circle) -> f32
Minimum distance between two primitives. Will be 0 in case of a collision.
Source§fn sq_distance_to(&self, other: &Circle) -> f32
fn sq_distance_to(&self, other: &Circle) -> f32
Squared version of DistanceTo::distance_to
Source§impl DistanceTo<Edge> for Circle
impl DistanceTo<Edge> for Circle
Source§fn distance_to(&self, e: &Edge) -> f32
fn distance_to(&self, e: &Edge) -> f32
Minimum distance between two primitives. Will be 0 in case of a collision.
Source§fn sq_distance_to(&self, e: &Edge) -> f32
fn sq_distance_to(&self, e: &Edge) -> f32
Squared version of DistanceTo::distance_to
Source§impl DistanceTo<Point> for Circle
impl DistanceTo<Point> for Circle
Source§fn distance_to(&self, point: &Point) -> f32
fn distance_to(&self, point: &Point) -> f32
Minimum distance between two primitives. Will be 0 in case of a collision.
Source§fn sq_distance_to(&self, other: &Point) -> f32
fn sq_distance_to(&self, other: &Point) -> f32
Squared version of DistanceTo::distance_to
Source§impl SeparationDistance<Circle> for Circle
impl SeparationDistance<Circle> for Circle
Source§fn separation_distance(&self, other: &Circle) -> (GeoPosition, f32)
fn separation_distance(&self, other: &Circle) -> (GeoPosition, f32)
In case of a collision between
self
and other
, returns GeoPosition::Interior and the minimum distance to separate the two primitives.
Otherwise, returns GeoPosition::Exterior and the minimum distance between the two primitives. (similar to DistanceTo::distance_to)Source§fn sq_separation_distance(&self, other: &Circle) -> (GeoPosition, f32)
fn sq_separation_distance(&self, other: &Circle) -> (GeoPosition, f32)
Squared version of SeparationDistance::separation_distance
Source§impl SeparationDistance<Edge> for Circle
impl SeparationDistance<Edge> for Circle
Source§fn separation_distance(&self, e: &Edge) -> (GeoPosition, f32)
fn separation_distance(&self, e: &Edge) -> (GeoPosition, f32)
In case of a collision between
self
and other
, returns GeoPosition::Interior and the minimum distance to separate the two primitives.
Otherwise, returns GeoPosition::Exterior and the minimum distance between the two primitives. (similar to DistanceTo::distance_to)Source§fn sq_separation_distance(&self, e: &Edge) -> (GeoPosition, f32)
fn sq_separation_distance(&self, e: &Edge) -> (GeoPosition, f32)
Squared version of SeparationDistance::separation_distance
Source§impl SeparationDistance<Point> for Circle
impl SeparationDistance<Point> for Circle
Source§fn separation_distance(&self, point: &Point) -> (GeoPosition, f32)
fn separation_distance(&self, point: &Point) -> (GeoPosition, f32)
In case of a collision between
self
and other
, returns GeoPosition::Interior and the minimum distance to separate the two primitives.
Otherwise, returns GeoPosition::Exterior and the minimum distance between the two primitives. (similar to DistanceTo::distance_to)Source§fn sq_separation_distance(&self, point: &Point) -> (GeoPosition, f32)
fn sq_separation_distance(&self, point: &Point) -> (GeoPosition, f32)
Squared version of SeparationDistance::separation_distance
Source§impl Transformable for Circle
impl Transformable for Circle
Source§fn transform(&mut self, t: &Transformation) -> &mut Self
fn transform(&mut self, t: &Transformation) -> &mut Self
Applies a transformation to
self
.Source§fn transform_clone(&self, t: &Transformation) -> Self
fn transform_clone(&self, t: &Transformation) -> Self
Applies a transformation to a clone.
Source§impl TransformableFrom for Circle
impl TransformableFrom for Circle
Source§fn transform_from(&mut self, reference: &Self, t: &Transformation) -> &mut Self
fn transform_from(&mut self, reference: &Self, t: &Transformation) -> &mut Self
Applies a transformation on the reference object and stores the result in
self
.impl Copy for Circle
impl StructuralPartialEq for Circle
Auto Trait Implementations§
impl Freeze for Circle
impl RefUnwindSafe for Circle
impl Send for Circle
impl Sync for Circle
impl Unpin for Circle
impl UnwindSafe for Circle
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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