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

ChainShapeclan::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

CircleShapeclan::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

EdgeShapeclan::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

PolygonShapeclan::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

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

Implementation

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

Detailed Description

Enumeration Type Documentation

◆ ShapeType

Shape types.

Enumerator
shape_circle 
shape_edge 
shape_polygon 
shape_chain 

Function Documentation

◆ ChainShape() [1/3]

clan::ChainShape::ChainShape ( )

Constructs a null instance.

◆ ChainShape() [2/3]

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

Constructs a Chain Shape.

Parameters
pw= Physics World.

◆ ChainShape() [3/3]

clan::ChainShape::ChainShape ( const PhysicsContext pc)

Constructs a Chain Shape.

Parameters
pc= Physics Context.

◆ CircleShape() [1/3]

clan::CircleShape::CircleShape ( )

Constructs a null instance.

◆ CircleShape() [2/3]

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

Constructs a Circle Shape.

Parameters
pw= Physics World.

◆ CircleShape() [3/3]

clan::CircleShape::CircleShape ( const PhysicsContext pc)

Constructs a Circle Shape.

Parameters
pc= Physics Context

◆ EdgeShape() [1/3]

clan::EdgeShape::EdgeShape ( )

Constructs a null instance.

◆ EdgeShape() [2/3]

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

Constructs an Edge Shape.

Parameters
pw= Physics World.

◆ EdgeShape() [3/3]

clan::EdgeShape::EdgeShape ( const PhysicsContext pc)

Constructs an Edge Shape.

Parameters
pw= Physics World.

◆ PhysicsObject()

clan::PhysicsObject::PhysicsObject ( )
inline

◆ PolygonShape() [1/3]

clan::PolygonShape::PolygonShape ( )

Constructs a null instance.

◆ PolygonShape() [2/3]

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

Constructs a Polygon Shape.

Parameters
pw= Physics World.

◆ PolygonShape() [3/3]

clan::PolygonShape::PolygonShape ( const PhysicsContext pc)

Constructs a Polygon Shape.

Parameters
pc= Physics Context.

◆ Shape()

clan::Shape::Shape ( )

Constructs a Shape object.

◆ ~ChainShape()

clan::ChainShape::~ChainShape ( )

◆ ~CircleShape()

clan::CircleShape::~CircleShape ( )

◆ ~EdgeShape()

clan::EdgeShape::~EdgeShape ( )

◆ ~PhysicsObject()

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

◆ ~PolygonShape()

clan::PolygonShape::~PolygonShape ( )

◆ ~Shape()

virtual clan::Shape::~Shape ( )
virtual

◆ create_chain()

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

◆ create_loop() [1/2]

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

◆ create_loop() [2/2]

void clan::ChainShape::create_loop ( const CollisionOutline outline)

◆ get_shape_type()

ShapeType clan::Shape::get_shape_type ( ) const

◆ is_null() [1/5]

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

Returns true if this object is invalid.

◆ is_null() [2/5]

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

Returns true if this object is invalid.

◆ is_null() [3/5]

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

Returns true if this object is invalid.

◆ is_null() [4/5]

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

Returns true if this object is invalid.

◆ is_null() [5/5]

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

Returns true if this object is invalid.

◆ on_collision_begin()

virtual void clan::PhysicsObject::on_collision_begin ( Body body)
pure virtual

◆ on_collision_end()

virtual void clan::PhysicsObject::on_collision_end ( Body body)
pure virtual

◆ operator=() [1/5]

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

Copy operator.

◆ operator=() [2/5]

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

Copy assignment operator.

◆ operator=() [3/5]

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

Copy assignment operator.

◆ operator=() [4/5]

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

Copy assignment operator.

◆ operator=() [5/5]

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

Copy assignment operator.

◆ set()

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

Set this as an isolated edge.

◆ set_as_box() [1/2]

void clan::PolygonShape::set_as_box ( float  width,
float  height 
)

◆ set_as_box() [2/2]

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

◆ set_next_vertex()

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.

◆ set_prev_vertex()

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.

◆ set_radius()

void clan::CircleShape::set_radius ( float  radius)

◆ should_collide_with()

virtual bool clan::PhysicsObject::should_collide_with ( Body body)
pure virtual

◆ throw_if_null() [1/5]

void clan::Shape::throw_if_null ( ) const

Throw an exception if this object is invalid.

◆ throw_if_null() [2/5]

void clan::CircleShape::throw_if_null ( ) const

Throw an exception if this object is invalid.

◆ throw_if_null() [3/5]

void clan::EdgeShape::throw_if_null ( ) const

Throw an exception if this object is invalid.

◆ throw_if_null() [4/5]

void clan::PolygonShape::throw_if_null ( ) const

Throw an exception if this object is invalid.

◆ throw_if_null() [5/5]

void clan::ChainShape::throw_if_null ( ) const

Throw an exception if this object is invalid.

Variable Documentation

◆ shape_impl

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

Friends

◆ FixtureDescription [1/5]

friend class FixtureDescription
friend

◆ FixtureDescription [2/5]

friend class FixtureDescription
friend

◆ FixtureDescription [3/5]

friend class FixtureDescription
friend

◆ FixtureDescription [4/5]

friend class FixtureDescription
friend

◆ FixtureDescription [5/5]

friend class FixtureDescription
friend