/* Segment de droite en 2D */ /* */ /* Auteur: Nicolas JANEY */ /* nicolas.janey@univ-fcomte.fr */ /* Novembre 2012 */ #include #include #include #include #include #include #include "Segment2D.h" #include "Position2D.h" #include "TraceSegment.h" /* Constructeurs */ Segment2D::Segment2D(void) { p1 = new Position2D(); p2 = new Position2D(); } Segment2D::Segment2D(Position2D *p1,Position2D *p2) { this->p1 = new Position2D(p1); this->p2 = new Position2D(p2); } Segment2D::Segment2D(Segment2D *s) { p1 = new Position2D(s->p1); p2 = new Position2D(s->p2); } /* Destructeur */ Segment2D::~Segment2D(void) { delete(p1); delete(p2); } /* Dessin OpenGL */ void Segment2D::draw(int zoom) { trace(p1,p2,zoom); } /* Dessin OpenGL */ void Segment2D::drawGL(void) { glBegin(GL_LINES); glVertex2f(p1->c[0],p1->c[1]); glVertex2f(p2->c[0],p2->c[1]); glEnd(); } /* Zoom */ void Segment2D::zoom(float zoom) { p1->c[0] *= zoom; p1->c[1] *= zoom; p2->c[0] *= zoom; p2->c[1] *= zoom; }