Antkeeper
0.0.1
|
Rigid body. More...
#include <rigid-body.hpp>
Public Member Functions | |
constexpr void | set_transform (const math::transform< float > &transform) noexcept |
Sets the transformation representing the current state of the rigid body. More... | |
constexpr void | set_position (const math::fvec3 &position) noexcept |
Sets the current position of the rigid body. More... | |
constexpr void | set_orientation (const math::fquat &orientation) noexcept |
Sets the current orientation of the rigid body. More... | |
constexpr void | set_previous_transform (const math::transform< float > &transform) noexcept |
Sets the transformation representing the previous state of the rigid body. More... | |
constexpr void | set_previous_position (const math::fvec3 &position) noexcept |
Sets the previous position of the rigid body. More... | |
constexpr void | set_previous_orientation (const math::fquat &orientation) noexcept |
Sets the previous orientation of the rigid body. More... | |
constexpr void | set_center_of_mass (const math::fvec3 &point) noexcept |
Sets the center of mass of the rigid body. More... | |
constexpr void | set_mass (float mass) noexcept |
Sets mass of the rigid body. More... | |
constexpr void | set_inertia (float inertia) noexcept |
Sets the moment of inertia of the rigid body. More... | |
void | set_collider (std::shared_ptr< collider > collider) noexcept |
Sets the collider of the rigid body. More... | |
constexpr void | set_linear_damping (float damping) noexcept |
Sets the linear damping factor of the rigid body. More... | |
constexpr void | set_angular_damping (float damping) noexcept |
Sets the angular damping factor of the rigid body. More... | |
constexpr void | set_linear_momentum (const math::fvec3 &momentum) noexcept |
Sets the linear momentum of the rigid body. More... | |
constexpr void | set_angular_momentum (const math::fvec3 &momentum) noexcept |
Sets the angular momentum of the rigid body. More... | |
constexpr void | set_linear_velocity (const math::fvec3 &velocity) noexcept |
Sets the linear velocity of the rigid body. More... | |
constexpr void | set_angular_velocity (const math::fvec3 &velocity) noexcept |
Sets the angular velocity of the rigid body. More... | |
constexpr const math::transform< float > & | get_transform () const noexcept |
Returns the transformation representing the current state of the rigid body. More... | |
constexpr const math::fvec3 & | get_position () const noexcept |
Returns the current position of the rigid body. More... | |
constexpr const math::fquat & | get_orientation () const noexcept |
Returns the current orientation of the rigid body. More... | |
constexpr const math::fvec3 & | get_scale () const noexcept |
Returns the current scale of the rigid body. More... | |
constexpr const math::transform< float > & | get_previous_transform () const noexcept |
Returns the transformation representing the previous state of the rigid body. More... | |
constexpr const math::fvec3 & | get_previous_position () const noexcept |
Returns the previous position of the rigid body. More... | |
constexpr const math::fquat & | get_previous_orientation () const noexcept |
Returns the previous orientation of the rigid body. More... | |
constexpr const math::fvec3 & | get_previous_scale () const noexcept |
Returns the previous scale of the rigid body. More... | |
constexpr const math::fvec3 & | get_center_of_mass () const noexcept |
Returns the center of mass of the rigid body. More... | |
constexpr float | get_mass () const noexcept |
Returns the mass of the rigid body, in kg. More... | |
constexpr float | get_inverse_mass () const noexcept |
Returns the inverse mass of the rigid body, in kg^-1. More... | |
constexpr float | get_inertia () const noexcept |
Returns the moment of inertia of the rigid body, in kg⋅m^2. More... | |
constexpr float | get_inverse_inertia () const noexcept |
Returns the inverse moment of inertia of the rigid body, in kg⋅m^2^-1. More... | |
constexpr float | get_linear_damping () const noexcept |
Returns the linear damping factor of the rigid body. More... | |
constexpr float | get_angular_damping () const noexcept |
Returns the angular damping factor of the rigid body. More... | |
constexpr const std::shared_ptr< collider > & | get_collider () const noexcept |
Returns the collider of the rigid body. More... | |
constexpr const math::fvec3 & | get_linear_momentum () const noexcept |
Returns the linear momentum of the rigid body, in kg⋅m/s. More... | |
constexpr const math::fvec3 & | get_angular_momentum () const noexcept |
Returns the angular momentum of the rigid body, in kg⋅m^2⋅s^-1. More... | |
constexpr const math::fvec3 & | get_linear_velocity () const noexcept |
Returns the linear velocity of the rigid body, in m/s. More... | |
constexpr const math::fvec3 & | get_angular_velocity () const noexcept |
Returns the angular velocity of the rigid body, in rad/s. More... | |
constexpr const math::fvec3 & | get_applied_force () const noexcept |
Returns the total pre-integrated force, in N. More... | |
constexpr const math::fvec3 & | get_applied_torque () const noexcept |
Returns the total pre-integrated torque, in N⋅m. More... | |
constexpr math::fvec3 | get_point_velocity (const math::fvec3 &radius) const noexcept |
Calculates the total velocity at a point on the rigid body. More... | |
constexpr bool | is_static () const noexcept |
Returns true if the rigid body is static, false otherwise. More... | |
constexpr void | apply_force (const math::fvec3 &force, const math::fvec3 &radius) noexcept |
Applies a force at a point on the rigid body. More... | |
constexpr void | apply_central_force (const math::fvec3 &force) noexcept |
Applies a force at the center of mass of the rigid body. More... | |
constexpr void | apply_torque (const math::fvec3 &torque) noexcept |
Applies a torque to the rigid body. More... | |
constexpr void | apply_impulse (const math::fvec3 &impulse, const math::fvec3 &radius) noexcept |
Applies an impulse at a point on the rigid body. More... | |
constexpr void | apply_central_impulse (const math::fvec3 &impulse) noexcept |
Applies an impulse at the center of mass of the rigid body. More... | |
constexpr void | apply_torque_impulse (const math::fvec3 &torque) noexcept |
Applies a torque impulse to the rigid body. More... | |
constexpr void | clear_applied_forces () noexcept |
Clears all pre-integrated forces. More... | |
void | integrate_forces (float dt) noexcept |
Integrates forces, updating the momentums and velocities of the rigid body. More... | |
void | integrate_velocities (float dt) noexcept |
Integrates velocities, updating the center of mass and orientation of the rigid body. More... | |
void | integrate (float dt) noexcept |
Integrates forces and velocities. More... | |
math::transform< float > | interpolate (float alpha) const |
Returns a transformation representing a state of the rigid body between its current and previous states. More... | |
constexpr void | set_scale (const math::fvec3 &scale) noexcept |
Sets the current scale of the rigid body. More... | |
constexpr void | set_scale (float scale) noexcept |
Sets the current scale of the rigid body. More... | |
constexpr void | set_previous_scale (const math::fvec3 &scale) noexcept |
Sets the previous scale of the rigid body. More... | |
constexpr void | set_previous_scale (float scale) noexcept |
Sets the previous scale of the rigid body. More... | |
Rigid body.
Definition at line 34 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Applies a force at the center of mass of the rigid body.
force | Force to apply, in N. |
Definition at line 404 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Applies an impulse at the center of mass of the rigid body.
impulse | Impulse to apply, in N⋅s. |
Definition at line 440 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Applies a force at a point on the rigid body.
force | Force to apply, in N. |
radius | Radius vector from the center of mass to the point at which the force should be applied. |
Definition at line 393 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Applies an impulse at a point on the rigid body.
impulse | Impulse to apply, in N⋅s. |
radius | Radius vector from the center of mass to the point at which the impulse should be applied. |
Definition at line 425 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Applies a torque to the rigid body.
torque | Torque to apply. |
Definition at line 414 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Applies a torque impulse to the rigid body.
torque | Torque impulse to apply. |
Definition at line 453 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Clears all pre-integrated forces.
Definition at line 462 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Returns the angular damping factor of the rigid body.
Definition at line 320 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Returns the angular momentum of the rigid body, in kg⋅m^2⋅s^-1.
Definition at line 338 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Returns the angular velocity of the rigid body, in rad/s.
Definition at line 350 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Returns the total pre-integrated force, in N.
Definition at line 356 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Returns the total pre-integrated torque, in N⋅m.
Definition at line 362 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Returns the center of mass of the rigid body.
Definition at line 284 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Returns the collider of the rigid body.
Definition at line 326 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Returns the moment of inertia of the rigid body, in kg⋅m^2.
Definition at line 302 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Returns the inverse moment of inertia of the rigid body, in kg⋅m^2^-1.
Definition at line 308 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Returns the inverse mass of the rigid body, in kg^-1.
Definition at line 296 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Returns the linear damping factor of the rigid body.
Definition at line 314 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Returns the linear momentum of the rigid body, in kg⋅m/s.
Definition at line 332 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Returns the linear velocity of the rigid body, in m/s.
Definition at line 344 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Returns the mass of the rigid body, in kg.
Definition at line 290 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Returns the current orientation of the rigid body.
Definition at line 248 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Calculates the total velocity at a point on the rigid body.
radius | Radius vector from the center of mass to the point at which the velocity should be calculated. |
Definition at line 374 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Returns the current position of the rigid body.
Definition at line 242 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Returns the previous orientation of the rigid body.
Definition at line 272 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Returns the previous position of the rigid body.
Definition at line 266 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Returns the previous scale of the rigid body.
Definition at line 278 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Returns the transformation representing the previous state of the rigid body.
Definition at line 260 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Returns the current scale of the rigid body.
Definition at line 254 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Returns the transformation representing the current state of the rigid body.
Definition at line 236 of file rigid-body.hpp.
|
inlinenoexcept |
Integrates forces and velocities.
dt | Timestep, in seconds. |
Definition at line 487 of file rigid-body.hpp.
|
noexcept |
Integrates forces, updating the momentums and velocities of the rigid body.
dt | Timestep, in seconds. |
Definition at line 26 of file rigid-body.cpp.
|
noexcept |
Integrates velocities, updating the center of mass and orientation of the rigid body.
dt | Timestep, in seconds. |
Definition at line 45 of file rigid-body.cpp.
math::transform< float > physics::rigid_body::interpolate | ( | float | alpha | ) | const |
Returns a transformation representing a state of the rigid body between its current and previous states.
alpha | State interpolation factor. |
Definition at line 58 of file rigid-body.cpp.
|
inlineconstexprnoexcept |
Returns true
if the rigid body is static, false
otherwise.
Definition at line 382 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Sets the angular damping factor of the rigid body.
damping | Angular damping factor. |
Definition at line 186 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Sets the angular momentum of the rigid body.
momentum | Angular momentum, in kg⋅m^2⋅s^-1. |
Definition at line 207 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Sets the angular velocity of the rigid body.
velocity | Angular velocity, rad/s. |
Definition at line 229 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Sets the center of mass of the rigid body.
point | World-space center of mass. |
Definition at line 134 of file rigid-body.hpp.
|
inlinenoexcept |
Sets the collider of the rigid body.
collider | Shared pointer to a collider. |
Definition at line 166 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Sets the moment of inertia of the rigid body.
inertia | Moment of inertia, in kg⋅m^2. |
Definition at line 155 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Sets the linear damping factor of the rigid body.
damping | Linear damping factor. |
Definition at line 176 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Sets the linear momentum of the rigid body.
momentum | Linear momentum, in kg⋅m/s. |
Definition at line 196 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Sets the linear velocity of the rigid body.
velocity | Linear velocity, in m/s. |
Definition at line 218 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Sets mass of the rigid body.
mass | Mass, in kg. |
Definition at line 144 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Sets the current orientation of the rigid body.
orientation | Orientation of the rigid body. |
Definition at line 62 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Sets the current position of the rigid body.
position | Position of the rigid body. |
Definition at line 52 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Sets the previous orientation of the rigid body.
orientation | Orientation of the rigid body. |
Definition at line 108 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Sets the previous position of the rigid body.
position | Position of the rigid body. |
Definition at line 98 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Sets the previous scale of the rigid body.
scale | Scale of the rigid body. |
Definition at line 119 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Sets the previous scale of the rigid body.
scale | Scale of the rigid body. |
Definition at line 123 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Sets the transformation representing the previous state of the rigid body.
transform | Transformation representing the previous state of the rigid body. |
Definition at line 88 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Sets the current scale of the rigid body.
scale | Scale of the rigid body. |
Definition at line 73 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Sets the current scale of the rigid body.
scale | Scale of the rigid body. |
Definition at line 77 of file rigid-body.hpp.
|
inlineconstexprnoexcept |
Sets the transformation representing the current state of the rigid body.
transform | Transformation representing the current state of the rigid body. |
Definition at line 42 of file rigid-body.hpp.