JSim 2026.06.01-p(1)
Loading...
Searching...
No Matches
spring_force.hpp
Go to the documentation of this file.
1// Copyright (c) JSim contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the LGPLv3 license file in the root directory of this project.
4
5#pragma once
6
9
10namespace frcsim {
11
12class RigidBody;
13
18public:
27 SpringForce(RigidBody* otherBody, const Vector3& localConnectionPoint, const Vector3& otherConnectionPoint, double springConstant, double restLength);
28
29 virtual ~SpringForce() = default;
30
35 void UpdateForce(double duration) override;
36
37private:
38 RigidBody* m_otherBody;
39 Vector3 m_localConnectionPoint;
40 Vector3 m_otherConnectionPoint;
41 double m_springConstant;
42 double m_restLength;
43};
44
45inline SpringForce::SpringForce(RigidBody* otherBody, const Vector3& localConnectionPoint, const Vector3& otherConnectionPoint, double springConstant, double restLength)
46 : m_otherBody(otherBody), m_localConnectionPoint(localConnectionPoint), m_otherConnectionPoint(otherConnectionPoint), m_springConstant(springConstant), m_restLength(restLength) {}
47
48inline void SpringForce::UpdateForce(double duration) {
49 // Implementation placeholder
50}
51
52} // namespace frcsim
Interface for force laws used by the rigid-body integrator.
Definition force_generator.hpp:22
Simulated rigid body with translational/angular dynamics and optional aero metadata.
Definition rigid_body.hpp:44
void UpdateForce(double duration) override
Applies spring force to registered objects.
Definition spring_force.hpp:48
SpringForce(RigidBody *otherBody, const Vector3 &localConnectionPoint, const Vector3 &otherConnectionPoint, double springConstant, double restLength)
Constructs a spring force generator.
Definition spring_force.hpp:45
virtual ~SpringForce()=default
Definition vector.hpp:13
3D vector utility used throughout JSim physics.
Definition vector.hpp:22