Flatland
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
flatland_server::Joint Class Reference

#include <joint.h>

Collaboration diagram for flatland_server::Joint:
Collaboration graph
[legend]

Public Member Functions

 Joint (b2World *physics_world, Model *model, const std::string &name, const Color &color, const b2JointDef &joint_def)
 Constructor for the joint. More...
 
 Joint (const Joint &)=delete
 Disallow copying of joints, problematic for constructors and destructors.
 
Jointoperator= (const Joint &)=delete
 
void DebugOutput () const
 logs the debugging information for the joint
 
ModelGetModel ()
 
const std::string & GetName () const
 
const ColorGetColor () const
 
void SetColor (const Color &color)
 
b2Joint * GetPhysicsJoint ()
 
b2World * GetphysicsWorld ()
 

Static Public Member Functions

static JointMakeJoint (b2World *physics_world, Model *model, YamlReader &joint_reader)
 Creates a joint for the given params, throws exceptions upon failure. More...
 
static JointMakeRevoluteJoint (b2World *physics_world, Model *model, YamlReader &joint_reader, const std::string &name, const Color &color, b2Body *body_A, b2Vec2 anchor_A, b2Body *body_B, b2Vec2 anchor_B, bool collide_connected)
 Creates a revolute joint for the given params, throws exceptions upon failure. More...
 
static JointMakeWeldJoint (b2World *physics_world, Model *model, YamlReader &joint_reader, const std::string &name, const Color &color, b2Body *body_A, b2Vec2 anchor_A, b2Body *body_B, b2Vec2 anchor_B, bool collide_connected)
 Creates a weld joint for the given params, throws exceptions upon failure. More...
 

Public Attributes

Modelmodel_
 Model the joint belongs to.
 
std::string name_
 Name of the joint.
 
b2World * physics_world_
 Box2D physics world.
 
Color color_
 Color for visualization.
 
b2Joint * physics_joint_
 Box2D physics joint.
 

Detailed Description

This class defines a joint in the simulation world. It wraps around the Box2D physics joints providing extra data and useful methods

Constructor & Destructor Documentation

flatland_server::Joint::Joint ( b2World *  physics_world,
Model model,
const std::string &  name,
const Color color,
const b2JointDef &  joint_def 
)

Constructor for the joint.

Parameters
[in]physics_worldBox2D physics world
[in]modelModel the joint belongs to
[in]nameName of the joint
[in]colorColor to visualize the joint
[in]joint_defBox2D joint definition

Member Function Documentation

const Color & flatland_server::Joint::GetColor ( ) const
Returns
Color of the joint for visualization
Model * flatland_server::Joint::GetModel ( )
Returns
Pointer to the model that contains the joint
const std::string & flatland_server::Joint::GetName ( ) const
Returns
Name of the the joint
b2Joint * flatland_server::Joint::GetPhysicsJoint ( )
Returns
Get pointer to the Box2D physics joint
b2World * flatland_server::Joint::GetphysicsWorld ( )
Returns
Get pointer of the Box2D physics world
Joint * flatland_server::Joint::MakeJoint ( b2World *  physics_world,
Model model,
YamlReader joint_reader 
)
static

Creates a joint for the given params, throws exceptions upon failure.

Parameters
[in]physics_worldBox2D physics world
[in]modelModel the joint belongs to
[in]joint_readerYAML reader for node that contains joint information
Returns
A new joint as defined by the input data
Joint * flatland_server::Joint::MakeRevoluteJoint ( b2World *  physics_world,
Model model,
YamlReader joint_reader,
const std::string &  name,
const Color color,
b2Body *  body_A,
b2Vec2  anchor_A,
b2Body *  body_B,
b2Vec2  anchor_B,
bool  collide_connected 
)
static

Creates a revolute joint for the given params, throws exceptions upon failure.

Parameters
[in]physics_worldBox2D physics world
[in]modelModel the joint belongs to
[in]joint_readerYAML reader for node that contains joint information
[in]nameName of the joint
[in]colorColor to visualize the joint
[in]body_Apointer to the first body
[in]anchor_Banchor point on the first body
[in]body_Bpointer to the second body
[in]anchor_Banchor point on the second body
[in]collide_connectedShould two bodies connected by this joint collide
Returns
A new revolute joint as defined by the input data
Joint * flatland_server::Joint::MakeWeldJoint ( b2World *  physics_world,
Model model,
YamlReader joint_reader,
const std::string &  name,
const Color color,
b2Body *  body_A,
b2Vec2  anchor_A,
b2Body *  body_B,
b2Vec2  anchor_B,
bool  collide_connected 
)
static

Creates a weld joint for the given params, throws exceptions upon failure.

Parameters
[in]physics_worldBox2D physics world
[in]modelModel the joint belongs to
[in]joint_readerYAML reader for node that contains joint information
[in]nameName of the joint
[in]colorColor to visualize the joint
[in]body_Apointer to the first body
[in]anchor_Banchor point on the first body
[in]body_Bpointer to the second body
[in]anchor_Banchor point on the second body
[in]collide_connectedShould two bodies connected by this joint collide
Returns
A new weld joint as defined by the input data
void flatland_server::Joint::SetColor ( const Color color)
Returns
Color of the joint for visualization

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