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

Spring constraint. More...

#include <spring-constraint.hpp>

Inheritance diagram for physics::spring_constraint:
physics::constraint

Public Member Functions

void solve (float dt) override
 Solves the constraint. More...
 
constexpr void attach_a (rigid_body &body_a, const math::fvec3 &point_a) noexcept
 Attaches the spring to body a. More...
 
constexpr void attach_b (rigid_body &body_b, const math::fvec3 &point_b) noexcept
 Attaches the spring to body b. More...
 
constexpr void detach_a () noexcept
 Detaches the spring from body a. More...
 
constexpr void detach_b () noexcept
 Detaches the spring from body b. More...
 
constexpr void detach () noexcept
 Detaches the spring from bodies a and b. More...
 
constexpr void set_resting_length (float length) noexcept
 Sets the resting length of the spring. More...
 
constexpr void set_stiffness (float stiffness) noexcept
 Sets the stiffness constant of the spring. More...
 
constexpr void set_damping (float damping) noexcept
 Sets the damping constant of the spring. More...
 
constexpr rigid_bodyget_body_a () const noexcept
 Returns the body to which the spring is attached at point a. More...
 
constexpr rigid_bodyget_body_b () const noexcept
 Returns the body to which the spring is attached at point b. More...
 
constexpr const math::fvec3get_point_a () const noexcept
 Returns the point at which the spring is attached to body a, in body-space. More...
 
constexpr const math::fvec3get_point_b () const noexcept
 Returns the point at which the spring is attached to body b, in body-space. More...
 
constexpr float get_resting_length () const noexcept
 Returns the resting length of the spring, in meters. More...
 
constexpr float get_stiffness () const noexcept
 Returns the stiffness constant of the spring. More...
 
constexpr float get_damping () const noexcept
 Returns the damping constant of the spring. More...
 

Detailed Description

Spring constraint.

Definition at line 32 of file spring-constraint.hpp.

Member Function Documentation

◆ attach_a()

constexpr void physics::spring_constraint::attach_a ( rigid_body body_a,
const math::fvec3 point_a 
)
inlineconstexprnoexcept

Attaches the spring to body a.

Parameters
body_aBody to which the spring should be attached.
point_aPoint on body a, in body-space, at which the spring should be attached.

Definition at line 43 of file spring-constraint.hpp.

◆ attach_b()

constexpr void physics::spring_constraint::attach_b ( rigid_body body_b,
const math::fvec3 point_b 
)
inlineconstexprnoexcept

Attaches the spring to body b.

Parameters
body_bBody to which the spring should be attached.
point_bPoint on body b, in body-space, at which the spring should be attached.

Definition at line 55 of file spring-constraint.hpp.

◆ detach()

constexpr void physics::spring_constraint::detach ( )
inlineconstexprnoexcept

Detaches the spring from bodies a and b.

Definition at line 80 of file spring-constraint.hpp.

◆ detach_a()

constexpr void physics::spring_constraint::detach_a ( )
inlineconstexprnoexcept

Detaches the spring from body a.

Definition at line 64 of file spring-constraint.hpp.

◆ detach_b()

constexpr void physics::spring_constraint::detach_b ( )
inlineconstexprnoexcept

Detaches the spring from body b.

Definition at line 72 of file spring-constraint.hpp.

◆ get_body_a()

constexpr rigid_body* physics::spring_constraint::get_body_a ( ) const
inlineconstexprnoexcept

Returns the body to which the spring is attached at point a.

Definition at line 117 of file spring-constraint.hpp.

◆ get_body_b()

constexpr rigid_body* physics::spring_constraint::get_body_b ( ) const
inlineconstexprnoexcept

Returns the body to which the spring is attached at point b.

Definition at line 123 of file spring-constraint.hpp.

◆ get_damping()

constexpr float physics::spring_constraint::get_damping ( ) const
inlineconstexprnoexcept

Returns the damping constant of the spring.

Definition at line 153 of file spring-constraint.hpp.

◆ get_point_a()

constexpr const math::fvec3& physics::spring_constraint::get_point_a ( ) const
inlineconstexprnoexcept

Returns the point at which the spring is attached to body a, in body-space.

Definition at line 129 of file spring-constraint.hpp.

◆ get_point_b()

constexpr const math::fvec3& physics::spring_constraint::get_point_b ( ) const
inlineconstexprnoexcept

Returns the point at which the spring is attached to body b, in body-space.

Definition at line 135 of file spring-constraint.hpp.

◆ get_resting_length()

constexpr float physics::spring_constraint::get_resting_length ( ) const
inlineconstexprnoexcept

Returns the resting length of the spring, in meters.

Definition at line 141 of file spring-constraint.hpp.

◆ get_stiffness()

constexpr float physics::spring_constraint::get_stiffness ( ) const
inlineconstexprnoexcept

Returns the stiffness constant of the spring.

Definition at line 147 of file spring-constraint.hpp.

◆ set_damping()

constexpr void physics::spring_constraint::set_damping ( float  damping)
inlineconstexprnoexcept

Sets the damping constant of the spring.

Parameters
dampingDamping constant.

Definition at line 111 of file spring-constraint.hpp.

◆ set_resting_length()

constexpr void physics::spring_constraint::set_resting_length ( float  length)
inlineconstexprnoexcept

Sets the resting length of the spring.

Parameters
lengthResting length, in meters.

Definition at line 91 of file spring-constraint.hpp.

◆ set_stiffness()

constexpr void physics::spring_constraint::set_stiffness ( float  stiffness)
inlineconstexprnoexcept

Sets the stiffness constant of the spring.

Parameters
stiffnessStiffness constant.

Definition at line 101 of file spring-constraint.hpp.

◆ solve()

void physics::spring_constraint::solve ( float  dt)
overridevirtual

Solves the constraint.

Parameters
dtTimestep, in seconds.

Implements physics::constraint.

Definition at line 24 of file spring-constraint.cpp.


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