pub struct Ring<P: Primitive2d> {
pub outer_shape: P,
pub inner_shape: P,
}Expand description
A 2D shape representing the ring version of a base shape.
The inner_shape forms the “hollow” of the outer_shape.
The resulting shapes are rings or hollow shapes. For example, a circle becomes an annulus.
§Warning
The outer_shape must contain the inner_shape for the generated meshes to be accurate.
If there are vertices in the inner_shape that escape the outer_shape
(for example, if the inner_shape is in fact larger),
it may result in incorrect geometries.
Fields§
§outer_shape: PThe outer shape
inner_shape: PThe inner shape (the same shape of a different size)
Implementations§
Source§impl<P: Primitive2d> Ring<P>
impl<P: Primitive2d> Ring<P>
Sourcepub const fn new(outer_shape: P, inner_shape: P) -> Self
pub const fn new(outer_shape: P, inner_shape: P) -> Self
Create a new Ring from a given outer_shape and inner_shape.
If the primitive implements Inset and you would like a uniform thickness, consider using ToRing::to_ring
Source§impl<P: Primitive2d + Clone + Inset> Ring<P>
impl<P: Primitive2d + Clone + Inset> Ring<P>
Sourcepub fn from_primitive_and_thickness(primitive: P, thickness: f32) -> Self
pub fn from_primitive_and_thickness(primitive: P, thickness: f32) -> Self
Generate a Ring from a given primitive and a thickness.
Trait Implementations§
Source§impl<P: Bounded2d + Primitive2d> Bounded2d for Ring<P>
impl<P: Bounded2d + Primitive2d> Bounded2d for Ring<P>
Source§fn aabb_2d(&self, isometry: impl Into<Isometry2d>) -> Aabb2d
fn aabb_2d(&self, isometry: impl Into<Isometry2d>) -> Aabb2d
Get an axis-aligned bounding box for the shape translated and rotated by the given isometry.
Source§fn bounding_circle(&self, isometry: impl Into<Isometry2d>) -> BoundingCircle
fn bounding_circle(&self, isometry: impl Into<Isometry2d>) -> BoundingCircle
Get a bounding circle for the shape translated and rotated by the given isometry.
Source§impl<T: BoundedExtrusion> BoundedExtrusion for Ring<T>
impl<T: BoundedExtrusion> BoundedExtrusion for Ring<T>
Source§fn extrusion_aabb_3d(
&self,
half_depth: f32,
isometry: impl Into<Isometry3d>,
) -> Aabb3d
fn extrusion_aabb_3d( &self, half_depth: f32, isometry: impl Into<Isometry3d>, ) -> Aabb3d
Get an axis-aligned bounding box for an extrusion with this shape as a base and the given
half_depth, transformed by the given translation and rotation.Source§fn extrusion_bounding_sphere(
&self,
half_depth: f32,
isometry: impl Into<Isometry3d>,
) -> BoundingSphere
fn extrusion_bounding_sphere( &self, half_depth: f32, isometry: impl Into<Isometry3d>, ) -> BoundingSphere
Get a bounding sphere for an extrusion of the
base_shape with the given half_depth with the given translation and rotationSource§impl<'de, P> Deserialize<'de> for Ring<P>where
P: Deserialize<'de> + Primitive2d,
impl<'de, P> Deserialize<'de> for Ring<P>where
P: Deserialize<'de> + Primitive2d,
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<P: Primitive2d + Measured2d> Measured2d for Ring<P>
impl<P: Primitive2d + Measured2d> Measured2d for Ring<P>
impl<P: Copy + Primitive2d> Copy for Ring<P>
impl<T: Primitive2d> Primitive2d for Ring<T>
impl<P: Primitive2d> StructuralPartialEq for Ring<P>
Auto Trait Implementations§
impl<P> Freeze for Ring<P>where
P: Freeze,
impl<P> RefUnwindSafe for Ring<P>where
P: RefUnwindSafe,
impl<P> Send for Ring<P>where
P: Send,
impl<P> Sync for Ring<P>where
P: Sync,
impl<P> Unpin for Ring<P>where
P: Unpin,
impl<P> UnwindSafe for Ring<P>where
P: UnwindSafe,
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
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 moreSource§impl<T> Serialize for T
impl<T> Serialize for T
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>
fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>
Source§impl<T> TypeData for T
impl<T> TypeData for T
Source§fn clone_type_data(&self) -> Box<dyn TypeData>
fn clone_type_data(&self) -> Box<dyn TypeData>
Creates a type-erased clone of this value.