![]() |
Ball and Spring Toy
Ian Parberry's "Introduction to Game Physics"
|
The spring. More...
#include <Spring.h>
Public Member Functions | |
CSpring (eSprite, CPoint *, CPoint *, float) | |
Constructor. | |
void | draw () |
Draw. More... | |
void | Relax () |
Gauss-Seidel relaxation. More... | |
Private Attributes | |
eSprite | m_eSpriteType = eSprite::Size |
Sprite type. | |
CPoint * | m_pV0 |
Point at one end. | |
CPoint * | m_pV1 |
Point at the other end. | |
float | m_fRestLength = 0 |
Rest length. | |
float | m_fRestitution = 0 |
Springiness, between 0.0f and 1.0f. | |
float | m_fAngle = 0 |
Orientation. | |
Additional Inherited Members | |
![]() | |
static CRenderer * | m_pRenderer = nullptr |
Pointer to the renderer. | |
static CObjectManager * | m_pObjectManager = nullptr |
Pointer to the object manager. | |
static eBody | m_eCurrentBody = (eBody)0 |
Current body type. | |
The spring class is the representation of an abstract spring or stick. It has flags that let you choose not to draw it and whether it should be drawn as a spring or a stick. The latter should be set according to the spring's restitution but at this level the two concepts can be independent of one another.
void CSpring::draw | ( | ) |
Draw the spring and the points at its ends.
void CSpring::Relax | ( | ) |
Perform a single iteration of Gauss-Seidel relaxation.