Vertex split

Name

Vertex split -- object encoding a reversible edge-collapse operation.

Synopsis


#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);

Description

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.

Details

GTS_SPLIT_CLASS()

#define     GTS_SPLIT_CLASS(klass)

Casts klass to GtsSplitClass.

klass :

a descendant of GtsSplitClass.


GTS_SPLIT()

#define     GTS_SPLIT(obj)

Casts obj to GtsSplit.

obj :

a descendant of GtsSplit.


GTS_IS_SPLIT()

#define     GTS_IS_SPLIT(obj)

Evaluates to TRUE if obj is a GtsSplit.

obj :

a pointer to test.


GTS_SPLIT_V1()

#define     GTS_SPLIT_V1(vs)

Evaluates to the first vertex of the edge collapsed by vs.

vs :

a GtsSplit.


GTS_SPLIT_V2()

#define     GTS_SPLIT_V2(vs)

Evaluates to the second vertex of the edge collapsed by vs.

vs :

a GtsSplit.


struct GtsSplitClass

struct GtsSplitClass {

  GtsObjectClass parent_class;
};

The vertex split class.


struct GtsSplitCFace

struct GtsSplitCFace;

An opaque structure describing the faces collapsed by a vertex split.


struct GtsSplit

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.

guint ncf

Number of faces collapsed in cfaces.


gts_split_class ()

GtsSplitClass* gts_split_class              (void);

Returns :

the GtsSplitClass.


gts_split_new ()

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 :

a GtsSplitClass.

v :

a GtsVertex.

o1 :

either a GtsVertex or a GtsSplit.

o2 :

either a GtsVertex or a GtsSplit.

Returns :

the new GtsSplit.


gts_split_collapse ()

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.


gts_split_expand ()

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.


gts_split_height ()

guint       gts_split_height                (GtsSplit *root);

root :

a GtsSplit.

Returns :

the maximum height of the vertex split tree having root as root.


GtsSplitTraverseFunc ()

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.


gts_split_traverse ()

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.