Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

VertexJoin.h

Go to the documentation of this file.
00001 /*
00002     File:       VertexJoin.h
00003     
00004     Function:   Join up disconnected mesh.
00005     
00006     Author:     Andrew Willmott 
00007 
00008     Usage:      Call Init() with the bounds of the scene, and current number
00009                 of vertices. Then call AddVertex() to get new ids for each
00010                 vertex in turn. When finished call GetFinalVertexList() to
00011                 retrieve the new list of vertices.
00012 */
00013 
00014 #ifndef __VertexJoin__
00015 #define __VertexJoin__
00016 
00017 #include "gcl/Geometry.h"
00018 
00019 class VertexJoin
00020 {
00021 public:
00022     VertexJoin() : vertices(0), grid(0) {};
00023     
00024     Void        Init(const Point &min, const Point &max, Int numVertices);
00025 
00026     Int         AddVertex(const Point &where, Int id = 0);
00027                 // add the vertex: returns the index this vertex will have in 
00028                 // the final vertex list. If id is specified, vertices with
00029                 // different ids will not be merged.
00030     
00031     PointList   *GetFinalVertexList();  
00032 
00033 protected:
00034     Bool        MatchVertex(const Point &a, const Point &b);
00035                 // are these the same point in space?
00036 
00037     Int         *grid;      // spatial grid storage
00038     Point       min, max;
00039     Int         cells[3];   // grid dimensions
00040     PointList   *vertices;  // list of new vertices
00041     IndexList   nextList;   // for list of points
00042     IndexList   idList;     // list of vertex ids
00043                             // (vertices with different IDs won't be merged)
00044 };
00045 
00046 #endif

Generated at Sat Aug 5 00:17:04 2000 for Graphics Class Library by doxygen 1.1.0 written by Dimitri van Heesch, © 1997-2000