Ignore:
Timestamp:
01/05/06 20:41:52 (18 years ago)
Author:
mattausch
Message:

added mesh creation function

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/src/Polygon3.cpp

    r483 r503  
    11#include "Polygon3.h" 
    2 #include "Mesh.h" 
    32#include "Mesh.h" 
    43#include "AxisAlignedBox3.h" 
    54#include "Ray.h" 
     5#include "Triangle3.h" 
    66 
    77Polygon3::Polygon3():  
     
    471471        return revPoly; 
    472472} 
     473 
     474 
     475void Polygon3::Triangulate(vector<Triangle3> &triangles) 
     476{ 
     477        int i = 1; 
     478        int j = 0; 
     479        int k = mVertices.size() - 1; 
     480        int count = 0; 
     481 
     482        while (i < k) 
     483        { 
     484                triangles.push_back(Triangle3(mVertices[i], mVertices[j], mVertices[k])); 
     485 
     486                if ((count ++) % 2) 
     487                        j = i ++; 
     488                else 
     489                        j = k --; 
     490        } 
     491} 
Note: See TracChangeset for help on using the changeset viewer.