Fx2D
A C++20 2D rigid-body physics engine
Loading...
Searching...
No Matches
FxDistanceConstraint Class Reference

#include <Solver.h>

Inheritance diagram for FxDistanceConstraint:
Collaboration diagram for FxDistanceConstraint:

Public Member Functions

 FxDistanceConstraint (const std::shared_ptr< FxEntity > &e1, const std::shared_ptr< FxEntity > &e2, const FxVec2f &anchor1, const FxVec2f &anchor2)
float length () const
FxVec2f anchor1_world () const
FxVec2f anchor2_world () const
void evaluate (float &C, FxVec2f &g1, FxVec2f &g2, float &gth1, float &gth2, bool &active) const override
Public Member Functions inherited from FxConstraint
void set_stiffness (double k)
void setCompliance (double c)
void resolve (double dt)
const std::string & get_name () const
const std::shared_ptr< FxEntity > & get_entity1 () const
const std::shared_ptr< FxEntity > & get_entity2 () const
std::string get_entity1_name () const
std::string get_entity2_name () const
virtual ~FxConstraint ()=default

Public Attributes

float min_length = 0.0f
float max_length = 1.0f
float slop = 0.0f
bool enabled = true

Additional Inherited Members

Protected Attributes inherited from FxConstraint
std::string m_name
double compliance = 1e-7
bool carries_velocity = true
std::shared_ptr< FxEntity > entity1
std::shared_ptr< FxEntity > entity2

Detailed Description

Definition at line 240 of file Solver.h.

Constructor & Destructor Documentation

◆ FxDistanceConstraint()

FxDistanceConstraint::FxDistanceConstraint ( const std::shared_ptr< FxEntity > & e1,
const std::shared_ptr< FxEntity > & e2,
const FxVec2f & anchor1,
const FxVec2f & anchor2 )

Member Function Documentation

◆ anchor1_world()

FxVec2f FxDistanceConstraint::anchor1_world ( ) const

◆ anchor2_world()

FxVec2f FxDistanceConstraint::anchor2_world ( ) const

◆ evaluate()

void FxDistanceConstraint::evaluate ( float & C,
FxVec2f & g1,
FxVec2f & g2,
float & gth1,
float & gth2,
bool & active ) const
overridevirtual

Implements FxConstraint.

◆ length()

float FxDistanceConstraint::length ( ) const

Member Data Documentation

◆ enabled

bool FxDistanceConstraint::enabled = true

Definition at line 249 of file Solver.h.

◆ max_length

float FxDistanceConstraint::max_length = 1.0f

Definition at line 247 of file Solver.h.

◆ min_length

float FxDistanceConstraint::min_length = 0.0f

Definition at line 246 of file Solver.h.

◆ slop

float FxDistanceConstraint::slop = 0.0f

Definition at line 248 of file Solver.h.


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