#[repr(C, align(8))]
pub struct b2PolygonShape { /* private fields */ }
Expand description

A solid convex polygon. It is assumed that the interior of the polygon is to the left of each edge. Polygons have a maximum number of vertices equal to b2_maxPolygonVertices. In most cases you should not need many vertices for a convex polygon.

Implementations§

source§

impl b2PolygonShape

source

pub unsafe fn Set( self: Pin<&mut b2PolygonShape>, points: *const b2Vec2, count: c_int )

Create a convex hull from the given array of local points. The count must be in the range [3, b2_maxPolygonVertices]. @warning the points may be re-ordered, even if they form a convex polygon @warning collinear points are handled but not removed. Collinear points may lead to poor stacking behavior.

source

pub fn new() -> impl New<Output = Self>

source

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

Implement b2Shape.

source

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

@see b2Shape::GetChildCount

source

pub fn TestPoint( self: &b2PolygonShape, transform: &b2Transform, p: &b2Vec2 ) -> bool

@see b2Shape::TestPoint

source

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

source

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

Implement b2Shape. @note because the polygon is solid, rays that start inside do not hit because the normal is not defined.

source

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

@see b2Shape::ComputeAABB

source

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

@see b2Shape::ComputeMass

source§

impl b2PolygonShape

source

pub fn SetAsBox(self: Pin<&mut Self>, hx: f32, hy: f32)

Build vertices to represent an axis-aligned box centered on the local origin. @param hx the half-width. @param hy the half-height.

source§

impl b2PolygonShape

source

pub fn SetAsBox1( self: Pin<&mut Self>, hx: f32, hy: f32, center: &b2Vec2, angle: f32 )

Build vertices to represent an oriented box. @param hx the half-width. @param hy the half-height. @param center the center of the box in local coordinates. @param angle the rotation of the box in local coordinates.

source§

impl b2PolygonShape

source

pub fn Validate(&self) -> bool

Validate convexity. This is a very time consuming operation. @returns true if valid

Trait Implementations§

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 CopyNew for b2PolygonShape

source§

unsafe fn copy_new( other: &b2PolygonShape, this: Pin<&mut MaybeUninit<b2PolygonShape>> )

Synthesized copy constructor.

source§

impl Drop for b2PolygonShape

source§

fn drop(self: &mut b2PolygonShape)

Synthesized destructor.

source§

impl ExternType for b2PolygonShape

§

type Id = (b, _2, P, o, l, y, g, o, n, S, h, a, p, e)

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

type Kind = Opaque

source§

impl MakeCppStorage for b2PolygonShape

source§

unsafe fn allocate_uninitialized_cpp_storage() -> *mut b2PolygonShape

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 b2PolygonShape)

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

impl SharedPtrTarget for b2PolygonShape

source§

impl UniquePtrTarget for b2PolygonShape

source§

impl WeakPtrTarget for b2PolygonShape

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.