Public Types | Public Member Functions | Public Attributes | List of all members
b2Shape Class Referenceabstract

#include <b2Shape.h>

Inheritance diagram for b2Shape:
Inheritance graph
[legend]

Public Types

enum  Type {
  e_circle = 0, e_edge = 1, e_polygon = 2, e_chain = 3,
  e_typeCount = 4
}
 

Public Member Functions

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

Public Attributes

float32 m_radius
 
Type m_type
 

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. Shapes may encapsulate a one or more child shapes.

Definition at line 42 of file b2Shape.h.

Member Enumeration Documentation

Enumerator
e_circle 
e_edge 
e_polygon 
e_chain 
e_typeCount 

Definition at line 46 of file b2Shape.h.

Constructor & Destructor Documentation

virtual b2Shape::~b2Shape ( )
inlinevirtual

Definition at line 55 of file b2Shape.h.

Member Function Documentation

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

Clone the concrete shape using the provided allocator.

Implemented in b2ChainShape, b2EdgeShape, b2PolygonShape, and b2CircleShape.

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
aabbreturns the axis aligned box.
xfthe world transform of the shape.
childIndexthe child shape

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
massDatareturns the mass data for this shape.
densitythe density in kilograms per meter squared.

Implemented in b2ChainShape, b2PolygonShape, b2EdgeShape, and b2CircleShape.

virtual int32 b2Shape::GetChildCount ( ) const
pure virtual

Get the number of child primitives.

Implemented in b2ChainShape, b2EdgeShape, b2PolygonShape, 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.

Definition at line 96 of file b2Shape.h.

virtual bool b2Shape::RayCast ( b2RayCastOutput output,
const b2RayCastInput input,
const b2Transform transform,
int32  childIndex 
) const
pure virtual

Cast a ray against a child shape.

Parameters
outputthe ray-cast results.
inputthe ray-cast input parameters.
transformthe transform to be applied to the shape.
childIndexthe child shape index

Implemented in b2ChainShape, b2PolygonShape, b2EdgeShape, and b2CircleShape.

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
xfthe shape world transform.
pa point in world coordinates.

Implemented in b2ChainShape, b2PolygonShape, b2EdgeShape, and b2CircleShape.

Member Data Documentation

float32 b2Shape::m_radius

Definition at line 93 of file b2Shape.h.

Type b2Shape::m_type

Definition at line 92 of file b2Shape.h.


The documentation for this class was generated from the following file:


mvsim
Author(s):
autogenerated on Thu Jun 6 2019 19:36:41