#ifndef HALFSPACED2DRAW_H
#define HALFSPACED2DRAW_H

#include <halfspaceD2.h>
#include <gobj.h>
#include <point.h>

#include <d2partitiondraw.h>

typedef point2<double> pt2;
typedef point3<double> pt3;


class halfspaceD2draw : public gobj
{
public:

  halfspaceD2< pt3, double > & h;

  halfspaceD2draw( halfspaceD2< pt3, double > & _h)
    : h(_h) { alphacalculate(); }

  double alpha;

  template< typename U>
  void translate( U const & x)
  {
    h.p0.x += x.x;
    h.p0.y += x.y;
    h.p1.x += x.x;
    h.p1.y += x.y;

    h.normalcalculate();
  }

  void alphacalculate()
  {
    pt2 z;
    z.x = h.p1.x - h.p0.x;
    z.y = h.p1.y - h.p0.y;
    alpha = atan(z.y/z.x);
  }

  void rotate(double const theta);

  void draw();

};


#endif



