Skip to main content

b2Shape

Struct b2Shape 

Source
pub struct b2Shape { /* private fields */ }
Expand description

@file Structures and functions used for computing contact points, distance queries, and TOI queries.

Implementations§

Source§

impl b2Shape

Source

pub unsafe fn Clone( self: &b2Shape, allocator: *mut b2BlockAllocator, ) -> *mut b2Shape

Clone the concrete shape using the provided allocator.

Source

pub fn GetChildCount(self: &b2Shape) -> c_int

Get the number of child primitives.

Source

pub fn TestPoint(self: &b2Shape, xf: &b2Transform, p: &b2Vec2) -> bool

Test a point for containment in this shape. This only works for convex shapes. @param xf the shape world transform. @param p a point in world coordinates.

Source

pub unsafe fn ComputeDistance( self: &b2Shape, xf: &b2Transform, p: &b2Vec2, distance: *mut f32, normal: *mut b2Vec2, childIndex: c_int, )

Compute the distance from the current shape to the specified point. This only works for convex shapes. @param xf the shape world transform. @param p a point in world coordinates. @param distance returns the distance from the current shape. @param normal returns the direction in which the distance increases.

Source

pub unsafe fn RayCast( self: &b2Shape, output: *mut b2RayCastOutput, input: &b2RayCastInput, transform: &b2Transform, childIndex: c_int, ) -> bool

Cast a ray against a child shape. @param output the ray-cast results. @param input the ray-cast input parameters. @param transform the transform to be applied to the shape. @param childIndex the child shape index

Source

pub unsafe fn ComputeAABB( self: &b2Shape, aabb: *mut b2AABB, xf: &b2Transform, childIndex: c_int, )

Given a transform, compute the associated axis aligned bounding box for a child shape. @param aabb returns the axis aligned box. @param xf the world transform of the shape. @param childIndex the child shape

Source

pub unsafe fn ComputeMass( self: &b2Shape, massData: *mut b2MassData, density: f32, )

Compute the mass properties of this shape using its dimensions and density. The inertia tensor is computed about the local origin. @param massData returns the mass data for this shape. @param density the density in kilograms per meter squared.

Source§

impl b2Shape

Source

pub fn GetType(&self) -> b2Shape_Type

Get the type of this shape. You can use this to down cast to the concrete shape. @return the shape type.

Trait Implementations§

Source§

impl AsRef<b2Shape> for b2ChainShape

Source§

fn as_ref(self: &b2ChainShape) -> &b2Shape

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<b2Shape> for b2CircleShape

Source§

fn as_ref(self: &b2CircleShape) -> &b2Shape

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<b2Shape> for b2EdgeShape

Source§

fn as_ref(self: &b2EdgeShape) -> &b2Shape

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<b2Shape> for b2PolygonShape

Source§

fn as_ref(self: &b2PolygonShape) -> &b2Shape

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Drop for b2Shape

Source§

fn drop(self: &mut b2Shape)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl ExternType for b2Shape

Source§

type Kind = Opaque

Source§

type Id

A type-level representation of the type’s C++ namespace and type name. Read more
Source§

impl MakeCppStorage for b2Shape

Source§

unsafe fn allocate_uninitialized_cpp_storage() -> *mut b2Shape

Allocates heap space for this type in C++ and return a pointer to that space, but do not initialize that space (i.e. do not yet call a constructor). Read more
Source§

unsafe fn free_uninitialized_cpp_storage(arg0: *mut b2Shape)

Frees a C++ allocation which has not yet had a constructor called. Read more
Source§

impl SharedPtrTarget for b2Shape

Source§

impl UniquePtrTarget for b2Shape

Source§

impl WeakPtrTarget for b2Shape

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> 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> 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, 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.