PlayRho  2.0.0
An interactive physics engine & library.
WorldBody.hpp File Reference

Declarations of free functions of World for bodies identified by BodyID. More...

Include dependency graph for WorldBody.hpp:
This graph shows which files directly or indirectly include this file:

Namespaces

 playrho
 
 playrho::d2
 

Functions

void playrho::d2::ApplyAngularImpulse (World &world, BodyID id, AngularMomentum impulse)
 Applies an angular impulse. More...
 
void playrho::d2::ApplyForce (World &world, BodyID id, const Force2 &force, const Length2 &point)
 Apply a force at a world point. More...
 
void playrho::d2::ApplyForceToCenter (World &world, BodyID id, const Force2 &force)
 Applies a force to the center of mass of the given body. More...
 
void playrho::d2::ApplyLinearImpulse (World &world, BodyID id, const Momentum2 &impulse, const Length2 &point)
 Applies an impulse at a point. More...
 
void playrho::d2::ApplyTorque (World &world, BodyID id, Torque torque)
 Applies a torque. More...
 
void playrho::d2::Attach (World &world, BodyID id, const Shape &shape, bool resetMassData=true)
 Creates the shape within the world and then associates it with the validly identified body. More...
 
void playrho::d2::Attach (World &world, BodyID id, ShapeID shapeID, bool resetMassData=true)
 Associates a validly identified shape with the validly identified body. More...
 
BodyCounter playrho::d2::Awaken (World &world)
 Awakens all of the "speedable" bodies in the given world. More...
 
bool playrho::d2::Awaken (World &world, BodyID id)
 Awakens the body if it's asleep and "speedable". More...
 
Acceleration playrho::d2::CalcGravitationalAcceleration (const World &world, BodyID id)
 Calculates the gravitationally associated acceleration for the given body within its world. More...
 
void playrho::d2::ClearForces (World &world)
 Clears forces. More...
 
MassData playrho::d2::ComputeMassData (const World &world, BodyID id)
 Computes the identified body's mass data. More...
 
BodyID playrho::d2::CreateBody (World &world, const BodyConf &def, bool resetMassData=true)
 Creates a rigid body with the given configuration. More...
 
bool playrho::d2::Detach (World &world, BodyID id, bool resetMassData=true)
 Disassociates all of the associated shape from the validly identified body. More...
 
bool playrho::d2::Detach (World &world, BodyID id, ShapeID shapeID, bool resetMassData=true)
 Disassociates a validly identified shape from the validly identified body. More...
 
BodyID playrho::d2::FindClosestBody (const World &world, const Length2 &location)
 Finds body in given world that's closest to the given location. More...
 
Acceleration playrho::d2::GetAcceleration (const World &world, BodyID id)
 Gets the acceleration of the identified body. More...
 
Angle playrho::d2::GetAngle (const World &world, BodyID id)
 Gets the angle of the identified body. More...
 
AngularAcceleration playrho::d2::GetAngularAcceleration (const World &world, BodyID id)
 Gets this body's angular acceleration. More...
 
Frequency playrho::d2::GetAngularDamping (const World &world, BodyID id)
 Gets the angular damping of the body. More...
 
AngularVelocity playrho::d2::GetAngularVelocity (const World &world, BodyID id)
 Gets the angular velocity. More...
 
BodyCounter playrho::d2::GetAwakeCount (const World &world)
 Gets the count of awake bodies in the given world. More...
 
BodyCounter playrho::d2::GetBodyCount (const World &world) noexcept
 Gets the body count in the given world. More...
 
Force2 playrho::d2::GetCentripetalForce (const World &world, BodyID id, const Length2 &axis)
 Gets the centripetal force necessary to put the body into an orbit having the given radius. More...
 
InvMass playrho::d2::GetInvMass (const World &world, BodyID id)
 Gets the inverse total mass of the body. More...
 
InvRotInertia playrho::d2::GetInvRotInertia (const World &world, BodyID id)
 Gets the inverse rotational inertia of the body. More...
 
LinearAcceleration2 playrho::d2::GetLinearAcceleration (const World &world, BodyID id)
 Gets this body's linear acceleration. More...
 
Frequency playrho::d2::GetLinearDamping (const World &world, BodyID id)
 Gets the linear damping of the body. More...
 
LinearVelocity2 playrho::d2::GetLinearVelocity (const World &world, BodyID id)
 Gets the linear velocity of the center of mass of the identified body. More...
 
Length2 playrho::d2::GetLocalCenter (const World &world, BodyID id)
 Gets the local position of the center of mass of the specified body. More...
 
Length2 playrho::d2::GetLocalPoint (const World &world, BodyID id, const Length2 &worldPoint)
 Gets a local point relative to the body's origin given a world point. More...
 
RotInertia playrho::d2::GetLocalRotInertia (const World &world, BodyID id)
 Gets the rotational inertia of the body about the local origin. More...
 
UnitVec playrho::d2::GetLocalVector (const World &world, BodyID body, const UnitVec &uv)
 Convenience function for getting the local vector of the identified body. More...
 
Length2 playrho::d2::GetLocation (const World &world, BodyID id)
 Convenience function for getting just the location of the identified body. More...
 
Mass playrho::d2::GetMass (const World &world, BodyID id)
 Gets the mass of the body. More...
 
MassData playrho::d2::GetMassData (const World &world, BodyID id)
 Gets the mass data of the body. More...
 
Position playrho::d2::GetPosition (const World &world, BodyID id)
 Convenience function for getting the position of the identified body.
 
RotInertia playrho::d2::GetRotInertia (const World &world, BodyID id)
 Gets the rotational inertia of the body. More...
 
ShapeCounter playrho::d2::GetShapeCount (const World &world, BodyID id)
 Gets the count of shapes associated with the identified body. More...
 
Transformation playrho::d2::GetTransformation (const World &world, BodyID id)
 Gets the body's transformation. More...
 
BodyType playrho::d2::GetType (const World &world, BodyID id)
 Gets the type of the identified body. More...
 
Velocity playrho::d2::GetVelocity (const World &world, BodyID id)
 Gets the velocity of the identified body. More...
 
Length2 playrho::d2::GetWorldCenter (const World &world, BodyID id)
 Get the world position of the center of mass of the specified body. More...
 
BodyCounter playrho::d2::GetWorldIndex (const World &, BodyID id) noexcept
 Gets the world index for the given body. More...
 
Length2 playrho::d2::GetWorldPoint (const World &world, BodyID id, const Length2 &localPoint)
 Gets the world coordinates of a point given in coordinates relative to the body's origin. More...
 
UnitVec playrho::d2::GetWorldVector (const World &world, BodyID id, const UnitVec &localVector)
 Convenience function for getting a world vector of the identified body. More...
 
bool playrho::d2::IsAccelerable (const World &world, BodyID id)
 Is identified body "accelerable"? More...
 
bool playrho::d2::IsAwake (const World &world, BodyID id)
 Gets the awake/asleep state of this body. More...
 
bool playrho::d2::IsEnabled (const World &world, BodyID id)
 Gets the enabled/disabled state of the body. More...
 
bool playrho::d2::IsFixedRotation (const World &world, BodyID id)
 Gets whether the body has fixed rotation. More...
 
bool playrho::d2::IsImpenetrable (const World &world, BodyID id)
 Is the body treated like a bullet for continuous collision detection? More...
 
bool playrho::d2::IsMassDataDirty (const World &world, BodyID id)
 Gets whether the body's mass-data is dirty. More...
 
bool playrho::d2::IsSleepingAllowed (const World &world, BodyID id)
 Gets whether the identified body is allowed to sleep. More...
 
bool playrho::d2::IsSpeedable (const World &world, BodyID id)
 Is identified body "speedable". More...
 
void playrho::d2::ResetMassData (World &world, BodyID id)
 Resets the mass data properties. More...
 
void playrho::d2::RotateAboutLocalPoint (World &world, BodyID id, Angle amount, const Length2 &localPoint)
 Rotates a body a given amount around a point in body local coordinates. More...
 
void playrho::d2::RotateAboutWorldPoint (World &world, BodyID id, Angle amount, const Length2 &worldPoint)
 Rotates a body a given amount around a point in world coordinates. More...
 
void playrho::d2::SetAcceleration (World &world, BodyID id, AngularAcceleration value)
 Sets the rotational accelerations on the body. More...
 
void playrho::d2::SetAcceleration (World &world, BodyID id, const Acceleration &value)
 Sets the accelerations on the given body. More...
 
void playrho::d2::SetAcceleration (World &world, BodyID id, const LinearAcceleration2 &linear, AngularAcceleration angular)
 Sets the linear and rotational accelerations on the body. More...
 
void playrho::d2::SetAcceleration (World &world, BodyID id, const LinearAcceleration2 &value)
 Sets the linear accelerations on the body. More...
 
void playrho::d2::SetAccelerations (World &world, const Acceleration &acceleration)
 Sets the accelerations of all the world's bodies to the given value. More...
 
void playrho::d2::SetAccelerations (World &world, const LinearAcceleration2 &acceleration)
 Sets the accelerations of all the world's bodies to the given value. More...
 
void playrho::d2::SetAngle (World &world, BodyID id, Angle value)
 Sets the body's angular orientation. More...
 
void playrho::d2::SetAngularDamping (World &world, BodyID id, NonNegative< Frequency > angularDamping)
 Sets the angular damping of the body. More...
 
void playrho::d2::SetAwake (World &world, BodyID id)
 Wakes up the identified body. More...
 
void playrho::d2::SetEnabled (World &world, BodyID id, bool value)
 Sets the enabled state of the body. More...
 
void playrho::d2::SetFixedRotation (World &world, BodyID id, bool value)
 Sets this body to have fixed rotation. More...
 
void playrho::d2::SetForce (World &world, BodyID id, const Force2 &force, const Length2 &point)
 Sets the given amount of force at the given point to the given body. More...
 
void playrho::d2::SetImpenetrable (World &world, BodyID id)
 Sets the impenetrable status of the identified body. More...
 
void playrho::d2::SetImpenetrable (World &world, BodyID id, bool value)
 Convenience function that sets/unsets the impenetrable status of the identified body. More...
 
void playrho::d2::SetLinearDamping (World &world, BodyID id, NonNegative< Frequency > linearDamping)
 Sets the linear damping of the body. More...
 
void playrho::d2::SetLocation (World &world, BodyID id, const Length2 &value)
 Sets the body's location. More...
 
void playrho::d2::SetMassData (World &world, BodyID id, const MassData &massData)
 Sets the mass properties to override the mass properties of the fixtures. More...
 
void playrho::d2::SetSleepingAllowed (World &world, BodyID, bool value)
 Sets whether the identified body is allowed to sleep. More...
 
void playrho::d2::SetTorque (World &world, BodyID id, Torque torque)
 Sets the given amount of torque to the given body. More...
 
void playrho::d2::SetTransform (World &world, BodyID id, const Length2 &location, Angle angle)
 Sets the position of the body's origin and rotation. More...
 
void playrho::d2::SetTransformation (World &world, BodyID id, const Transformation &value)
 Sets the transformation of the body. More...
 
void playrho::d2::SetType (World &world, BodyID id, BodyType value, bool resetMassData=true)
 Sets the type of the given body. More...
 
void playrho::d2::SetVelocity (World &world, BodyID id, AngularVelocity value)
 Sets the velocity of the identified body. More...
 
void playrho::d2::SetVelocity (World &world, BodyID id, const LinearVelocity2 &value)
 Sets the velocity of the identified body. More...
 
void playrho::d2::SetVelocity (World &world, BodyID id, const Velocity &value)
 Sets the body's velocity (linear and angular velocity). More...
 
void playrho::d2::UnsetAwake (World &world, BodyID id)
 Sleeps the identified body. More...
 
void playrho::d2::UnsetImpenetrable (World &world, BodyID id)
 Unsets the impenetrable status of the identified body. More...
 

Detailed Description

Declarations of free functions of World for bodies identified by BodyID.

This is a collection of non-member non-friend functions - also called "free" functions - that are related to bodies within an instance of a World. Many are just "wrappers" to similarly named member functions but some are additional functionality built on those member functions. A benefit to using free functions that are now just wrappers, is that of helping to isolate your code from future changes that might occur to the underlying World member functions. Free functions in this sense are "cheap" abstractions. While using these incurs extra run-time overhead when compiled without any compiler optimizations enabled, enabling optimizations should entirely eliminate that overhead.

Note
The four basic categories of these functions are "CRUD": create, read, update, and delete.
See also
World, BodyID.
https://en.wikipedia.org/wiki/Create,_read,_update_and_delete.