GTS Library Reference Manual |
---|
#include <gts.h> #define GTS_SPLIT_CLASS (klass) #define GTS_SPLIT (obj) #define GTS_IS_SPLIT (obj) #define GTS_SPLIT_V1 (vs) #define GTS_SPLIT_V2 (vs) struct GtsSplitClass; struct GtsSplitCFace; struct GtsSplit; GtsSplitClass* gts_split_class (void); GtsSplit* gts_split_new (GtsSplitClass *klass, GtsVertex *v, GtsObject *o1, GtsObject *o2); void gts_split_collapse (GtsSplit *vs, GtsEdgeClass *klass, GtsEHeap *heap); void gts_split_expand (GtsSplit *vs, GtsSurface *s, GtsEdgeClass *klass);guint gts_split_height (GtsSplit *root);gboolean (*GtsSplitTraverseFunc) (GtsSplit *vs,gpointer data); void gts_split_traverse (GtsSplit *root,GTraverseType order,gint depth, GtsSplitTraverseFunc func,gpointer data);
The vertex split object is the building block of the progressive mesh representation proposed by Hoppe ("Progressive meshes", SIGGRAPH, 1996). It encodes an edge collapse operation and its inverse the "vertex split". The implementation of vertex split in GTS is somewhat more general than the original version of Hoppe. Non-manifold edges can be collapsed and non-manifold vertices can be split.
#define GTS_SPLIT_CLASS(klass)
Casts klass to GtsSplitClass.
klass : | a descendant of GtsSplitClass. |
#define GTS_IS_SPLIT(obj)
Evaluates to TRUE if obj is a GtsSplit.
obj : | a pointer to test. |
#define GTS_SPLIT_V1(vs)
Evaluates to the first vertex of the edge collapsed by vs.
vs : | a GtsSplit. |
#define GTS_SPLIT_V2(vs)
Evaluates to the second vertex of the edge collapsed by vs.
vs : | a GtsSplit. |
struct GtsSplitCFace;
An opaque structure describing the faces collapsed by a vertex split.
struct GtsSplit { GtsObject object; GtsVertex * v; GtsObject * v1; GtsObject * v2; GtsSplitCFace * cfaces; guint ncf; };
The vertex split object. If v1 is a GtsSplit the corresponding vertex can be found in GTS_SPLIT(v1)->v. This conversion is performed directly by the two macros GTS_SPLIT_V1 and GTS_SPLIT_V2. Together with the current GtsSplit, v1 and v2 define one level of a vertex split tree. If v1 or v2 are both GtsVertex, the current vertex split is a leaf of the tree.
GtsObject object | |
GtsVertex *v | Vertex to be split. |
GtsObject *v1 | Either a GtsSplit or GtsVertex, first vertex of the edge to be expanded. |
GtsObject *v2 | Either a GtsSplit or GtsVertex, second vertex of the edge to be expanded. |
GtsSplitCFace *cfaces | An array of GtsSplitCFace describing the faces collapsed by the vertex split. |
ncf | Number of faces collapsed in cfaces. |
GtsSplit* gts_split_new (GtsSplitClass *klass, GtsVertex *v, GtsObject *o1, GtsObject *o2);
Creates a new GtsSplit which would collapse o1 and o2 into v. The collapse itself is not performed.
klass : | |
v : | a GtsVertex. |
o1 : | |
o2 : | |
Returns : | the new GtsSplit. |
void gts_split_collapse (GtsSplit *vs, GtsEdgeClass *klass, GtsEHeap *heap);
Collapses the vertex split vs. Any new edge created during the process will be of class klass. If heap is not NULL, the new edges will be inserted into it and the destroyed edges will be removed from it.
vs : | a GtsSplit. |
klass : | a GtsEdgeClass. |
heap : | a GtsEHeap or NULL. |
void gts_split_expand (GtsSplit *vs, GtsSurface *s, GtsEdgeClass *klass);
Expands the vertex split vs adding the newly created faces to s. Any new edge will be of class klass.
vs : | a GtsSplit. |
s : | a GtsSurface. |
klass : | a GtsEdgeClass. |
guint gts_split_height (GtsSplit *root);
root : | a GtsSplit. |
Returns : | the maximum height of the vertex split tree having root as root. |
gboolean (*GtsSplitTraverseFunc) (GtsSplit *vs,gpointer data);
A user-defined function to be called when traversing a vertex split tree.
vs : | the GtsSplit for which this function is called. |
data : | user data passed to the function. |
Returns : | TRUE to stop the traversal, FALSE to continue. |
void gts_split_traverse (GtsSplit *root,GTraverseType order,gint depth, GtsSplitTraverseFunc func,gpointer data);
Traverses the GtsSplit tree having root as root. Calls func for each GtsSplit of the tree in the order specified by order. If order is set to G_PRE_ORDER func is called for the GtsSplit then its children, if order is set to G_POST_ORDER func is called for the children and then for the GtsSplit.
root : | the GtsSplit to start the traversal from. |
order : | the order in which nodes are visited - G_PRE_ORDER or G_POST_ORDER. |
depth : | the maximum depth of the traversal. Nodes below this depth will not be visited. If depth is -1 all nodes in the tree are visited. If depth is 1, only the root is visited. If depth is 2, the root and its children are visited. And so on. |
func : | the function to call for each visited GtsHSplit. |
data : | user data to pass to the function. |
<<< Progressive and Hierarchical surfaces | Progressive surfaces >>> |