pcb 4.1.1
An interactive printed circuit board layout editor.

psurface.c File Reference

#include <stdlib.h>
#include <math.h>
#include "gts.h"
Include dependency graph for psurface.c:

Go to the source code of this file.

Defines

#define HEAP_INSERT_OBJECT(h, e)
#define HEAP_REMOVE_OBJECT(h, e)

Functions

static void psurface_destroy (GtsObject *object)
static void psurface_class_init (GtsObjectClass *klass)
static void psurface_init (GtsPSurface *psurface)
GtsPSurfaceClassgts_psurface_class (void)
static GtsVertexedge_collapse (GtsPSurface *ps, GtsEdge *e, GtsEHeap *heap, GtsCoarsenFunc coarsen_func, gpointer coarsen_data, gdouble maxcosine2)
static void update_2nd_closest_neighbors (GtsVertex *v, GtsEHeap *heap)
static gdouble edge_length2 (GtsEdge *e)
static void create_heap_coarsen (GtsEdge *e, GtsEHeap *heap)
GtsPSurfacegts_psurface_new (GtsPSurfaceClass *klass, GtsSurface *surface, GtsSplitClass *split_class, GtsKeyFunc cost_func, gpointer cost_data, GtsCoarsenFunc coarsen_func, gpointer coarsen_data, GtsStopFunc stop_func, gpointer stop_data, gdouble minangle)
GtsSplitgts_psurface_add_vertex (GtsPSurface *ps)
GtsSplitgts_psurface_remove_vertex (GtsPSurface *ps)
guint gts_psurface_max_vertex_number (GtsPSurface *ps)
guint gts_psurface_min_vertex_number (GtsPSurface *ps)
void gts_psurface_set_vertex_number (GtsPSurface *ps, guint n)
guint gts_psurface_get_vertex_number (GtsPSurface *ps)
void gts_psurface_foreach_vertex (GtsPSurface *ps, GtsFunc func, gpointer data)

Define Documentation

#define HEAP_INSERT_OBJECT (   h,
 
)
Value:
(GTS_OBJECT (e)->reserved =\
                                   gts_eheap_insert (h, e))

Definition at line 24 of file psurface.c.

Referenced by create_heap_coarsen(), and update_2nd_closest_neighbors().

#define HEAP_REMOVE_OBJECT (   h,
 
)
Value:
(gts_eheap_remove (h, GTS_OBJECT (e)->reserved),\
                                  GTS_OBJECT (e)->reserved = NULL)

Definition at line 26 of file psurface.c.

Referenced by update_2nd_closest_neighbors().


Function Documentation

static void create_heap_coarsen ( GtsEdge e,
GtsEHeap heap 
) [static]

Definition at line 173 of file psurface.c.

References HEAP_INSERT_OBJECT.

Referenced by gts_psurface_new().

static gdouble edge_length2 ( GtsEdge e) [static]

Definition at line 167 of file psurface.c.

References GTS_POINT, gts_point_distance2(), and GTS_SEGMENT.

Referenced by gts_psurface_new().

Here is the call graph for this function:

GtsSplit* gts_psurface_add_vertex ( GtsPSurface ps)

gts_psurface_add_vertex: : a GtsPSurface.

Adds a vertex to the progressive surface by expanding the next available GtsSplit.

Returns: the expanded GtsSplit or NULL if all the GtsSplit have already been expanded.

Definition at line 341 of file psurface.c.

References _GtsSurface::edge_class, GTS_PSURFACE_IS_CLOSED, gts_split_expand(), _GtsPSurface::pos, _GtsPSurface::s, and _GtsPSurface::split.

Referenced by gts_psurface_set_vertex_number().

Here is the call graph for this function:

GtsPSurfaceClass* gts_psurface_class ( void  )

gts_psurface_class:

Returns: the GtsPSurfaceClass.

Definition at line 64 of file psurface.c.

References gts_object_class(), gts_object_class_new(), psurface_class_init(), and psurface_init().

Referenced by psurface_destroy().

Here is the call graph for this function:

void gts_psurface_foreach_vertex ( GtsPSurface ps,
GtsFunc  func,
gpointer  data 
)

gts_psurface_foreach_vertex: : a GtsPSurface. : a function to call for each vertex of . : data to be passed to .

Calls for each (potential) vertex of , whether actually used or not. The vertices are called in the order they were created during the edge collapse operation.

Definition at line 457 of file psurface.c.

References GTS_PSURFACE_IS_CLOSED, _GtsPSurface::split, and _GtsSplit::v.

guint gts_psurface_get_vertex_number ( GtsPSurface ps)

gts_psurface_get_vertex_number: : a GtsPSurface.

Returns: the current number of vertices of .

Definition at line 437 of file psurface.c.

References GTS_PSURFACE_IS_CLOSED, _GtsPSurface::min, _GtsPSurface::pos, and _GtsPSurface::split.

guint gts_psurface_max_vertex_number ( GtsPSurface ps)

gts_psurface_max_vertex_number: : a GtsPSurface.

Returns: the maximum number of vertices of i.e. the number of vertices if all the GtsSplit were expanded.

Definition at line 390 of file psurface.c.

References _GtsPSurface::min, and _GtsPSurface::split.

guint gts_psurface_min_vertex_number ( GtsPSurface ps)

gts_psurface_min_vertex_number: : a GtsPSurface.

Returns: the minimum number of vertices of i.e. the number of vertices if all the GtsSplit were collapsed.

Definition at line 404 of file psurface.c.

References _GtsPSurface::min.

GtsPSurface* gts_psurface_new ( GtsPSurfaceClass klass,
GtsSurface surface,
GtsSplitClass split_class,
GtsKeyFunc  cost_func,
gpointer  cost_data,
GtsCoarsenFunc  coarsen_func,
gpointer  coarsen_data,
GtsStopFunc  stop_func,
gpointer  stop_data,
gdouble  minangle 
)

gts_psurface_new: : a GtsPSurfaceClass. : a GtsSurface. : a GtsSplitClass to use for the new progressive surface. : cost function for the edge collapse algorithm. : data to pass to . : the function returning the vertex replacement for the edge collapse. : data to pass to . : the function to call to decide whether to stop the coarsening process. : data to pass to . : the minimum angle allowable between two neighboring triangles. This is used to avoid introducing folds in the mesh during simplification.

This function works in exactly the same way as the gts_surface_coarsen() function, except that the history of edge collapse is saved in an array of GtsSplit objects. This allows for dynamic continuous multiresolution control of the input .

Returns: a new progressive surface.

Definition at line 228 of file psurface.c.

References create_heap_coarsen(), _GtsTriangle::e1, _GtsTriangle::e2, _GtsTriangle::e3, edge_collapse(), edge_length2(), FALSE, gts_allow_floating_edges, gts_edge_face_number(), gts_eheap_destroy(), gts_eheap_foreach(), gts_eheap_freeze(), gts_eheap_new(), gts_eheap_remove_top(), gts_eheap_size(), gts_eheap_thaw(), GTS_OBJECT, GTS_OBJECT_CLASS, gts_object_new(), gts_object_reset_reserved(), GTS_POINT, GTS_PSURFACE, gts_segment_midvertex(), gts_surface_foreach_edge(), gts_surface_foreach_face(), gts_surface_vertex_number(), gts_vertex_is_contact(), gts_vertex_triangles(), _GtsPSurface::min, _GtsPSurface::pos, _GtsPSurface::s, _GtsPSurface::split, _GtsPSurface::split_class, TRUE, update_2nd_closest_neighbors(), and _GtsSplit::v.

Here is the call graph for this function:

GtsSplit* gts_psurface_remove_vertex ( GtsPSurface ps)

gts_psurface_remove_vertex: : a GtsPSurface.

Removes one vertex from the progressive surface by collapsing the first available GtsSplit.

Returns: the collapsed GtsSplit or NULL if all the GtsSplit have already been collapsed.

Definition at line 367 of file psurface.c.

References _GtsSurface::edge_class, GTS_PSURFACE_IS_CLOSED, gts_split_collapse(), _GtsPSurface::pos, _GtsPSurface::s, and _GtsPSurface::split.

Referenced by gts_hsurface_new(), gts_psurface_set_vertex_number(), and gts_psurface_write().

Here is the call graph for this function:

void gts_psurface_set_vertex_number ( GtsPSurface ps,
guint  n 
)

gts_psurface_set_vertex_number: : a GtsPSurface.
: a number of vertices.

Performs the required number of collapses or expansions to set the number of vertices of to
.

Definition at line 419 of file psurface.c.

References gts_psurface_add_vertex(), GTS_PSURFACE_IS_CLOSED, gts_psurface_remove_vertex(), _GtsPSurface::min, n, _GtsPSurface::pos, and _GtsPSurface::split.

Here is the call graph for this function:

static void psurface_class_init ( GtsObjectClass klass) [static]

Definition at line 45 of file psurface.c.

References _GtsObjectClass::destroy, and psurface_destroy().

Referenced by gts_psurface_class().

Here is the call graph for this function:

static void psurface_destroy ( GtsObject object) [static]

Definition at line 29 of file psurface.c.

References GTS_OBJECT, GTS_OBJECT_CLASS, gts_object_destroy(), GTS_PSURFACE, gts_psurface_class(), gts_psurface_close(), GTS_PSURFACE_IS_CLOSED, _GtsPSurface::split, and TRUE.

Referenced by psurface_class_init().

Here is the call graph for this function:

static void psurface_init ( GtsPSurface psurface) [static]
static void update_2nd_closest_neighbors ( GtsVertex v,
GtsEHeap heap 
) [static]