#ifndef D3TESSTRANSFORM_H
#define D3TESSTRANSFORM_H

#include <point.h>
#include <mathlib.h>

#include <d3tess.h>

typedef point2<double> const pt2c;

#include <d2homogeneous.h>


/*!

  \brief Apply 2D transforms to the meshes points.

  There are two ways of using this class.  Either use the direct methods
  to change the mesh or configure trans and call transEval().

  The direct methods are simple and as they do not use a 3 by 3 matrix they
  are more efficient that the homogeneous transform.  

  But efficiency is relative.  The homogeneous trans can have multiple transforms
  applied to it by multiplying with other d2homogeneous transforms.

  It is also easy to pre compute the transform and forever use again
  by configuring trans and afterwards calling transEval() as opposed for example to
  using rotate(theta) which re calculates the tranform every time it is called.
*/
class d3tesstransform
{
public:

  /** The tessellation. */
  d3tess & tess;

  /** The current transform. */
  d2homogeneous trans;

  /** Apply trans to all the points in the mesh. */
  void transEval();

  /** Constructor. */
  d3tesstransform(d3tess & _tess);

  //
  // Directly operate on the points with the following routines.
  //

  /** Rotate every point about the origin. */
  void rotate(double const theta);

  /** Multiply every point by the transform. */
  void multiply( pt2c & row1, pt2c & row2 );

  /** Shift every point in the mesh by x. */
  void translate( pt2c & x );

  // <TODO> Possibly extend to operate over integer ranges.
};
  

  


#endif



