#ifndef SPRINGLINEARDRAW_H

#include <cassert>
#include <vector>
using namespace std;

#include <gobj.h>
#include <helix.h>
#include <springlineargeom.h>
#include <typedefs.h>


/*!
\brief Linearly connected springs.

The client instantiates the class, configures the parameters
 and calls update before drawing.
*/
class springlineardraw : public gobj, public springlineargeom
{
  springlineardraw() { assert(false); }
public:

  /** The color of the springs. */
  point3<double> springcolor;
  /** The color of the masses. */
  vector< point3<double> > masscolor;

  /** Make a N point mass linear spring system. */
  springlineardraw
  (
    uintc N_,
    doublec springradius,
    doublec springturns,
    uintc springNspikes 
  );

  /** Make a N point mass linear spring system. */
  void construct
  (
    uintc N_,
    doublec springradius,
    doublec springturns,
    uintc springNspikes 
  );

  /** The point masses. */
  vector< gobjMySphereDraw > sph;
  /** The springs. */
  vector <helix> hel;

  /** The sphere geometry used for the point mass. */
  gobjQuadric quadric;

  /** Draw a linear chain of springs separated by masses. */
  void draw();

  /** Update the geometry based on the classes parameters. */
  void update();

};



#endif



