Skip to main content

ArrayConvexPolytope

Struct ArrayConvexPolytope 

Source
pub struct ArrayConvexPolytope<const P: usize, const V: usize> {
    pub planes: [(Vec3, f32); P],
    pub vertices: [Vec3; V],
    pub obb: Cuboid,
}
Expand description

A convex polytope defined by half-planes and vertices, using const generics so it can be constructed and stored in const / static contexts.

P is the number of half-planes, V is the number of vertices.

This is mostly meant for usage with codegen where you statically define obstacles based on some sort of file at build time, and want to be able to use them in const contexts.

Fields§

§planes: [(Vec3, f32); P]§vertices: [Vec3; V]§obb: Cuboid

Implementations§

Source§

impl<const P: usize, const V: usize> ArrayConvexPolytope<P, V>

Source

pub const fn new( planes: [(Vec3, f32); P], vertices: [Vec3; V], obb: Cuboid, ) -> Self

Create a new const convex polytope. This is a const fn so it can be used in const and static initializers.

Source§

impl<const P: usize, const V: usize> ArrayConvexPolytope<P, V>

Source

pub fn scale(&mut self, factor: f32)

Source§

impl<const P: usize, const V: usize> ArrayConvexPolytope<P, V>

Source

pub fn translate(&mut self, offset: Vec3A)

Source

pub fn rotate_mat(&mut self, mat: Mat3A)

Source

pub fn rotate_quat(&mut self, quat: Quat)

Source

pub fn transform(&mut self, mat: Affine3A)

Trait Implementations§

Source§

impl<const P: usize, const V: usize> Clone for ArrayConvexPolytope<P, V>

Source§

fn clone(&self) -> ArrayConvexPolytope<P, V>

Returns a duplicate 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<const P: usize, const V: usize, PCL: PointCloudMarker> ColliderComponent<PCL> for ArrayConvexPolytope<P, V>

Source§

fn add_to_shapes(self, c: &mut Collider<PCL>)

Source§

impl<const V: usize, const P: usize, const PV: usize> Collides<ArrayConvexPolygon<V>> for ArrayConvexPolytope<P, PV>

Source§

fn collides(&self, other: &T) -> bool

Collision test (broadphase + narrowphase).
Source§

impl<const V: usize, const P: usize, const PV: usize> Collides<ArrayConvexPolytope<P, PV>> for ArrayConvexPolygon<V>

Source§

fn collides(&self, other: &T) -> bool

Collision test (broadphase + narrowphase).
Source§

impl<const P: usize, const V: usize> Collides<ArrayConvexPolytope<P, V>> for Capsule

Source§

fn collides(&self, other: &T) -> bool

Collision test (broadphase + narrowphase).
Source§

impl<const P: usize, const V: usize> Collides<ArrayConvexPolytope<P, V>> for ConvexPolygon

Source§

fn collides(&self, other: &T) -> bool

Collision test (broadphase + narrowphase).
Source§

impl<const P: usize, const V: usize> Collides<ArrayConvexPolytope<P, V>> for ConvexPolytope

Source§

fn collides(&self, other: &T) -> bool

Collision test (broadphase + narrowphase).
Source§

impl<const P: usize, const V: usize> Collides<ArrayConvexPolytope<P, V>> for Cuboid

Source§

fn collides(&self, other: &T) -> bool

Collision test (broadphase + narrowphase).
Source§

impl<const P: usize, const V: usize> Collides<ArrayConvexPolytope<P, V>> for Line

Source§

fn collides(&self, other: &T) -> bool

Collision test (broadphase + narrowphase).
Source§

impl<const P: usize, const V: usize> Collides<ArrayConvexPolytope<P, V>> for LineSegment

Source§

fn collides(&self, other: &T) -> bool

Collision test (broadphase + narrowphase).
Source§

impl<const P: usize, const V: usize> Collides<ArrayConvexPolytope<P, V>> for Plane

Source§

fn collides(&self, other: &T) -> bool

Collision test (broadphase + narrowphase).
Source§

impl<const P: usize, const V: usize> Collides<ArrayConvexPolytope<P, V>> for Pointcloud

Source§

fn collides(&self, other: &T) -> bool

Collision test (broadphase + narrowphase).
Source§

impl<const P: usize, const V: usize> Collides<ArrayConvexPolytope<P, V>> for Ray

Source§

fn collides(&self, other: &T) -> bool

Collision test (broadphase + narrowphase).
Source§

impl<const P: usize, const V: usize> Collides<ArrayConvexPolytope<P, V>> for Sphere

Source§

fn collides(&self, other: &T) -> bool

Collision test (broadphase + narrowphase).
Source§

impl<const P: usize, const V: usize, const P2: usize, const V2: usize> Collides<ArrayConvexPolytope<P2, V2>> for ArrayConvexPolytope<P, V>

Source§

fn collides(&self, other: &T) -> bool

Collision test (broadphase + narrowphase).
Source§

impl<const P: usize, const V: usize> Collides<Capsule> for ArrayConvexPolytope<P, V>

Source§

fn collides(&self, other: &T) -> bool

Collision test (broadphase + narrowphase).
Source§

impl<const P: usize, const V: usize> Collides<ConvexPolygon> for ArrayConvexPolytope<P, V>

Source§

fn collides(&self, other: &T) -> bool

Collision test (broadphase + narrowphase).
Source§

impl<const P: usize, const V: usize> Collides<ConvexPolytope> for ArrayConvexPolytope<P, V>

Source§

fn collides(&self, other: &T) -> bool

Collision test (broadphase + narrowphase).
Source§

impl<const P: usize, const V: usize> Collides<Cuboid> for ArrayConvexPolytope<P, V>

Source§

fn collides(&self, other: &T) -> bool

Collision test (broadphase + narrowphase).
Source§

impl<const P: usize, const V: usize> Collides<Line> for ArrayConvexPolytope<P, V>

Source§

fn collides(&self, other: &T) -> bool

Collision test (broadphase + narrowphase).
Source§

impl<const P: usize, const V: usize> Collides<LineSegment> for ArrayConvexPolytope<P, V>

Source§

fn collides(&self, other: &T) -> bool

Collision test (broadphase + narrowphase).
Source§

impl<const P: usize, const V: usize> Collides<NoPcl> for ArrayConvexPolytope<P, V>

Source§

fn collides(&self, other: &T) -> bool

Collision test (broadphase + narrowphase).
Source§

impl<const P: usize, const V: usize> Collides<Plane> for ArrayConvexPolytope<P, V>

Source§

fn collides(&self, other: &T) -> bool

Collision test (broadphase + narrowphase).
Source§

impl<const P: usize, const V: usize> Collides<Pointcloud> for ArrayConvexPolytope<P, V>

Source§

fn collides(&self, other: &T) -> bool

Collision test (broadphase + narrowphase).
Source§

impl<const P: usize, const V: usize> Collides<Ray> for ArrayConvexPolytope<P, V>

Source§

fn collides(&self, other: &T) -> bool

Collision test (broadphase + narrowphase).
Source§

impl<const P: usize, const V: usize> Collides<Sphere> for ArrayConvexPolytope<P, V>

Source§

fn collides(&self, other: &T) -> bool

Collision test (broadphase + narrowphase).
Source§

impl<const P: usize, const V: usize> Debug for ArrayConvexPolytope<P, V>

Source§

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

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

impl<const P: usize, const V: usize> Display for ArrayConvexPolytope<P, V>

Source§

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

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

impl<const P: usize, const V: usize> From<ArrayConvexPolytope<P, V>> for ConvexPolytope

Source§

fn from(polytope: ArrayConvexPolytope<P, V>) -> Self

Converts to this type from the input type.
Source§

impl<const P: usize, const V: usize> Scalable for ArrayConvexPolytope<P, V>

Source§

fn scale(&mut self, factor: f32)

Scales the shape by the given factor, in-place. Read more
Source§

fn scaled(self, factor: f32) -> Self

Returns a scaled copy of the shape. Read more
Source§

fn scale_d(&mut self, factor: f64)

Source§

fn scaled_d(self, factor: f64) -> Self

Source§

impl<const P: usize, const V: usize> Stretchable for ArrayConvexPolytope<P, V>

Source§

type Output = ConvexPolytope

Source§

fn stretch(&self, translation: Vec3) -> Self::Output

Source§

fn stretch_d(&self, translation: DVec3) -> Self::Output

Source§

impl<const P: usize, const V: usize> Transformable for ArrayConvexPolytope<P, V>

Source§

fn translate(&mut self, offset: Vec3A)

Source§

fn rotate_mat(&mut self, mat: Mat3A)

Source§

fn rotate_quat(&mut self, quat: Quat)

Source§

fn transform(&mut self, mat: Affine3A)

Source§

fn translated(self, offset: Vec3A) -> Self

Source§

fn translate_d(&mut self, offset: DVec3)

Source§

fn translated_d(self, offset: DVec3) -> Self

Source§

fn rotated_mat(self, mat: Mat3A) -> Self

Source§

fn rotate_mat_d(&mut self, mat: DMat3)

Source§

fn rotated_mat_d(self, mat: DMat3) -> Self

Source§

fn rotated_quat(self, quat: Quat) -> Self

Source§

fn rotate_quat_d(&mut self, quat: DQuat)

Source§

fn rotated_quat_d(self, quat: DQuat) -> Self

Source§

fn transformed(self, mat: Affine3A) -> Self

Source§

fn transform_d(&mut self, mat: DAffine3)

Source§

fn transformed_d(self, mat: DAffine3) -> Self

Source§

impl<const P: usize, const V: usize> Copy for ArrayConvexPolytope<P, V>

Auto Trait Implementations§

§

impl<const P: usize, const V: usize> Freeze for ArrayConvexPolytope<P, V>

§

impl<const P: usize, const V: usize> RefUnwindSafe for ArrayConvexPolytope<P, V>

§

impl<const P: usize, const V: usize> Send for ArrayConvexPolytope<P, V>

§

impl<const P: usize, const V: usize> Sync for ArrayConvexPolytope<P, V>

§

impl<const P: usize, const V: usize> Unpin for ArrayConvexPolytope<P, V>

§

impl<const P: usize, const V: usize> UnsafeUnpin for ArrayConvexPolytope<P, V>

§

impl<const P: usize, const V: usize> UnwindSafe for ArrayConvexPolytope<P, V>

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> 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, dest: *mut u8)

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.