Description
The gts_surface_coarsen() function allows to reduce the number of edges (and of course faces and vertices) of a given surface. Each edge is collapsed according to an order described by a user-defined cost function. It is then replaced by a single vertex given by another user-defined function. Two sets of cost and replacement functions are provided with the library. The default uses the squared length of the segment as cost and replaces the segment with its midpoint.
The functions gts_volume_optimized_cost() and gts_volume_optimized_vertex() are an implementation of an algorithm proposed by Lindstrom and Turk called "memoryless simplification". This algorithm has been shown to be both computationally efficient and very accurate in terms of error between the simplified surface and the original one. It also preserves the volume enclosed by the surface both globally and locally.
Surface refinement is obtained by splitting the edges in two equal parts according to an order described by a user-defined cost function. The default is to use the squared length of the segments as cost.
The coarsening or refinement processes are stopped using a user-defined stop function. Two functions are provided stopping either when the cost of collapsing an edge is too large (gts_coarsen_stop_cost()) or when the number of edges is too small (gts_coarsen_stop_number()).
Details
gts_surface_refine ()
Refine surface using a midvertex insertion technique. All the
edges of surface are ordered according to cost_func. The edges
are then processed in order until stop_func returns TRUE. Each
edge is split in two and new edges and faces are created.
If cost_func is set to NULL, the edges are sorted according
to their length squared (the longest is on top).
GtsCoarsenFunc ()
User-defined function taking an edge e and returning a replacement vertex of class klass.
GtsStopFunc ()
gboolean (*GtsStopFunc) (gdouble cost,
guint nedge,
gpointer data); |
User-defined function used to stop the coarsening process.
gts_surface_coarsen ()
The edges of surface are sorted according to cost_func to
create a priority heap (a GtsEHeap). The edges are extracted in
turn from the top of the heap and collapsed (i.e. the vertices are
replaced by the vertex returned by the coarsen_func function)
until the stop_func functions returns TRUE.
If cost_func is set to NULL, the edges are sorted according
to their length squared (the shortest is on top).
If coarsen_func is set to NULL gts_segment_midvertex() is used.
The minimum angle is used to avoid introducing faces which would be folded.
gts_coarsen_stop_number ()
gboolean gts_coarsen_stop_number (gdouble cost,
guint nedge,
guint *min_number); |
This function is to be used as the stop_func argument of
gts_surface_coarsen() or gts_psurface_new().
gts_coarsen_stop_cost ()
gboolean gts_coarsen_stop_cost (gdouble cost,
guint nedge,
gdouble *max_cost); |
This function is to be used as the stop_func argument of
gts_surface_coarsen() or gts_psurface_new().
struct GtsVolumeOptimizedParams
struct GtsVolumeOptimizedParams {
gdouble volume_weight;
gdouble boundary_weight;
gdouble shape_weight;
}; |
The parameters for the volume optimization algorithm of Lindstrom and Turk. THey define the relative weight of the volume, boundary and shape optimization part of the algorithm. Lindstrom and Turk advice is to set them to 0.5, 0.5 and 0. You may want to experiment depending on your problem. Setting shape_weight to a very small value (1e-10) for example might help improve the quality of the resulting triangulation.
gts_volume_optimized_vertex ()
gts_volume_optimized_cost ()
gts_edge_collapse_is_valid ()
gboolean gts_edge_collapse_is_valid (GtsEdge *e); |
An implementation of the topological constraints described in the
"Mesh Optimization" article of Hoppe et al (1993).
gts_edge_collapse_creates_fold ()
gboolean gts_edge_collapse_creates_fold (GtsEdge *e,
GtsVertex *v,
gdouble max); |