#ifndef TETMARCHDISP_H
#define TETMARCHDISP_H

#include <point.h>

typedef point4<double> pt4;
typedef point4<double> const pt4c;

//
//  Brief:  Marching Tetrahedrons
//
//          This class draws a surface from a tetrahedron.
//
//          An outside class iterates over a tetrahedron mesh and
//          feed the tetrahedrons into this class for display.
//
//          Implements simplist normals: facited. 
//
class d4marchdisp
{
  // The first point is one color, 
  // the other three are the other color.
  void writeone( pt4c & P0, pt4c & P1, pt4c & P2, pt4c & P3 ) const;

  // The first two points are one color, 
  // the rest the other color.
  void writetwo( pt4c & P0, pt4c & P1, pt4c & P2, pt4c & P3 ) const;

  void drawtriangle
  (
    float const ax,
    float const ay,
    float const az,
    float const bx,
    float const by,
    float const bz,
    float const cx,
    float const cy,
    float const cz
  ) const;
public:

  // Colors the triangles surface R,G,B at the vertexs to see the winding.
  bool winding;
  // Draws a normal line from the triangles surface.
  bool seenormal;

  double cvalue;

  // Constructor with options off.
  d4marchdisp(double const _cvalue=0.0)
    : winding(false), seenormal(false), cvalue(_cvalue) {}

  void eval( pt4c & P0, pt4c & P1, pt4c & P2, pt4c & P3 ) const;



/*

  // Pass in the cutt-off value and four points representing the tetrahedron. 
  // If f is below the cutt-off value the point is colored black, 
  // else its white. A surface is drawn(triangles) between opposite
  // colored points.
  void eval
  (
    float const fc,  // The cut-off value or constant value.
    float const x0,
    float const y0,
    float const z0,
    float const f0,
    float const x1,
    float const y1,
    float const z1,
    float const f1,
    float const x2,
    float const y2,
    float const z2,
    float const f2,
    float const x3,
    float const y3,
    float const z3,
    float const f3
  ) const;

*/



};


#endif




