Ball and Spring Toy
Chapter 4 of Ian Parberry's "Introduction to Game Physics with Box2D"
 All Classes Files Functions Variables Enumerations Pages
Public Member Functions | List of all members
CSpringManager Class Reference

The spring manager. More...

#include <SpringManager.h>

Inheritance diagram for CSpringManager:
CAbstractList< CSpring >

Public Member Functions

 CSpringManager (int size)
 Constructor.
 
CSpringConnectSpring (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.
 
CSpringcreate ()
 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.
 

Detailed Description

The spring manager.

Member Function Documentation

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.

Parameters
iterationsNumber of iterations of relaxation to perform.