avian2d::collision::collider

Struct EllipseColliderShape

Source
pub struct EllipseColliderShape(pub Ellipse);
Expand description

An ellipse shape that can be stored in a SharedShape for an ellipse Collider.

This wrapper is required to allow implementing the necessary traits from parry for Bevy’s Ellipse type.

Tuple Fields§

§0: Ellipse

Methods from Deref<Target = Ellipse>§

Source

pub fn eccentricity(&self) -> f32

Returns the eccentricity of the ellipse. It can be thought of as a measure of how “stretched” or elongated the ellipse is.

The value should be in the range [0, 1), where 0 represents a circle, and 1 represents a parabola.

Source

pub fn focal_length(&self) -> f32

Get the focal length of the ellipse. This corresponds to the distance between one of the foci and the center of the ellipse.

The focal length of an ellipse is related to its eccentricity by eccentricity = focal_length / semi_major

Source

pub fn semi_major(&self) -> f32

Returns the length of the semi-major axis. This corresponds to the longest radius of the ellipse.

Source

pub fn semi_minor(&self) -> f32

Returns the length of the semi-minor axis. This corresponds to the shortest radius of the ellipse.

Trait Implementations§

Source§

impl Clone for EllipseColliderShape

Source§

fn clone(&self) -> EllipseColliderShape

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EllipseColliderShape

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deref for EllipseColliderShape

Source§

type Target = Ellipse

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for EllipseColliderShape

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl PointQuery for EllipseColliderShape

Source§

fn project_local_point( &self, pt: &Point<Scalar>, solid: bool, ) -> PointProjection

Projects a point on self. Read more
Source§

fn project_local_point_and_get_feature( &self, pt: &Point<Scalar>, ) -> (PointProjection, FeatureId)

Projects a point on the boundary of self and returns the id of the feature the point was projected on.
Source§

fn project_local_point_with_max_dist( &self, pt: &OPoint<f32, Const<2>>, solid: bool, max_dist: f32, ) -> Option<PointProjection>

Projects a point on self, unless the projection lies further than the given max distance. Read more
Source§

fn project_point_with_max_dist( &self, m: &Isometry<f32, Unit<Complex<f32>>, 2>, pt: &OPoint<f32, Const<2>>, solid: bool, max_dist: f32, ) -> Option<PointProjection>

Projects a point on self transformed by m, unless the projection lies further than the given max distance.
Source§

fn distance_to_local_point( &self, pt: &OPoint<f32, Const<2>>, solid: bool, ) -> f32

Computes the minimal distance between a point and self.
Source§

fn contains_local_point(&self, pt: &OPoint<f32, Const<2>>) -> bool

Tests if the given point is inside of self.
Source§

fn project_point( &self, m: &Isometry<f32, Unit<Complex<f32>>, 2>, pt: &OPoint<f32, Const<2>>, solid: bool, ) -> PointProjection

Projects a point on self transformed by m.
Source§

fn distance_to_point( &self, m: &Isometry<f32, Unit<Complex<f32>>, 2>, pt: &OPoint<f32, Const<2>>, solid: bool, ) -> f32

Computes the minimal distance between a point and self transformed by m.
Source§

fn project_point_and_get_feature( &self, m: &Isometry<f32, Unit<Complex<f32>>, 2>, pt: &OPoint<f32, Const<2>>, ) -> (PointProjection, FeatureId)

Projects a point on the boundary of self transformed by m and returns the id of the feature the point was projected on.
Source§

fn contains_point( &self, m: &Isometry<f32, Unit<Complex<f32>>, 2>, pt: &OPoint<f32, Const<2>>, ) -> bool

Tests if the given point is inside of self transformed by m.
Source§

impl RayCast for EllipseColliderShape

Source§

fn cast_local_ray_and_get_normal( &self, ray: &Ray, max_toi: Scalar, solid: bool, ) -> Option<RayIntersection>

Computes the time of impact, and normal between this transformed shape and a ray.
Source§

fn cast_local_ray( &self, ray: &Ray, max_time_of_impact: f32, solid: bool, ) -> Option<f32>

Computes the time of impact between this transform shape and a ray.
Source§

fn intersects_local_ray(&self, ray: &Ray, max_time_of_impact: f32) -> bool

Tests whether a ray intersects this transformed shape.
Source§

fn cast_ray( &self, m: &Isometry<f32, Unit<Complex<f32>>, 2>, ray: &Ray, max_time_of_impact: f32, solid: bool, ) -> Option<f32>

Computes the time of impact between this transform shape and a ray.
Source§

fn cast_ray_and_get_normal( &self, m: &Isometry<f32, Unit<Complex<f32>>, 2>, ray: &Ray, max_time_of_impact: f32, solid: bool, ) -> Option<RayIntersection>

Computes the time of impact, and normal between this transformed shape and a ray.
Source§

fn intersects_ray( &self, m: &Isometry<f32, Unit<Complex<f32>>, 2>, ray: &Ray, max_time_of_impact: f32, ) -> bool

Tests whether a ray intersects this transformed shape.
Source§

impl Shape for EllipseColliderShape

Source§

fn clone_dyn(&self) -> Box<dyn Shape>

Clones this shape into a boxed trait-object. Read more
Source§

fn scale_dyn( &self, scale: &Vector<Scalar>, _num_subdivisions: u32, ) -> Option<Box<dyn Shape>>

Scales this shape by scale into a boxed trait-object. Read more
Source§

fn compute_local_aabb(&self) -> Aabb

Computes the Aabb of this shape.
Source§

fn compute_aabb(&self, position: &Isometry<Scalar>) -> Aabb

Computes the Aabb of this shape with the given position.
Source§

fn compute_local_bounding_sphere(&self) -> BoundingSphere

Computes the bounding-sphere of this shape.
Source§

fn compute_bounding_sphere(&self, position: &Isometry<Scalar>) -> BoundingSphere

Computes the bounding-sphere of this shape with the given position.
Source§

fn clone_box(&self) -> Box<dyn Shape>

👎Deprecated: renamed to clone_dyn
Clones this shape into a boxed trait-object. Read more
Source§

fn mass_properties(&self, density: Scalar) -> MassProperties

Compute the mass-properties of this shape given its uniform density.
Source§

fn is_convex(&self) -> bool

Is this shape known to be convex? Read more
Source§

fn shape_type(&self) -> ShapeType

Gets the type tag of this shape.
Source§

fn as_typed_shape(&self) -> TypedShape<'_>

Gets the underlying shape as an enum.
Source§

fn ccd_thickness(&self) -> Scalar

Source§

fn ccd_angular_thickness(&self) -> Scalar

Source§

fn as_support_map(&self) -> Option<&dyn SupportMap>

Converts this shape into its support mapping, if it has one.
Source§

fn as_composite_shape(&self) -> Option<&dyn SimdCompositeShape>

Source§

fn as_polygonal_feature_map(&self) -> Option<(&dyn PolygonalFeatureMap, f32)>

Converts this shape to a polygonal feature-map, if it is one.
Source§

fn feature_normal_at_point( &self, _feature: FeatureId, _point: &OPoint<f32, Const<2>>, ) -> Option<Unit<Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>>>

The shape’s normal at the given point located on a specific feature.
Source§

fn compute_swept_aabb( &self, start_pos: &Isometry<f32, Unit<Complex<f32>>, 2>, end_pos: &Isometry<f32, Unit<Complex<f32>>, 2>, ) -> Aabb

Computes the swept Aabb of this shape, i.e., the space it would occupy by moving from the given start position to the given end position.
Source§

impl SupportMap for EllipseColliderShape

Source§

fn local_support_point(&self, direction: &Vector2<Scalar>) -> Point2<Scalar>

Source§

fn local_support_point_toward( &self, dir: &Unit<Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>>, ) -> OPoint<f32, Const<2>>

Same as self.local_support_point except that dir is normalized.
Source§

fn support_point( &self, transform: &Isometry<f32, Unit<Complex<f32>>, 2>, dir: &Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>, ) -> OPoint<f32, Const<2>>

Source§

fn support_point_toward( &self, transform: &Isometry<f32, Unit<Complex<f32>>, 2>, dir: &Unit<Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>>, ) -> OPoint<f32, Const<2>>

Same as self.support_point except that dir is normalized.
Source§

impl Copy for EllipseColliderShape

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T, U> AsBindGroupShaderType<U> for T
where U: ShaderType, &'a T: for<'a> Into<U>,

Source§

fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U

Return the T ShaderType for self. When used in AsBindGroup derives, it is safe to assume that all images in self exist.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &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)

Convert &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> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> TypeData for T
where T: 'static + Send + Sync + Clone,

Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ConditionalSend for T
where T: Send,

Source§

impl<T> Settings for T
where T: 'static + Send + Sync,

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,