#ifndef _SCATTER_
#define _SCATTER_

#include <SoParticle.h>
#include <ParticleSet.h>

#include <Inventor/nodes/SoSeparator.h>
#include <Inventor/sensors/SoTimerSensor.h>
#include <Inventor/fields/SoMFInt32.h>

#define DEFAULT_DM  500.0
#define DEFAULT_DR    0.5
#define DEFAULT_PM    1.0
#define DEFAULT_PR    0.1
#define DEFAULT_PN    100
#define DEFAULT_CR    6.0
#define DEFAULT_TR    0.05

#define MAX_TRIES      10

class Scatter {
public:

  float deflectorMass;
  float deflectorRadius;
  float catchRadius;
  float timerRate;

  SoParticle    *deflector;
  ParticleSet   pset;

  Scatter ();

  void          clear             ();
  void          deleteUnscattered ();
  SoSeparator*  makeScene         ();
  void          newParticleSet    ();
  void          update            ();

private:
  SoSeparator   *root;
  SoSeparator   *currPSet;
  SoSeparator   *oldPSets;

  //SoTimerSensor sensor;

  SoParticle *makeDeflector ();

  void          updateVelocities  (SoParticle *source, SoSeparator *particles,
                                   SoMFInt32 &collisions);
};

#endif // _SCATTER_
  


		      
		      
