Al's Programming Resource Homepage  Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

POLYGON Class Reference

#include <polygon.h>

List of all members.

Public Methods

 POLYGON ()
 ~POLYGON ()
VECTOR GetNormal ()
void SetNormal ()

Public Attributes

TEXTURE Texture
VERTEX Vertex [3]
int numVertices


Constructor & Destructor Documentation

POLYGON::POLYGON  
 

Definition at line 5 of file polygon.cpp.

00006 {
00007 }

POLYGON::~POLYGON  
 

Definition at line 9 of file polygon.cpp.

00010 {
00011 }


Member Function Documentation

VECTOR POLYGON::GetNormal  
 

Definition at line 13 of file polygon.cpp.

References VERTEX::coords, Vertex, VECTOR::x, VECTOR::y, and VECTOR::z.

Referenced by CheckForCollision().

00014 {
00015         VECTOR temp; 
00016         float ux;
00017         float uy;
00018         float uz;
00019         float vx;
00020         float vy;
00021         float vz;
00022           ux = Vertex[1].coords.x - Vertex[0].coords.x;
00023           uy = Vertex[1].coords.y - Vertex[0].coords.y;
00024           uz = Vertex[1].coords.z - Vertex[0].coords.z;
00025           vx = Vertex[2].coords.x - Vertex[0].coords.x;
00026           vy = Vertex[2].coords.y - Vertex[0].coords.y;
00027           vz = Vertex[2].coords.z - Vertex[0].coords.z;
00028           temp.x = (uy*vz)-(vy*uz);
00029           temp.y = (uz*vx)-(vz*ux);
00030           temp.z = (ux*vy)-(vx*uy);
00031         return temp;
00032 }

void POLYGON::SetNormal  
 

Definition at line 34 of file polygon.cpp.

References VERTEX::coords, VERTEX::normal, Vertex, VECTOR::x, VECTOR::y, and VECTOR::z.

Referenced by SetGLWorld().

00035 {
00036         float ux;
00037         float uy;
00038         float uz;
00039         float vx;
00040         float vy;
00041         float vz;
00042           ux = Vertex[1].coords.x - Vertex[0].coords.x;
00043           uy = Vertex[1].coords.y - Vertex[0].coords.y;
00044           uz = Vertex[1].coords.z - Vertex[0].coords.z;
00045           vx = Vertex[2].coords.x - Vertex[0].coords.x;
00046           vy = Vertex[2].coords.y - Vertex[0].coords.y;
00047           vz = Vertex[2].coords.z - Vertex[0].coords.z;
00048           Vertex[0].normal.x = (uy*vz)-(vy*uz);
00049           Vertex[0].normal.y = (uz*vx)-(vz*ux);
00050           Vertex[0].normal.z = (ux*vy)-(vx*uy);
00051         Vertex[1].normal = Vertex[0].normal;
00052           Vertex[2].normal = Vertex[0].normal;
00053 }


Member Data Documentation

int POLYGON::numVertices
 

Definition at line 21 of file polygon.h.

Referenced by SelectPolygon(), and SetGLWorld().

TEXTURE POLYGON::Texture
 

Definition at line 19 of file polygon.h.

VERTEX POLYGON::Vertex[3]
 

Definition at line 20 of file polygon.h.

Referenced by CheckForCollision(), GetNormal(), line_plane_collision(), SelectPolygon(), SetGLWorld(), and SetNormal().


The documentation for this class was generated from the following files:
Generated on Fri Dec 23 05:21:00 2005 for Polygon Selection by doxygen1.2.15