clanPhysics Collision

Classes

class  clan::ChainShape
 Chain Shape class. More...
 
class  clan::CircleShape
 Circle Shape class. More...
 
class  clan::EdgeShape
 Edge Shape class. More...
 
class  clan::PhysicsObject
 Physics Object class. More...
 
class  clan::PolygonShape
 Polygon Shape class. More...
 
class  clan::Shape
 Shape class. More...
 

Enumerations

enum  clan::ShapeType { clan::shape_circle = 0, clan::shape_edge = 1, clan::shape_polygon = 2, clan::shape_chain = 3 }
 Shape types. More...
 

Friends

class clan::Shape::FixtureDescription
 
class clan::EdgeShape::FixtureDescription
 
class clan::PolygonShape::FixtureDescription
 
class clan::CircleShape::FixtureDescription
 
class clan::ChainShape::FixtureDescription
 

Construction

 clan::PhysicsObject::PhysicsObject ()
 
virtual clan::PhysicsObject::~PhysicsObject ()
 

Attributes

virtual bool clan::PhysicsObject::should_collide_with (Body &body)=0
 

Operations

virtual void clan::PhysicsObject::on_collision_begin (Body &body)=0
 
virtual void clan::PhysicsObject::on_collision_end (Body &body)=0
 

Construction

 clan::ChainShape::ChainShape ()
 Constructs a null instance. More...
 
 clan::ChainShape::ChainShape (const PhysicsWorld &pw)
 Constructs a Chain Shape. More...
 
 clan::ChainShape::ChainShape (const PhysicsContext &pc)
 Constructs a Chain Shape. More...
 
 clan::ChainShape::~ChainShape ()
 

Attributes

bool clan::ChainShape::is_null () const
 Returns true if this object is invalid. More...
 
void clan::ChainShape::throw_if_null () const
 Throw an exception if this object is invalid. More...
 

Operations

ChainShape & clan::ChainShape::operator= (const ChainShape &copy)
 Copy assignment operator. More...
 
void clan::ChainShape::create_loop (const Vec2f *vertices, const int count)
 Create a loop. This automatically adjusts connectivity. More...
 
void clan::ChainShape::create_loop (const CollisionOutline &outline)
 
void clan::ChainShape::create_chain (const Vec2f *vertices, const int count)
 Create a chain with isolated end vertices. More...
 
void clan::ChainShape::set_prev_vertex (const Vec2f &prev_vertex)
 Establish connectivity to a vertex that precedes the first vertex. Don't call this for loops. More...
 
void clan::ChainShape::set_next_vertex (const Vec2f &next_vertex)
 Establish connectivity to a vertex that follows the last vertex. Don't call this for loops. More...
 

Construction

 clan::CircleShape::CircleShape ()
 Constructs a null instance. More...
 
 clan::CircleShape::CircleShape (const PhysicsWorld &pw)
 Constructs a Circle Shape. More...
 
 clan::CircleShape::CircleShape (const PhysicsContext &pc)
 Constructs a Circle Shape. More...
 
 clan::CircleShape::~CircleShape ()
 

Attributes

bool clan::CircleShape::is_null () const
 Returns true if this object is invalid. More...
 
void clan::CircleShape::throw_if_null () const
 Throw an exception if this object is invalid. More...
 

Operations

CircleShape & clan::CircleShape::operator= (const CircleShape &copy)
 Copy assignment operator. More...
 
void clan::CircleShape::set_radius (float radius)
 

Construction

 clan::EdgeShape::EdgeShape ()
 Constructs a null instance. More...
 
 clan::EdgeShape::EdgeShape (const PhysicsWorld &pw)
 Constructs an Edge Shape. More...
 
 clan::EdgeShape::EdgeShape (const PhysicsContext &pc)
 Constructs an Edge Shape. More...
 
 clan::EdgeShape::~EdgeShape ()
 

Attributes

bool clan::EdgeShape::is_null () const
 Returns true if this object is invalid. More...
 
void clan::EdgeShape::throw_if_null () const
 Throw an exception if this object is invalid. More...
 

Operations

EdgeShape & clan::EdgeShape::operator= (const EdgeShape &copy)
 Copy assignment operator. More...
 
void clan::EdgeShape::set (const Vec2f &v1, const Vec2f &v2)
 Set this as an isolated edge. More...
 

Construction

 clan::PolygonShape::PolygonShape ()
 Constructs a null instance. More...
 
 clan::PolygonShape::PolygonShape (const PhysicsWorld &pw)
 Constructs a Polygon Shape. More...
 
 clan::PolygonShape::PolygonShape (const PhysicsContext &pc)
 Constructs a Polygon Shape. More...
 
 clan::PolygonShape::~PolygonShape ()
 

Attributes

bool clan::PolygonShape::is_null () const
 Returns true if this object is invalid. More...
 
void clan::PolygonShape::throw_if_null () const
 Throw an exception if this object is invalid. More...
 

Operations

PolygonShape & clan::PolygonShape::operator= (const PolygonShape &copy)
 Copy assignment operator. More...
 
void clan::PolygonShape::set_as_box (float width, float height)
 
void clan::PolygonShape::set_as_box (float width, float height, const Vec2f &center, Angle &angle)
 

Construction

 clan::Shape::Shape ()
 Constructs a Shape object. More...
 
virtual clan::Shape::~Shape ()
 

Attributes

ShapeType clan::Shape::get_shape_type () const
 
bool clan::Shape::is_null () const
 Returns true if this object is invalid. More...
 
void clan::Shape::throw_if_null () const
 Throw an exception if this object is invalid. More...
 

Operations

Shape & clan::Shape::operator= (const Shape &copy)
 Copy operator. More...
 

Implementation

std::shared_ptr< Shape_Impl > clan::Shape::shape_impl
 

Detailed Description

Enumeration Type Documentation

Shape types.

Enumerator
shape_circle 
shape_edge 
shape_polygon 
shape_chain 

Function Documentation

clan::ChainShape::ChainShape ( )

Constructs a null instance.

clan::ChainShape::ChainShape ( const PhysicsWorld pw)

Constructs a Chain Shape.

Parameters
pw= Physics World.
clan::ChainShape::ChainShape ( const PhysicsContext pc)

Constructs a Chain Shape.

Parameters
pc= Physics Context.
clan::CircleShape::CircleShape ( )

Constructs a null instance.

clan::CircleShape::CircleShape ( const PhysicsWorld pw)

Constructs a Circle Shape.

Parameters
pw= Physics World.
clan::CircleShape::CircleShape ( const PhysicsContext pc)

Constructs a Circle Shape.

Parameters
pc= Physics Context
clan::EdgeShape::EdgeShape ( )

Constructs a null instance.

clan::EdgeShape::EdgeShape ( const PhysicsWorld pw)

Constructs an Edge Shape.

Parameters
pw= Physics World.
clan::EdgeShape::EdgeShape ( const PhysicsContext pc)

Constructs an Edge Shape.

Parameters
pw= Physics World.
clan::PhysicsObject::PhysicsObject ( )
inline
clan::PolygonShape::PolygonShape ( )

Constructs a null instance.

clan::PolygonShape::PolygonShape ( const PhysicsWorld pw)

Constructs a Polygon Shape.

Parameters
pw= Physics World.
clan::PolygonShape::PolygonShape ( const PhysicsContext pc)

Constructs a Polygon Shape.

Parameters
pc= Physics Context.
clan::Shape::Shape ( )

Constructs a Shape object.

clan::ChainShape::~ChainShape ( )
clan::CircleShape::~CircleShape ( )
clan::EdgeShape::~EdgeShape ( )
virtual clan::PhysicsObject::~PhysicsObject ( )
inlinevirtual
clan::PolygonShape::~PolygonShape ( )
virtual clan::Shape::~Shape ( )
virtual
void clan::ChainShape::create_chain ( const Vec2f vertices,
const int  count 
)

Create a chain with isolated end vertices.

Parameters
vertices= an array of vertices, these are copied
count= the vertex count
void clan::ChainShape::create_loop ( const Vec2f vertices,
const int  count 
)

Create a loop. This automatically adjusts connectivity.

Parameters
vertices= an array of vertices, these are copied
count= the vertex count
void clan::ChainShape::create_loop ( const CollisionOutline outline)
ShapeType clan::Shape::get_shape_type ( ) const
bool clan::Shape::is_null ( ) const
inline

Returns true if this object is invalid.

bool clan::CircleShape::is_null ( ) const
inline

Returns true if this object is invalid.

bool clan::EdgeShape::is_null ( ) const
inline

Returns true if this object is invalid.

bool clan::PolygonShape::is_null ( ) const
inline

Returns true if this object is invalid.

bool clan::ChainShape::is_null ( ) const
inline

Returns true if this object is invalid.

virtual void clan::PhysicsObject::on_collision_begin ( Body body)
pure virtual
virtual void clan::PhysicsObject::on_collision_end ( Body body)
pure virtual
Shape& clan::Shape::operator= ( const Shape copy)

Copy operator.

CircleShape& clan::CircleShape::operator= ( const CircleShape copy)

Copy assignment operator.

EdgeShape& clan::EdgeShape::operator= ( const EdgeShape copy)

Copy assignment operator.

PolygonShape& clan::PolygonShape::operator= ( const PolygonShape copy)

Copy assignment operator.

ChainShape& clan::ChainShape::operator= ( const ChainShape copy)

Copy assignment operator.

void clan::EdgeShape::set ( const Vec2f v1,
const Vec2f v2 
)

Set this as an isolated edge.

void clan::PolygonShape::set_as_box ( float  width,
float  height 
)
void clan::PolygonShape::set_as_box ( float  width,
float  height,
const Vec2f center,
Angle angle 
)
void clan::ChainShape::set_next_vertex ( const Vec2f next_vertex)

Establish connectivity to a vertex that follows the last vertex. Don't call this for loops.

void clan::ChainShape::set_prev_vertex ( const Vec2f prev_vertex)

Establish connectivity to a vertex that precedes the first vertex. Don't call this for loops.

void clan::CircleShape::set_radius ( float  radius)
virtual bool clan::PhysicsObject::should_collide_with ( Body body)
pure virtual
void clan::Shape::throw_if_null ( ) const

Throw an exception if this object is invalid.

void clan::CircleShape::throw_if_null ( ) const

Throw an exception if this object is invalid.

void clan::EdgeShape::throw_if_null ( ) const

Throw an exception if this object is invalid.

void clan::PolygonShape::throw_if_null ( ) const

Throw an exception if this object is invalid.

void clan::ChainShape::throw_if_null ( ) const

Throw an exception if this object is invalid.

Variable Documentation

std::shared_ptr<Shape_Impl> clan::Shape::shape_impl
protected

Friends

friend class FixtureDescription
friend
friend class FixtureDescription
friend
friend class FixtureDescription
friend
friend class FixtureDescription
friend
friend class FixtureDescription
friend