LibreOffice Module slideshow (master) 1
|
Class that manages a single box2D Body. More...
#include <box2dtools.hxx>
Public Member Functions | |
box2DBody (std::shared_ptr< b2Body > pBox2DBody, double fScaleFactor) | |
::basegfx::B2DPoint | getPosition () const |
void | setPosition (const ::basegfx::B2DPoint &rPos) |
Set the position of box2d body. More... | |
void | setPositionByLinearVelocity (const ::basegfx::B2DPoint &rDesiredPos, const double fPassedTime) |
Moves body to the specified position. More... | |
void | setLinearVelocity (const ::basegfx::B2DVector &rVelocity) |
Sets linear velocity of the body. More... | |
void | setAngleByAngularVelocity (const double fDesiredAngle, const double fPassedTime) |
Rotate body to specified angle of rotation. More... | |
void | setAngularVelocity (const double fAngularVelocity) |
Sets angular velocity of the body. More... | |
void | setCollision (const bool bCanCollide) |
Sets whether the body have collisions or not. More... | |
double | getAngle () const |
void | setAngle (const double fAngle) |
Set angle of the box2d body. More... | |
void | setDensityAndRestitution (const double fDensity, const double fRestitution) |
Set density and restitution of the box2d body. More... | |
void | setRestitution (const double fRestitution) |
Set restitution of the box2d body. More... | |
void | setType (box2DBodyType eType) |
Set type of the body. More... | |
box2DBodyType | getType () const |
Private Attributes | |
std::shared_ptr< b2Body > | mpBox2DBody |
Pointer to the body that this class manages. More... | |
double | mfScaleFactor |
Scale factor for conversions between LO user space coordinates to Box2D World coordinates. More... | |
Class that manages a single box2D Body.
Definition at line 365 of file box2dtools.hxx.
box2d::utils::box2DBody::box2DBody | ( | std::shared_ptr< b2Body > | pBox2DBody, |
double | fScaleFactor | ||
) |
Definition at line 775 of file box2dtools.cxx.
double box2d::utils::box2DBody::getAngle | ( | ) | const |
Definition at line 853 of file box2dtools.cxx.
References mpBox2DBody.
Referenced by setAngleByAngularVelocity().
basegfx::B2DPoint box2d::utils::box2DBody::getPosition | ( | ) | const |
Definition at line 781 of file box2dtools.cxx.
References mfScaleFactor, and mpBox2DBody.
Referenced by setPositionByLinearVelocity().
box2DBodyType box2d::utils::box2DBody::getType | ( | ) | const |
void box2d::utils::box2DBody::setAngle | ( | const double | fAngle | ) |
Set angle of the box2d body.
fAngle | Angle in degrees |
Definition at line 859 of file box2dtools.cxx.
References mpBox2DBody.
void box2d::utils::box2DBody::setAngleByAngularVelocity | ( | const double | fDesiredAngle, |
const double | fPassedTime | ||
) |
Rotate body to specified angle of rotation.
Rotates body to specified rotation as if the body had angular velocity to reach that state in given time frame
fDesiredAngle | Rotation angle in degrees to arrive in the time frame |
fPassedTime | Amount of time for the movement to take place |
Definition at line 809 of file box2dtools.cxx.
References getAngle(), mpBox2DBody, and setAngularVelocity().
void box2d::utils::box2DBody::setAngularVelocity | ( | const double | fAngularVelocity | ) |
Sets angular velocity of the body.
fAngularVelocity | Angular velocity in degrees per second |
Definition at line 833 of file box2dtools.cxx.
References basegfx::deg2rad(), and mpBox2DBody.
Referenced by setAngleByAngularVelocity().
void box2d::utils::box2DBody::setCollision | ( | const bool | bCanCollide | ) |
Sets whether the body have collisions or not.
Definition at line 839 of file box2dtools.cxx.
References mpBox2DBody.
void box2d::utils::box2DBody::setDensityAndRestitution | ( | const double | fDensity, |
const double | fRestitution | ||
) |
Set density and restitution of the box2d body.
fDensity | Density in kg/m^2 |
fRestitution | Restitution (elasticity) coefficient, usually in the range [0,1] |
Definition at line 864 of file box2dtools.cxx.
References mpBox2DBody.
void box2d::utils::box2DBody::setLinearVelocity | ( | const ::basegfx::B2DVector & | rVelocity | ) |
Sets linear velocity of the body.
rVelocity | Velocity vector in LO user space coordinates |
Definition at line 826 of file box2dtools.cxx.
References mfScaleFactor, and mpBox2DBody.
Referenced by setPositionByLinearVelocity().
void box2d::utils::box2DBody::setPosition | ( | const ::basegfx::B2DPoint & | rPos | ) |
Set the position of box2d body.
rPos | Position in LO user space coordinates |
Definition at line 789 of file box2dtools.cxx.
References mfScaleFactor, and mpBox2DBody.
void box2d::utils::box2DBody::setPositionByLinearVelocity | ( | const ::basegfx::B2DPoint & | rDesiredPos, |
const double | fPassedTime | ||
) |
Moves body to the specified position.
Moves body to the specified position by setting velocity of the body so that it reaches to rDesiredPos in given time fram
rDesiredPos | Position to arrive in the time frame |
fPassedTime | Amount of time for the movement to take place |
Definition at line 795 of file box2dtools.cxx.
References getPosition(), mpBox2DBody, and setLinearVelocity().
void box2d::utils::box2DBody::setRestitution | ( | const double | fRestitution | ) |
Set restitution of the box2d body.
fRestitution | Restitution (elasticity) coefficient, usually in the range [0,1] |
Definition at line 877 of file box2dtools.cxx.
References mpBox2DBody.
void box2d::utils::box2DBody::setType | ( | box2DBodyType | eType | ) |
Set type of the body.
Definition at line 886 of file box2dtools.cxx.
References eType, and mpBox2DBody.
|
private |
Scale factor for conversions between LO user space coordinates to Box2D World coordinates.
Definition at line 371 of file box2dtools.hxx.
Referenced by getPosition(), setLinearVelocity(), and setPosition().
|
private |
Pointer to the body that this class manages.
Definition at line 369 of file box2dtools.hxx.
Referenced by getAngle(), getPosition(), getType(), setAngle(), setAngleByAngularVelocity(), setAngularVelocity(), setCollision(), setDensityAndRestitution(), setLinearVelocity(), setPosition(), setPositionByLinearVelocity(), setRestitution(), and setType().