![]() |
Ball and Spring Toy
Chapter 4 of Ian Parberry's "Introduction to Game Physics with Box2D"
|
The spring manager. More...
#include <SpringManager.h>
Public Member Functions | |
| CSpringManager (int size) | |
| Constructor. | |
| CSpring * | ConnectSpring (CParticle *v0, CParticle *v1, CParticle *cntr, float restitution) |
| Add a spring. | |
| void | Relax (int iterations) |
| Gauss-Seidel relaxation. | |
| void | move () |
| Move springs. | |
Public Member Functions inherited from CAbstractList< CSpring > | |
| CAbstractList (int size) | |
| Constructor. | |
| ~CAbstractList () | |
| Destructor. | |
| BOOL | Insert (CSpring *newthing) |
| Insert new thing. | |
| CSpring * | create () |
| Create and insert new thing. | |
| void | clear () |
| Clear the list. | |
Additional Inherited Members | |
Protected Attributes inherited from CAbstractList< CSpring > | |
| CSpring ** | m_pList |
| List of things. | |
| int | m_nCount |
| How many things in list. | |
| int | m_nSize |
| Maximum size of list. | |
The spring manager.
| void CSpringManager::move | ( | ) |
Move springs.
Springs don't move around in the normal way, instead they get dragged around by their end points. All we need to do here is recompute their center points.
| void CSpringManager::Relax | ( | int | iterations | ) |
Gauss-Seidel relaxation.
Perform Gauss-Seidel relaxation on a collection of springs. The more iterations, the more stick-like the springs will be.
| iterations | Number of iterations of relaxation to perform. |
1.8.2