#ifndef D3FAN2_H
#define D3FAN2_H

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

#include <d3tess.h>
#include <simplexface.h>
#include <typedefs.h>

class d3tess;

class d3fan2
{
  d3tess & tess;

  // Surface facets viewable to inserted point w.
  vector< simplexface > vft;

  // Initial point where triangles are inserted.
  //   This is used with vft to map newely created triangles.
  uint vk;

  // Point
  uint w;

public:

  // Constructor
  d3fan2( d3tess & tess_ );

  // Build the 3D fan from the point _w to the 
  //   surface of tess.  Assume tess.cp on surface.
  void eval(uintc w_);

private:
  void addspike();
  void traverseleft(simplexface const prev);
  void traverseright(simplexface const prev);
};


#endif


