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
impl b2PolygonShape
Sourcepub unsafe fn Set(
self: Pin<&mut b2PolygonShape>,
points: *const b2Vec2,
count: c_int,
)
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.
pub fn new() -> impl New<Output = Self>
Sourcepub unsafe fn Clone(
self: &b2PolygonShape,
allocator: *mut b2BlockAllocator,
) -> *mut b2Shape
pub unsafe fn Clone( self: &b2PolygonShape, allocator: *mut b2BlockAllocator, ) -> *mut b2Shape
Implement b2Shape.
Sourcepub fn GetChildCount(self: &b2PolygonShape) -> c_int
pub fn GetChildCount(self: &b2PolygonShape) -> c_int
@see b2Shape::GetChildCount
Sourcepub fn TestPoint(
self: &b2PolygonShape,
transform: &b2Transform,
p: &b2Vec2,
) -> bool
pub fn TestPoint( self: &b2PolygonShape, transform: &b2Transform, p: &b2Vec2, ) -> bool
@see b2Shape::TestPoint
pub unsafe fn ComputeDistance( self: &b2PolygonShape, xf: &b2Transform, p: &b2Vec2, distance: *mut f32, normal: *mut b2Vec2, childIndex: c_int, )
Sourcepub unsafe fn RayCast(
self: &b2PolygonShape,
output: *mut b2RayCastOutput,
input: &b2RayCastInput,
transform: &b2Transform,
childIndex: c_int,
) -> bool
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.
Sourcepub unsafe fn ComputeAABB(
self: &b2PolygonShape,
aabb: *mut b2AABB,
transform: &b2Transform,
childIndex: c_int,
)
pub unsafe fn ComputeAABB( self: &b2PolygonShape, aabb: *mut b2AABB, transform: &b2Transform, childIndex: c_int, )
@see b2Shape::ComputeAABB
Sourcepub unsafe fn ComputeMass(
self: &b2PolygonShape,
massData: *mut b2MassData,
density: f32,
)
pub unsafe fn ComputeMass( self: &b2PolygonShape, massData: *mut b2MassData, density: f32, )
@see b2Shape::ComputeMass
Source§impl b2PolygonShape
impl b2PolygonShape
Sourcepub fn SetAsBox(self: Pin<&mut Self>, hx: f32, hy: f32)
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.
Sourcepub fn SetAsBox1(
self: Pin<&mut Self>,
hx: f32,
hy: f32,
center: &b2Vec2,
angle: f32,
)
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.
Trait Implementations§
Source§impl AsRef<b2Shape> for b2PolygonShape
impl AsRef<b2Shape> for b2PolygonShape
Source§fn as_ref(self: &b2PolygonShape) -> &b2Shape
fn as_ref(self: &b2PolygonShape) -> &b2Shape
Source§impl CopyNew for b2PolygonShape
impl CopyNew for b2PolygonShape
Source§unsafe fn copy_new(
other: &b2PolygonShape,
this: Pin<&mut MaybeUninit<b2PolygonShape>>,
)
unsafe fn copy_new( other: &b2PolygonShape, this: Pin<&mut MaybeUninit<b2PolygonShape>>, )
Synthesized copy constructor.
Source§impl Drop for b2PolygonShape
impl Drop for b2PolygonShape
Source§fn drop(self: &mut b2PolygonShape)
fn drop(self: &mut b2PolygonShape)
Synthesized destructor.