Description
Using vertex clusters and vertex cluster grids it is easy to design out-of-core algorithms for surface simplification. This approach has been detailed in a recent paper by Lindstrom and Turk ("Out-of-core simplification of large polygonal models", 2000).
Vertex clusters are just groups of vertices collapsed into a single vertex. The position of this single representative vertex can be derived with different techniques. The default GTS implementation GtsCluster just takes the average of the positions of the vertices in a given cluster as the representative position. Clusters are created using gts_cluster_new(). The cluster is initially empty and the position of the representative vertex is set to the origin. Vertices are added using gts_cluster_add() which calls the add() virtual method of GtsClusterClass. Once all the vertices have been added gts_cluster_update() computes the position of the representative vertex.
Clusters are grouped using the GtsClusterGrid object which is just an implementation of the hash-table based regular grid of Lindstrom and Turk. This regular grid is created using gts_cluster_grid_new(). Once created triangles of the surface to be simplified can be added using gts_cluster_grid_add_triangle() which adds the vertices of the triangle to the GtsCluster they belong to and adds the corresponding faces to the simplified surface. After all the triangles of the original surface have been added the position of the representative vertex of all the vertex clusters is computed using gts_cluster_grid_update(). The simplified surface is then complete and the cluster grid can be destroyed using gts_object_destroy().
Details
GTS_CLUSTER_CLASS()
#define GTS_CLUSTER_CLASS(klass) |
Casts klass to GtsClusterClass.
GTS_IS_CLUSTER()
#define GTS_IS_CLUSTER(obj) |
Evaluates to TRUE if obj is a GtsCluster, FALSE otherwise.
struct GtsClusterClass
The cluster class derived from GtsClusterClass. Virtual function add adds point p to the cluster while passing user-data data. Virtual function update computes the position of the representative vertex.
struct GtsCluster
struct GtsCluster {
GtsObject parent;
GtsClusterId id;
GtsVertex * v;
guint n;
}; |
The cluster object.
struct GtsClusterId
struct GtsClusterId {
guint x, y, z;
}; |
gts_cluster_add ()
Adds point p to cluster c.
gts_cluster_update ()
Updates the position of the vertex representative of all the
vertices added to c.
GTS_CLUSTER_GRID_CLASS()
#define GTS_CLUSTER_GRID_CLASS(klass) |
Casts klass to GtsClusterGridClass.
GTS_CLUSTER_GRID()
#define GTS_CLUSTER_GRID(obj) |
Casts obj to GtsCluster.
GTS_IS_CLUSTER_GRID()
#define GTS_IS_CLUSTER_GRID(obj) |
Evaluates to TRUE if obj is a GtsCluster, FALSE otherwise.
struct GtsClusterGridClass
struct GtsClusterGridClass; |
The cluster grid class derived from GtsObjectClass.
struct GtsClusterGrid
struct GtsClusterGrid {
GtsObject parent;
GtsSurface * surface;
GtsBBox * bbox;
GtsVector size;
GtsClusterClass * cluster_class;
GHashTable * clusters;
}; |
The cluster grid object.
gts_cluster_grid_class ()
gts_cluster_grid_add_triangle ()
Adds the triangle defined by p1, p2 and p3 to the respective clusters
of cluster_grid.
gts_cluster_grid_update ()
Updates the representative vertices of all the clusters of cluster_grid.