#include <b2Shape.h>
Inherited by b2ChainShape, b2CircleShape, b2EdgeShape, and b2PolygonShape.
|
enum | Type {
e_circle = 0,
e_edge = 1,
e_polygon = 2,
e_chain = 3,
e_typeCount = 4
} |
|
|
virtual b2Shape * | Clone (b2BlockAllocator *allocator) const =0 |
| Clone the concrete shape using the provided allocator.
|
|
Type | GetType () const |
|
virtual int32 | GetChildCount () const =0 |
| Get the number of child primitives.
|
|
virtual bool | TestPoint (const b2Transform &xf, const b2Vec2 &p) const =0 |
|
virtual void | ComputeDistance (const b2Transform &xf, const b2Vec2 &p, float32 *distance, b2Vec2 *normal, int32 childIndex) const =0 |
|
virtual bool | RayCast (b2RayCastOutput *output, const b2RayCastInput &input, const b2Transform &transform, int32 childIndex) const =0 |
|
virtual void | ComputeAABB (b2AABB *aabb, const b2Transform &xf, int32 childIndex) const =0 |
|
virtual void | ComputeMass (b2MassData *massData, float32 density) const =0 |
|
|
Type | m_type |
|
float32 | m_radius |
|
A shape is used for collision detection. You can create a shape however you like. Shapes used for simulation in b2World are created automatically when a b2Fixture is created. Shapes may encapsulate a one or more child shapes.
virtual void b2Shape::ComputeAABB |
( |
b2AABB * |
aabb, |
|
|
const b2Transform & |
xf, |
|
|
int32 |
childIndex |
|
) |
| const |
|
pure virtual |
Given a transform, compute the associated axis aligned bounding box for a child shape.
- Parameters
-
aabb | returns the axis aligned box. |
xf | the world transform of the shape. |
childIndex | the child shape |
Implemented in b2ChainShape, b2PolygonShape, b2EdgeShape, and b2CircleShape.
virtual void b2Shape::ComputeDistance |
( |
const b2Transform & |
xf, |
|
|
const b2Vec2 & |
p, |
|
|
float32 * |
distance, |
|
|
b2Vec2 * |
normal, |
|
|
int32 |
childIndex |
|
) |
| const |
|
pure virtual |
Compute the distance from the current shape to the specified point. This only works for convex shapes.
- Parameters
-
xf | the shape world transform. |
p | a point in world coordinates. |
distance | returns the distance from the current shape. |
normal | returns the direction in which the distance increases. |
Implemented in b2ChainShape, b2PolygonShape, b2EdgeShape, and b2CircleShape.
virtual void b2Shape::ComputeMass |
( |
b2MassData * |
massData, |
|
|
float32 |
density |
|
) |
| const |
|
pure virtual |
Compute the mass properties of this shape using its dimensions and density. The inertia tensor is computed about the local origin.
- Parameters
-
massData | returns the mass data for this shape. |
density | the density in kilograms per meter squared. |
Implemented in b2ChainShape, b2PolygonShape, b2EdgeShape, and b2CircleShape.
b2Shape::Type b2Shape::GetType |
( |
| ) |
const |
|
inline |
Get the type of this shape. You can use this to down cast to the concrete shape.
- Returns
- the shape type.
Cast a ray against a child shape.
- Parameters
-
output | the ray-cast results. |
input | the ray-cast input parameters. |
transform | the transform to be applied to the shape. |
childIndex | the child shape index |
Implemented in b2ChainShape, b2PolygonShape, b2EdgeShape, and b2CircleShape.
The documentation for this class was generated from the following file: