b2Shape Class Reference

#include <b2Shape.h>

Inheritance diagram for b2Shape:
b2CircleShape b2PolygonShape

List of all members.

Public Types

enum  Type { e_unknown = -1, e_circle = 0, e_polygon = 1, e_typeCount = 2 }

Public Member Functions

 b2Shape ()
virtual ~b2Shape ()
virtual b2ShapeClone (b2BlockAllocator *allocator) const =0
 Clone the concrete shape using the provided allocator.
Type GetType () const
virtual bool TestPoint (const b2Transform &xf, const b2Vec2 &p) const =0
virtual bool RayCast (b2RayCastOutput *output, const b2RayCastInput &input, const b2Transform &transform) const =0
virtual void ComputeAABB (b2AABB *aabb, const b2Transform &xf) const =0
virtual void ComputeMass (b2MassData *massData, float32 density) const =0

Public Attributes

Type m_type
float32 m_radius

Detailed Description

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.


Member Enumeration Documentation

Enumerator:
e_unknown 
e_circle 
e_polygon 
e_typeCount 

Constructor & Destructor Documentation

b2Shape::b2Shape (  )  [inline]
virtual b2Shape::~b2Shape (  )  [inline, virtual]

Member Function Documentation

virtual b2Shape* b2Shape::Clone ( b2BlockAllocator allocator  )  const [pure virtual]

Clone the concrete shape using the provided allocator.

Implemented in b2CircleShape, and b2PolygonShape.

virtual void b2Shape::ComputeAABB ( b2AABB aabb,
const b2Transform xf 
) const [pure virtual]

Given a transform, compute the associated axis aligned bounding box for this shape.

Parameters:
aabb returns the axis aligned box.
xf the world transform of the shape.

Implemented in b2CircleShape, and b2PolygonShape.

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 b2CircleShape, and b2PolygonShape.

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.
virtual bool b2Shape::RayCast ( b2RayCastOutput output,
const b2RayCastInput input,
const b2Transform transform 
) const [pure virtual]

Cast a ray against this shape.

Parameters:
output the ray-cast results.
input the ray-cast input parameters.
transform the transform to be applied to the shape.

Implemented in b2CircleShape, and b2PolygonShape.

virtual bool b2Shape::TestPoint ( const b2Transform xf,
const b2Vec2 p 
) const [pure virtual]

Test a point for containment in this shape. This only works for convex shapes.

Parameters:
xf the shape world transform.
p a point in world coordinates.

Implemented in b2CircleShape, and b2PolygonShape.


Member Data Documentation


The documentation for this class was generated from the following file:
Generated on Sat Apr 3 18:18:09 2010 for Box2D by  doxygen 1.6.3