JSim 2026.06.01-p(1)
Loading...
Searching...
No Matches
frcsim::SpringForce Class Reference

Applies proportional restorative force based on Hooke's Law. More...

#include <spring_force.hpp>

Inheritance diagram for frcsim::SpringForce:
frcsim::ForceGenerator

Public Member Functions

 SpringForce (RigidBody *otherBody, const Vector3 &localConnectionPoint, const Vector3 &otherConnectionPoint, double springConstant, double restLength)
 Constructs a spring force generator.
virtual ~SpringForce ()=default
void UpdateForce (double duration) override
 Applies spring force to registered objects.
Public Member Functions inherited from frcsim::ForceGenerator
virtual ~ForceGenerator ()=default
virtual void apply (RigidBody &body, double dt_s) const =0

Detailed Description

Applies proportional restorative force based on Hooke's Law.

Constructor & Destructor Documentation

◆ SpringForce()

frcsim::SpringForce::SpringForce ( RigidBody * otherBody,
const Vector3 & localConnectionPoint,
const Vector3 & otherConnectionPoint,
double springConstant,
double restLength )
inline

Constructs a spring force generator.

Parameters
otherBodyThe body this spring is attached to at the other end.
localConnectionPointLocal position of the connection point on the object.
otherConnectionPointLocal position of the connection point on the other body.
springConstantThe stiffness (k).
restLengthThe natural resting length.

◆ ~SpringForce()

virtual frcsim::SpringForce::~SpringForce ( )
virtualdefault

Member Function Documentation

◆ UpdateForce()

void frcsim::SpringForce::UpdateForce ( double duration)
inlineoverride

Applies spring force to registered objects.

Parameters
durationTimestep length.

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