proj home

Files   Classes   Functions   Hierarchy  

d2simplexintersection Class Reference

Display two triangles in 2D and visually identify when they intersect. More...

#include <d2simplexintersection.h>

Inheritance diagram for d2simplexintersection:
Collaboration diagram for d2simplexintersection:

List of all members.

Public Member Functions

 d2simplexintersection (d2simplex &s1, d2simplex &s2)
 Constructor.
void draw ()
 Draws the two triangles and colors them in if they intersect.

Public Attributes

d2simplexs1
 Triangle 1.
d2simplexs2
 Triangle 2.
d2simplexOutline s1g
 Draw triangle 1's edges.
d2simplexOutline s2g
 Draw triangle 2's edges.
bool intersection
 Set to true when intersection occures.


Detailed Description

Display two triangles in 2D and visually identify when they intersect.

Definition at line 50 of file d2simplexintersection.h.


Constructor & Destructor Documentation

d2simplexintersection::d2simplexintersection ( d2simplex s1,
d2simplex s2 
)

Constructor.

Definition at line 38 of file d2simplexintersection.cpp.

00042   : s1(_s1), s2(_s2), s1g(s1), s2g(s2), intersection(false) 
00043 {
00044 }


Member Function Documentation

void d2simplexintersection::draw (  )  [virtual]

Draws the two triangles and colors them in if they intersect.

Implements gobj.

Definition at line 10 of file d2simplexintersection.cpp.

References d2simplexOutline::draw(), intersection, s1, s1g, s2, and s2g.

00011 {
00012   glPushAttrib(GL_LIGHTING);
00013   glPushAttrib(GL_CURRENT_BIT);
00014 
00015   glDisable(GL_LIGHTING);
00016 
00017   if (intersection)
00018   {
00019     glColor3ub(255,0,0);
00020 
00021     d2simplexFill(s1).draw();
00022     d2simplexFill(s2).draw();
00023   }
00024 
00025   glColor3ub(0,255,127);
00026   s1g.draw();
00027   d2simplexNormals(s1).draw();
00028 
00029   glColor3ub(255,255,0);
00030   s2g.draw();
00031   d2simplexNormals(s2).draw();
00032 
00033   glPopAttrib();
00034   glPopAttrib();
00035 }


Member Data Documentation

Set to true when intersection occures.

Definition at line 65 of file d2simplexintersection.h.

Referenced by draw(), and d2simplextest::intersection().

Triangle 1.

Definition at line 55 of file d2simplexintersection.h.

Referenced by draw().

Draw triangle 1's edges.

Definition at line 60 of file d2simplexintersection.h.

Referenced by draw().

Triangle 2.

Definition at line 57 of file d2simplexintersection.h.

Referenced by draw().

Draw triangle 2's edges.

Definition at line 62 of file d2simplexintersection.h.

Referenced by draw().


The documentation for this class was generated from the following files:

Generated on Fri Mar 4 00:49:53 2011 for Chelton Evans Source by  doxygen 1.5.8