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

#include <point.h>


#include <d3meshpartitiondraw.h>
#include <d3tesstransform.h>


d3meshpartitiondraw::d3meshpartitiondraw(d3meshpartition & _mp )
  : mp(_mp)
{
  meshdraw = new d3tessdraw(mp.meshB);
  meshdraw->graphicsDeffered.v[d3tessdraw::multicolor]->isdrawn = true;
  meshdraw->graphicsDeffered.v[d3tessdraw::points]->isdrawn = true;
  meshdraw->graphicsDeffered.v[d3tessdraw::simplexes]->isdrawn = true;

  meshdraw->meshupdate();
}


void d3meshpartitiondraw::draw()
{
  //cout << "d3meshpartitiondraw::draw()" << endl;
  assert(meshdraw!=0);

  meshdraw->draw();
}


void d3meshpartitiondraw::rotate(double const theta)
{
  assert(meshdraw!=0);

  d3tesstransform trans(meshdraw->tess);
  trans.rotate(theta);

  meshdraw->meshupdate();
}


void d3meshpartitiondraw::translate( pt2c & x )
{
  assert(meshdraw!=0);

  d3tesstransform trans(meshdraw->tess);
  trans.translate(x);

  meshdraw->meshupdate();
}






