Antkeeper  0.0.1
Public Member Functions | List of all members
physics::rigid_body Class Reference

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::fvec3get_position () const noexcept
 Returns the current position of the rigid body. More...
 
constexpr const math::fquatget_orientation () const noexcept
 Returns the current orientation of the rigid body. More...
 
constexpr const math::fvec3get_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::fvec3get_previous_position () const noexcept
 Returns the previous position of the rigid body. More...
 
constexpr const math::fquatget_previous_orientation () const noexcept
 Returns the previous orientation of the rigid body. More...
 
constexpr const math::fvec3get_previous_scale () const noexcept
 Returns the previous scale of the rigid body. More...
 
constexpr const math::fvec3get_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::fvec3get_linear_momentum () const noexcept
 Returns the linear momentum of the rigid body, in kg⋅m/s. More...
 
constexpr const math::fvec3get_angular_momentum () const noexcept
 Returns the angular momentum of the rigid body, in kg⋅m^2⋅s^-1. More...
 
constexpr const math::fvec3get_linear_velocity () const noexcept
 Returns the linear velocity of the rigid body, in m/s. More...
 
constexpr const math::fvec3get_angular_velocity () const noexcept
 Returns the angular velocity of the rigid body, in rad/s. More...
 
constexpr const math::fvec3get_applied_force () const noexcept
 Returns the total pre-integrated force, in N. More...
 
constexpr const math::fvec3get_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...
 

Detailed Description

Rigid body.

Definition at line 34 of file rigid-body.hpp.

Member Function Documentation

◆ apply_central_force()

constexpr void physics::rigid_body::apply_central_force ( const math::fvec3 force)
inlineconstexprnoexcept

Applies a force at the center of mass of the rigid body.

Parameters
forceForce to apply, in N.

Definition at line 404 of file rigid-body.hpp.

◆ apply_central_impulse()

constexpr void physics::rigid_body::apply_central_impulse ( const math::fvec3 impulse)
inlineconstexprnoexcept

Applies an impulse at the center of mass of the rigid body.

Parameters
impulseImpulse to apply, in N⋅s.

Definition at line 440 of file rigid-body.hpp.

◆ apply_force()

constexpr void physics::rigid_body::apply_force ( const math::fvec3 force,
const math::fvec3 radius 
)
inlineconstexprnoexcept

Applies a force at a point on the rigid body.

Parameters
forceForce to apply, in N.
radiusRadius 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.

◆ apply_impulse()

constexpr void physics::rigid_body::apply_impulse ( const math::fvec3 impulse,
const math::fvec3 radius 
)
inlineconstexprnoexcept

Applies an impulse at a point on the rigid body.

Parameters
impulseImpulse to apply, in N⋅s.
radiusRadius 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.

◆ apply_torque()

constexpr void physics::rigid_body::apply_torque ( const math::fvec3 torque)
inlineconstexprnoexcept

Applies a torque to the rigid body.

Parameters
torqueTorque to apply.

Definition at line 414 of file rigid-body.hpp.

◆ apply_torque_impulse()

constexpr void physics::rigid_body::apply_torque_impulse ( const math::fvec3 torque)
inlineconstexprnoexcept

Applies a torque impulse to the rigid body.

Parameters
torqueTorque impulse to apply.

Definition at line 453 of file rigid-body.hpp.

◆ clear_applied_forces()

constexpr void physics::rigid_body::clear_applied_forces ( )
inlineconstexprnoexcept

Clears all pre-integrated forces.

Definition at line 462 of file rigid-body.hpp.

◆ get_angular_damping()

constexpr float physics::rigid_body::get_angular_damping ( ) const
inlineconstexprnoexcept

Returns the angular damping factor of the rigid body.

Definition at line 320 of file rigid-body.hpp.

◆ get_angular_momentum()

constexpr const math::fvec3& physics::rigid_body::get_angular_momentum ( ) const
inlineconstexprnoexcept

Returns the angular momentum of the rigid body, in kg⋅m^2⋅s^-1.

Definition at line 338 of file rigid-body.hpp.

◆ get_angular_velocity()

constexpr const math::fvec3& physics::rigid_body::get_angular_velocity ( ) const
inlineconstexprnoexcept

Returns the angular velocity of the rigid body, in rad/s.

Definition at line 350 of file rigid-body.hpp.

◆ get_applied_force()

constexpr const math::fvec3& physics::rigid_body::get_applied_force ( ) const
inlineconstexprnoexcept

Returns the total pre-integrated force, in N.

Definition at line 356 of file rigid-body.hpp.

◆ get_applied_torque()

constexpr const math::fvec3& physics::rigid_body::get_applied_torque ( ) const
inlineconstexprnoexcept

Returns the total pre-integrated torque, in N⋅m.

Definition at line 362 of file rigid-body.hpp.

◆ get_center_of_mass()

constexpr const math::fvec3& physics::rigid_body::get_center_of_mass ( ) const
inlineconstexprnoexcept

Returns the center of mass of the rigid body.

Definition at line 284 of file rigid-body.hpp.

◆ get_collider()

constexpr const std::shared_ptr<collider>& physics::rigid_body::get_collider ( ) const
inlineconstexprnoexcept

Returns the collider of the rigid body.

Definition at line 326 of file rigid-body.hpp.

◆ get_inertia()

constexpr float physics::rigid_body::get_inertia ( ) const
inlineconstexprnoexcept

Returns the moment of inertia of the rigid body, in kg⋅m^2.

Definition at line 302 of file rigid-body.hpp.

◆ get_inverse_inertia()

constexpr float physics::rigid_body::get_inverse_inertia ( ) const
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.

◆ get_inverse_mass()

constexpr float physics::rigid_body::get_inverse_mass ( ) const
inlineconstexprnoexcept

Returns the inverse mass of the rigid body, in kg^-1.

Definition at line 296 of file rigid-body.hpp.

◆ get_linear_damping()

constexpr float physics::rigid_body::get_linear_damping ( ) const
inlineconstexprnoexcept

Returns the linear damping factor of the rigid body.

Definition at line 314 of file rigid-body.hpp.

◆ get_linear_momentum()

constexpr const math::fvec3& physics::rigid_body::get_linear_momentum ( ) const
inlineconstexprnoexcept

Returns the linear momentum of the rigid body, in kg⋅m/s.

Definition at line 332 of file rigid-body.hpp.

◆ get_linear_velocity()

constexpr const math::fvec3& physics::rigid_body::get_linear_velocity ( ) const
inlineconstexprnoexcept

Returns the linear velocity of the rigid body, in m/s.

Definition at line 344 of file rigid-body.hpp.

◆ get_mass()

constexpr float physics::rigid_body::get_mass ( ) const
inlineconstexprnoexcept

Returns the mass of the rigid body, in kg.

Definition at line 290 of file rigid-body.hpp.

◆ get_orientation()

constexpr const math::fquat& physics::rigid_body::get_orientation ( ) const
inlineconstexprnoexcept

Returns the current orientation of the rigid body.

Definition at line 248 of file rigid-body.hpp.

◆ get_point_velocity()

constexpr math::fvec3 physics::rigid_body::get_point_velocity ( const math::fvec3 radius) const
inlineconstexprnoexcept

Calculates the total velocity at a point on the rigid body.

Parameters
radiusRadius vector from the center of mass to the point at which the velocity should be calculated.
Returns
Point velocity.

Definition at line 374 of file rigid-body.hpp.

◆ get_position()

constexpr const math::fvec3& physics::rigid_body::get_position ( ) const
inlineconstexprnoexcept

Returns the current position of the rigid body.

Definition at line 242 of file rigid-body.hpp.

◆ get_previous_orientation()

constexpr const math::fquat& physics::rigid_body::get_previous_orientation ( ) const
inlineconstexprnoexcept

Returns the previous orientation of the rigid body.

Definition at line 272 of file rigid-body.hpp.

◆ get_previous_position()

constexpr const math::fvec3& physics::rigid_body::get_previous_position ( ) const
inlineconstexprnoexcept

Returns the previous position of the rigid body.

Definition at line 266 of file rigid-body.hpp.

◆ get_previous_scale()

constexpr const math::fvec3& physics::rigid_body::get_previous_scale ( ) const
inlineconstexprnoexcept

Returns the previous scale of the rigid body.

Definition at line 278 of file rigid-body.hpp.

◆ get_previous_transform()

constexpr const math::transform<float>& physics::rigid_body::get_previous_transform ( ) const
inlineconstexprnoexcept

Returns the transformation representing the previous state of the rigid body.

Definition at line 260 of file rigid-body.hpp.

◆ get_scale()

constexpr const math::fvec3& physics::rigid_body::get_scale ( ) const
inlineconstexprnoexcept

Returns the current scale of the rigid body.

Definition at line 254 of file rigid-body.hpp.

◆ get_transform()

constexpr const math::transform<float>& physics::rigid_body::get_transform ( ) const
inlineconstexprnoexcept

Returns the transformation representing the current state of the rigid body.

Definition at line 236 of file rigid-body.hpp.

◆ integrate()

void physics::rigid_body::integrate ( float  dt)
inlinenoexcept

Integrates forces and velocities.

Parameters
dtTimestep, in seconds.

Definition at line 487 of file rigid-body.hpp.

◆ integrate_forces()

void physics::rigid_body::integrate_forces ( float  dt)
noexcept

Integrates forces, updating the momentums and velocities of the rigid body.

Parameters
dtTimestep, in seconds.

Definition at line 26 of file rigid-body.cpp.

◆ integrate_velocities()

void physics::rigid_body::integrate_velocities ( float  dt)
noexcept

Integrates velocities, updating the center of mass and orientation of the rigid body.

Parameters
dtTimestep, in seconds.

Definition at line 45 of file rigid-body.cpp.

◆ interpolate()

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.

Parameters
alphaState interpolation factor.
Returns
Interpolated transformation.

Definition at line 58 of file rigid-body.cpp.

◆ is_static()

constexpr bool physics::rigid_body::is_static ( ) const
inlineconstexprnoexcept

Returns true if the rigid body is static, false otherwise.

Definition at line 382 of file rigid-body.hpp.

◆ set_angular_damping()

constexpr void physics::rigid_body::set_angular_damping ( float  damping)
inlineconstexprnoexcept

Sets the angular damping factor of the rigid body.

Parameters
dampingAngular damping factor.

Definition at line 186 of file rigid-body.hpp.

◆ set_angular_momentum()

constexpr void physics::rigid_body::set_angular_momentum ( const math::fvec3 momentum)
inlineconstexprnoexcept

Sets the angular momentum of the rigid body.

Parameters
momentumAngular momentum, in kg⋅m^2⋅s^-1.

Definition at line 207 of file rigid-body.hpp.

◆ set_angular_velocity()

constexpr void physics::rigid_body::set_angular_velocity ( const math::fvec3 velocity)
inlineconstexprnoexcept

Sets the angular velocity of the rigid body.

Parameters
velocityAngular velocity, rad/s.

Definition at line 229 of file rigid-body.hpp.

◆ set_center_of_mass()

constexpr void physics::rigid_body::set_center_of_mass ( const math::fvec3 point)
inlineconstexprnoexcept

Sets the center of mass of the rigid body.

Parameters
pointWorld-space center of mass.

Definition at line 134 of file rigid-body.hpp.

◆ set_collider()

void physics::rigid_body::set_collider ( std::shared_ptr< collider collider)
inlinenoexcept

Sets the collider of the rigid body.

Parameters
colliderShared pointer to a collider.

Definition at line 166 of file rigid-body.hpp.

◆ set_inertia()

constexpr void physics::rigid_body::set_inertia ( float  inertia)
inlineconstexprnoexcept

Sets the moment of inertia of the rigid body.

Parameters
inertiaMoment of inertia, in kg⋅m^2.

Definition at line 155 of file rigid-body.hpp.

◆ set_linear_damping()

constexpr void physics::rigid_body::set_linear_damping ( float  damping)
inlineconstexprnoexcept

Sets the linear damping factor of the rigid body.

Parameters
dampingLinear damping factor.

Definition at line 176 of file rigid-body.hpp.

◆ set_linear_momentum()

constexpr void physics::rigid_body::set_linear_momentum ( const math::fvec3 momentum)
inlineconstexprnoexcept

Sets the linear momentum of the rigid body.

Parameters
momentumLinear momentum, in kg⋅m/s.

Definition at line 196 of file rigid-body.hpp.

◆ set_linear_velocity()

constexpr void physics::rigid_body::set_linear_velocity ( const math::fvec3 velocity)
inlineconstexprnoexcept

Sets the linear velocity of the rigid body.

Parameters
velocityLinear velocity, in m/s.

Definition at line 218 of file rigid-body.hpp.

◆ set_mass()

constexpr void physics::rigid_body::set_mass ( float  mass)
inlineconstexprnoexcept

Sets mass of the rigid body.

Parameters
massMass, in kg.

Definition at line 144 of file rigid-body.hpp.

◆ set_orientation()

constexpr void physics::rigid_body::set_orientation ( const math::fquat orientation)
inlineconstexprnoexcept

Sets the current orientation of the rigid body.

Parameters
orientationOrientation of the rigid body.

Definition at line 62 of file rigid-body.hpp.

◆ set_position()

constexpr void physics::rigid_body::set_position ( const math::fvec3 position)
inlineconstexprnoexcept

Sets the current position of the rigid body.

Parameters
positionPosition of the rigid body.

Definition at line 52 of file rigid-body.hpp.

◆ set_previous_orientation()

constexpr void physics::rigid_body::set_previous_orientation ( const math::fquat orientation)
inlineconstexprnoexcept

Sets the previous orientation of the rigid body.

Parameters
orientationOrientation of the rigid body.

Definition at line 108 of file rigid-body.hpp.

◆ set_previous_position()

constexpr void physics::rigid_body::set_previous_position ( const math::fvec3 position)
inlineconstexprnoexcept

Sets the previous position of the rigid body.

Parameters
positionPosition of the rigid body.

Definition at line 98 of file rigid-body.hpp.

◆ set_previous_scale() [1/2]

constexpr void physics::rigid_body::set_previous_scale ( const math::fvec3 scale)
inlineconstexprnoexcept

Sets the previous scale of the rigid body.

Parameters
scaleScale of the rigid body.

Definition at line 119 of file rigid-body.hpp.

◆ set_previous_scale() [2/2]

constexpr void physics::rigid_body::set_previous_scale ( float  scale)
inlineconstexprnoexcept

Sets the previous scale of the rigid body.

Parameters
scaleScale of the rigid body.

Definition at line 123 of file rigid-body.hpp.

◆ set_previous_transform()

constexpr void physics::rigid_body::set_previous_transform ( const math::transform< float > &  transform)
inlineconstexprnoexcept

Sets the transformation representing the previous state of the rigid body.

Parameters
transformTransformation representing the previous state of the rigid body.

Definition at line 88 of file rigid-body.hpp.

◆ set_scale() [1/2]

constexpr void physics::rigid_body::set_scale ( const math::fvec3 scale)
inlineconstexprnoexcept

Sets the current scale of the rigid body.

Parameters
scaleScale of the rigid body.

Definition at line 73 of file rigid-body.hpp.

◆ set_scale() [2/2]

constexpr void physics::rigid_body::set_scale ( float  scale)
inlineconstexprnoexcept

Sets the current scale of the rigid body.

Parameters
scaleScale of the rigid body.

Definition at line 77 of file rigid-body.hpp.

◆ set_transform()

constexpr void physics::rigid_body::set_transform ( const math::transform< float > &  transform)
inlineconstexprnoexcept

Sets the transformation representing the current state of the rigid body.

Parameters
transformTransformation representing the current state of the rigid body.

Definition at line 42 of file rigid-body.hpp.


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