#ifndef LANDED_TYPES
#define LANDED_TYPES

//macros for squaring.  This comes up a lit
#define SQUARE(x) ((x)*(x))

#include <QObject>
#include <QString>
#include <vector>

//useful 3-vector class for various purposes
//the primary purpose being the locations of the vertices of the shapes read in from the vrml file
class ThreeVector
{
public:
  ThreeVector()
  {
    x=y=z=0;
  }
  //trick to treat this object as an array of 3 doubles
  double& operator[](int i)
  {
    if (i<1)
      return x;
    else if (i>1)
      return z;
    else
      return y;
  }
  double x, y, z;
};

//array container types and their indexes used throughout the code
//a "Connection" is an index from the vrml indication which shape vertices are connected to each other.  see the vrml standard for more information
typedef int Connection;
typedef std::vector<Connection> ConnectionCollection;
typedef ConnectionCollection::size_type ConnectionIndex;
//the thre
typedef std::vector<ThreeVector> ThreeVectorCollection;
typedef ThreeVectorCollection::size_type ThreeVectorIndex;

//representation of a Shape from the vrml file
//in viewer3d this is extended to assist with opengl handling
class Shape
{
 public:
  Shape(QString n, int re):
    name(n),
    rep(re)
  {

  }

 public:
  //the name from the comment immediately preceeding the shape definition
  QString name;
  //replica number from the same
  int rep;
  //the points encompassing the surface
  ThreeVectorCollection points;
  //a map of between which points to draw lines
  //closely linked to the vrml representation
  ConnectionCollection connections;

};

#endif //ifndef LANDED_TYPES
