
#include "painters_line.h"

#include <GL/gl.h>

#include "vec4.h"
#include "vertex.h"
#include "halfedge.h"


PaintersLine::PaintersLine() {

	cerr << "Error: PaintersLine default constructor called" << endl;
	exit(-1);
}

PaintersLine::PaintersLine(const JLmatrix &VT, HalfEdge *he) : PaintersObj() {

	Vec4 Center;

	Vec4FastAverage(Center, he->_v->Point(), he->_other_half->_v->Point());

	he->_flag = he->_other_half->_flag = 1;

	Center.SetWto1();
	Init(Center, VT);

	_he = he;
}

PaintersLine::~PaintersLine() {
}

PaintersLine& PaintersLine::CopyFrom(const PaintersLine &) {

	cerr << "Error: PaintersLine::CopyFrom() called" << endl;
	exit(-1);

	return *this;
}

void PaintersLine::Draw() {

	glColor3f(1, 1, 1);

	glBegin(GL_LINES);

	glVertex3f(_he->_v->Point().x(),
			   _he->_v->Point().y(),
			   _he->_v->Point().z());
	glVertex3f(_he->_other_half->_v->Point().x(),
			   _he->_other_half->_v->Point().y(),
			   _he->_other_half->_v->Point().z());

	glEnd();
}
