#[repr(C)]pub struct Circle<T> {
pub center: Vec2<T>,
pub radius: T,
}Expand description
A circle, represented by a center point and radius.
Fields§
§center: Vec2<T>§radius: TImplementations§
Source§impl<T: Copy + AbsDiffEq<Epsilon = T>> Circle<T>
impl<T: Copy + AbsDiffEq<Epsilon = T>> Circle<T>
Sourcepub fn abs_diff_eq(&self, other: &Self) -> bool
pub fn abs_diff_eq(&self, other: &Self) -> bool
Returns true if the two values are approximately equal according to the absolute difference between their components.
Source§impl<T: Copy + RelativeEq<Epsilon = T>> Circle<T>
impl<T: Copy + RelativeEq<Epsilon = T>> Circle<T>
Sourcepub fn relative_eq(&self, other: &Self) -> bool
pub fn relative_eq(&self, other: &Self) -> bool
Returns true if the two values are approximately equal according to the absolute difference between their components, as well as relative-based comparisons.
Source§impl<T: Num> Circle<T>
impl<T: Num> Circle<T>
Sourcepub fn with_radius(radius: T) -> Self
pub fn with_radius(radius: T) -> Self
Create a circle at (0, 0) with the provided radius.
Source§impl<T: Float> Circle<T>
impl<T: Float> Circle<T>
Sourcepub fn circumference(&self) -> T
pub fn circumference(&self) -> T
Circumference of the circle.
Sourcepub fn contains_circ(&self, other: &Circle<T>) -> bool
pub fn contains_circ(&self, other: &Circle<T>) -> bool
Check if a circle is fully contained within this one.
Sourcepub fn hull_points_n(
&self,
count: T,
angle: impl Angle<T>,
plot: impl FnMut(Vec2<T>),
)
pub fn hull_points_n( &self, count: T, angle: impl Angle<T>, plot: impl FnMut(Vec2<T>), )
Plot count points evenly distributed along the perimeter of the circle.
Sourcepub fn hull_points(
&self,
seg_len: T,
angle: impl Angle<T>,
plot: impl FnMut(Vec2<T>),
)
pub fn hull_points( &self, seg_len: T, angle: impl Angle<T>, plot: impl FnMut(Vec2<T>), )
Plot points along the perimeter of the circle, each seg_len apart.
Sourcepub fn iter_hull_points_n(
&self,
count: T,
angle: impl Angle<T>,
) -> impl Iterator<Item = Vec2<T>> + '_
pub fn iter_hull_points_n( &self, count: T, angle: impl Angle<T>, ) -> impl Iterator<Item = Vec2<T>> + '_
Iterate over count points evenly distributed along the perimeter of the circle.
Sourcepub fn iter_hull_points(
&self,
seg_len: T,
angle: impl Angle<T>,
) -> impl Iterator<Item = Vec2<T>> + '_
pub fn iter_hull_points( &self, seg_len: T, angle: impl Angle<T>, ) -> impl Iterator<Item = Vec2<T>> + '_
Iterate over points along the perimeter of the circle, each seg_len apart.
Sourcepub fn hull_edges_n(
&self,
count: T,
angle: impl Angle<T>,
plot: impl FnMut(Line<T>),
)
pub fn hull_edges_n( &self, count: T, angle: impl Angle<T>, plot: impl FnMut(Line<T>), )
Plot count edges evenly distributed along the circle’s perimeter.
Sourcepub fn hull_edges(
&self,
seg_len: T,
angle: impl Angle<T>,
plot: impl FnMut(Line<T>),
)
pub fn hull_edges( &self, seg_len: T, angle: impl Angle<T>, plot: impl FnMut(Line<T>), )
Get count edges evenly distributed along the circle’s perimeter.
Sourcepub fn iter_hull_edges_n(
&self,
count: T,
angle: impl Angle<T>,
) -> impl Iterator<Item = Line<T>> + '_
pub fn iter_hull_edges_n( &self, count: T, angle: impl Angle<T>, ) -> impl Iterator<Item = Line<T>> + '_
Iterate over count edges evenly distributed along the circle’s perimeter.
pub fn iter_hull_edges( &self, seg_len: T, angle: impl Angle<T>, ) -> impl Iterator<Item = Line<T>> + '_
pub fn transform_by_into( &self, seg_len: T, angle: impl Angle<T>, into: &mut Polygon<T>, f: impl FnMut(Vec2<T>) -> Vec2<T>, )
pub fn transform_by_into_n( &self, seg_count: T, angle: impl Angle<T>, into: &mut Polygon<T>, f: impl FnMut(Vec2<T>) -> Vec2<T>, )
pub fn transform_by( &self, seg_len: T, angle: impl Angle<T>, f: impl FnMut(Vec2<T>) -> Vec2<T>, ) -> Polygon<T>
pub fn transform_by_n( &self, count: T, angle: impl Angle<T>, f: impl FnMut(Vec2<T>) -> Vec2<T>, ) -> Polygon<T>
pub fn transform_by_retain(&self, f: impl FnMut(Vec2<T>) -> Vec2<T>) -> Self
pub fn suggest_seg_count(&self) -> T
pub fn suggest_seg_count_f(&self, f: impl FnMut(Vec2<T>) -> Vec2<T>) -> T
Trait Implementations§
Source§impl<T> AbsDiffEq for Circle<T>
impl<T> AbsDiffEq for Circle<T>
Source§fn default_epsilon() -> Self::Epsilon
fn default_epsilon() -> Self::Epsilon
Source§fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
Source§fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
AbsDiffEq::abs_diff_eq.Source§impl<T: Copy + AddAssign<T>> AddAssign<&Vec2<T>> for Circle<T>
impl<T: Copy + AddAssign<T>> AddAssign<&Vec2<T>> for Circle<T>
Source§fn add_assign(&mut self, rhs: &Vec2<T>)
fn add_assign(&mut self, rhs: &Vec2<T>)
+= operation. Read moreSource§impl<T: AddAssign<T>> AddAssign<Vec2<T>> for Circle<T>
impl<T: AddAssign<T>> AddAssign<Vec2<T>> for Circle<T>
Source§fn add_assign(&mut self, rhs: Vec2<T>)
fn add_assign(&mut self, rhs: Vec2<T>)
+= operation. Read moreSource§impl<'de, T> Deserialize<'de> for Circle<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Circle<T>where
T: Deserialize<'de>,
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>,
Source§impl<T: Numeric<AsU8 = u8, AsU16 = u16, AsU32 = u32, AsU64 = u64, AsU128 = u128, AsUSize = usize, AsI8 = i8, AsI16 = i16, AsI32 = i32, AsI64 = i64, AsI128 = i128, AsISize = isize, AsF32 = f32, AsF64 = f64>> Numeric for Circle<T>
impl<T: Numeric<AsU8 = u8, AsU16 = u16, AsU32 = u32, AsU64 = u64, AsU128 = u128, AsUSize = usize, AsI8 = i8, AsI16 = i16, AsI32 = i32, AsI64 = i64, AsI128 = i128, AsISize = isize, AsF32 = f32, AsF64 = f64>> Numeric for Circle<T>
type AsU8 = Circle<u8>
type AsU16 = Circle<u16>
type AsU32 = Circle<u32>
type AsU64 = Circle<u64>
type AsU128 = Circle<u128>
type AsUSize = Circle<usize>
type AsI8 = Circle<i8>
type AsI16 = Circle<i16>
type AsI32 = Circle<i32>
type AsI64 = Circle<i64>
type AsI128 = Circle<i128>
type AsISize = Circle<isize>
type AsF32 = Circle<f32>
type AsF64 = Circle<f64>
fn to_u8(self) -> Circle<u8>
fn to_u16(self) -> Circle<u16>
fn to_u32(self) -> Circle<u32>
fn to_u64(self) -> Circle<u64>
fn to_u128(self) -> Circle<u128>
fn to_usize(self) -> Circle<usize>
fn to_i8(self) -> Circle<i8>
fn to_i16(self) -> Circle<i16>
fn to_i32(self) -> Circle<i32>
fn to_i64(self) -> Circle<i64>
fn to_i128(self) -> Circle<i128>
fn to_isize(self) -> Circle<isize>
fn to_f32(self) -> Circle<f32>
fn to_f64(self) -> Circle<f64>
Source§impl<T: Ord> Ord for Circle<T>
impl<T: Ord> Ord for Circle<T>
Source§impl<T: PartialOrd> PartialOrd for Circle<T>
impl<T: PartialOrd> PartialOrd for Circle<T>
Source§impl<T> RelativeEq for Circle<T>
impl<T> RelativeEq for Circle<T>
Source§fn default_max_relative() -> Self::Epsilon
fn default_max_relative() -> Self::Epsilon
Source§fn relative_eq(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon,
) -> bool
fn relative_eq( &self, other: &Self, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool
Source§fn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon,
) -> bool
fn relative_ne( &self, other: &Rhs, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool
RelativeEq::relative_eq.Source§impl<T: Float> Shape<T> for Circle<T>
impl<T: Float> Shape<T> for Circle<T>
Source§fn project_onto_axis(&self, axis: Vec2<T>) -> Projection<T>
fn project_onto_axis(&self, axis: Vec2<T>) -> Projection<T>
Source§fn project_point(&self, p: Vec2<T>) -> Vec2<T>
fn project_point(&self, p: Vec2<T>) -> Vec2<T>
Source§fn overlaps_rect(&self, rect: &Rect<T>) -> bool
fn overlaps_rect(&self, rect: &Rect<T>) -> bool
Source§fn overlaps_circ(&self, circ: &Circle<T>) -> bool
fn overlaps_circ(&self, circ: &Circle<T>) -> bool
Source§fn overlaps_poly<P: Polygonal<T>>(&self, poly: &P) -> bool
fn overlaps_poly<P: Polygonal<T>>(&self, poly: &P) -> bool
Source§fn extract_from_circ(&self, circ: &Circle<T>) -> Option<Vec2<T>>
fn extract_from_circ(&self, circ: &Circle<T>) -> Option<Vec2<T>>
Source§impl<T: Copy + SubAssign<T>> SubAssign<&Vec2<T>> for Circle<T>
impl<T: Copy + SubAssign<T>> SubAssign<&Vec2<T>> for Circle<T>
Source§fn sub_assign(&mut self, rhs: &Vec2<T>)
fn sub_assign(&mut self, rhs: &Vec2<T>)
-= operation. Read moreSource§impl<T: Copy + SubAssign<T>> SubAssign<Vec2<T>> for Circle<T>
impl<T: Copy + SubAssign<T>> SubAssign<Vec2<T>> for Circle<T>
Source§fn sub_assign(&mut self, rhs: Vec2<T>)
fn sub_assign(&mut self, rhs: Vec2<T>)
-= operation. Read more