16#include "../../Utils/Math/Mathematics.h"
65 float Calculate(
float target,
unsigned long currentMillis);
Simulates the motion of a damped spring.
float currentVelocity
Current velocity of the spring.
float springForce
Force exerted by the spring.
float Calculate(float target, unsigned long currentMillis)
Calculates the spring's position and velocity using a target position and timestamp.
float currentPosition
Current position of the spring.
unsigned long previousMillis
Previous timestamp for time calculations.
float springConstant
Spring constant determining stiffness.
float GetCurrentPosition()
Gets the current position of the spring.
float damping
Damping coefficient.
DampedSpring()
Default constructor initializing a damped spring with default values.
void SetConstants(float springConstant, float damping)
Sets the spring constant and damping coefficient.
float dampingForce
Damping force resisting motion.
float force
Combined force acting on the spring.