pcb 4.1.1
An interactive printed circuit board layout editor.

stripe.c File Reference

#include "gts.h"
Include dependency graph for stripe.c:

Go to the source code of this file.

Data Structures

struct  tri_data_t
struct  map_t
struct  heap_t
struct  min_key_t

Defines

#define PRINT_HEAP_ELEMENTS   0

Functions

static tri_data_ttri_data_new (GtsTriangle *t)
static void tri_data_destroy (tri_data_t *td)
static guint tri_data_num_unused_neighbors2 (const tri_data_t *td, const map_t *map)
static GHashTable * tri_data_unused_neighbors2 (const tri_data_t *td, const map_t *map)
static map_tmap_new (GtsSurface *s)
static void map_destroy (map_t *map)
static tri_data_tmap_lookup (const map_t *map, GtsTriangle *t)
static heap_theap_new (GtsSurface *s)
static void heap_destroy (heap_t *heap)
static gboolean heap_is_empty (const heap_t *heap)
static GtsTriangleheap_top (const heap_t *heap)
static void heap_remove (heap_t *heap, GtsTriangle *t)
static gboolean vertices_are_unique (GtsVertex *v1, GtsVertex *v2, GtsVertex *v3)
static gboolean vertex_is_one_of (GtsVertex *v, GtsVertex *v1, GtsVertex *v2, GtsVertex *v3)
static guint num_shared_vertices (GtsVertex *u1, GtsVertex *u2, GtsVertex *u3, GtsVertex *v1, GtsVertex *v2, GtsVertex *v3)
static gboolean vertices_match (GtsVertex *v1, GtsVertex *v2, GtsVertex *v3, GtsVertex **v4, GtsVertex **v5, GtsVertex **v6)
static GtsVertexnon_shared_vertex1 (GtsVertex *u1, GtsVertex *u2, GtsVertex *u3, GtsVertex *v1, GtsVertex *v2, GtsVertex *v3)
static void match_vertex (GtsVertex *v, GtsVertex **v1, GtsVertex **v2, GtsVertex **v3)
static void copy_key_to_array (gpointer key, gpointer value, gpointer user_data)
static gboolean are_neighbors_unique (GHashTable *h)
static gdouble triangle_priority (gpointer item, gpointer data)
static void insert_entry_into_heap (gpointer key, gpointer value, gpointer user_data)
static void decrease_key (gpointer key, gpointer value, gpointer user_data)
static gint create_map_entry (gpointer item, gpointer data)
static void free_map_entry (gpointer key, gpointer value, gpointer user_data)
static GtsTrianglefind_min_neighbor (heap_t *heap, GtsTriangle *t)
static GtsTrianglefind_neighbor_forward (heap_t *heap, GtsTriangle *t, GtsVertex **v1, GtsVertex **v2, GtsVertex **v3, gboolean left_turn)
static GtsTrianglefind_neighbor_backward (heap_t *heap, GtsTriangle *t, GtsVertex **v1, GtsVertex **v2, GtsVertex **v3, gboolean left_turn)
static GSList * grow_strip_forward (heap_t *heap, GSList *strip, GtsTriangle *t, GtsVertex *v1, GtsVertex *v2, GtsVertex *v3)
static GSList * grow_strip_backward (heap_t *heap, GSList *strip, GtsTriangle *t, GtsVertex *v1, GtsVertex *v2, GtsVertex *v3)
static gboolean find_right_turn (GtsVertex **v1, GtsVertex **v2, GtsVertex **v3, GtsVertex **v4, GtsVertex **v5, GtsVertex **v6)
GSList * gts_surface_strip (GtsSurface *s)

Define Documentation

#define PRINT_HEAP_ELEMENTS   0

Definition at line 22 of file stripe.c.


Function Documentation

static gboolean are_neighbors_unique ( GHashTable *  h) [static]

Definition at line 232 of file stripe.c.

References copy_key_to_array(), FALSE, n, and TRUE.

Referenced by tri_data_unused_neighbors2().

Here is the call graph for this function:

static void copy_key_to_array ( gpointer  key,
gpointer  value,
gpointer  user_data 
) [static]

Definition at line 218 of file stripe.c.

Referenced by are_neighbors_unique().

static gint create_map_entry ( gpointer  item,
gpointer  data 
) [static]

Definition at line 448 of file stripe.c.

References tri_data_new().

Referenced by map_new().

Here is the call graph for this function:

static void decrease_key ( gpointer  key,
gpointer  value,
gpointer  user_data 
) [static]

Definition at line 397 of file stripe.c.

References gts_eheap_decrease_key(), heap_t::heap, _GtsEHeapPair::key, heap_t::map, tri_data_t::pos, tri_data_num_unused_neighbors2(), and tri_data_t::used.

Referenced by heap_remove().

Here is the call graph for this function:

static GtsTriangle* find_min_neighbor ( heap_t heap,
GtsTriangle t 
) [static]

Definition at line 507 of file stripe.c.

References _GtsEHeapPair::key, heap_t::map, map_lookup(), tri_data_t::neighbors, tri_data_t::pos, and tri_data_t::used.

Referenced by gts_surface_strip().

Here is the call graph for this function:

static GtsTriangle* find_neighbor_backward ( heap_t heap,
GtsTriangle t,
GtsVertex **  v1,
GtsVertex **  v2,
GtsVertex **  v3,
gboolean  left_turn 
) [static]

Definition at line 578 of file stripe.c.

References gts_triangle_vertices(), heap_t::map, map_lookup(), neighbor(), tri_data_t::neighbors, tri_data_t::used, vertices_are_unique(), and vertices_match().

Referenced by grow_strip_backward().

Here is the call graph for this function:

static GtsTriangle* find_neighbor_forward ( heap_t heap,
GtsTriangle t,
GtsVertex **  v1,
GtsVertex **  v2,
GtsVertex **  v3,
gboolean  left_turn 
) [static]

Definition at line 536 of file stripe.c.

References gts_triangle_vertices(), heap_t::map, map_lookup(), neighbor(), tri_data_t::neighbors, tri_data_t::used, vertices_are_unique(), and vertices_match().

Referenced by grow_strip_forward().

Here is the call graph for this function:

static gboolean find_right_turn ( GtsVertex **  v1,
GtsVertex **  v2,
GtsVertex **  v3,
GtsVertex **  v4,
GtsVertex **  v5,
GtsVertex **  v6 
) [static]

Definition at line 671 of file stripe.c.

References FALSE, match_vertex(), non_shared_vertex1(), num_shared_vertices(), TRUE, and vertices_are_unique().

Referenced by gts_surface_strip().

Here is the call graph for this function:

static void free_map_entry ( gpointer  key,
gpointer  value,
gpointer  user_data 
) [static]

Definition at line 461 of file stripe.c.

References tri_data_t::t, and tri_data_destroy().

Referenced by map_destroy().

Here is the call graph for this function:

static GSList* grow_strip_backward ( heap_t heap,
GSList *  strip,
GtsTriangle t,
GtsVertex v1,
GtsVertex v2,
GtsVertex v3 
) [static]

Definition at line 643 of file stripe.c.

References FALSE, find_neighbor_backward(), heap_remove(), TRUE, and vertices_are_unique().

Referenced by gts_surface_strip().

Here is the call graph for this function:

static GSList* grow_strip_forward ( heap_t heap,
GSList *  strip,
GtsTriangle t,
GtsVertex v1,
GtsVertex v2,
GtsVertex v3 
) [static]

Definition at line 618 of file stripe.c.

References find_neighbor_forward(), heap_remove(), TRUE, and vertices_are_unique().

Referenced by gts_surface_strip().

Here is the call graph for this function:

GSList* gts_surface_strip ( GtsSurface s)

gts_surface_strip: : a GtsSurface.

Decompose into triangle strips for fast-rendering.

Returns: a list of triangle strips containing all the triangles of . A triangle strip is itself a list of successive triangles having one edge in common.

Definition at line 718 of file stripe.c.

References find_min_neighbor(), find_right_turn(), grow_strip_backward(), grow_strip_forward(), gts_triangle_vertices(), heap_destroy(), heap_is_empty(), heap_new(), heap_remove(), and heap_top().

Here is the call graph for this function:

static void heap_destroy ( heap_t heap) [static]

Definition at line 366 of file stripe.c.

References gts_eheap_destroy(), heap_t::heap, heap_t::map, and map_destroy().

Here is the call graph for this function:

static gboolean heap_is_empty ( const heap_t heap) [static]

Definition at line 375 of file stripe.c.

References gts_eheap_size(), and heap_t::heap.

Here is the call graph for this function:

static heap_t * heap_new ( GtsSurface s) [static]

Definition at line 349 of file stripe.c.

References gts_eheap_foreach(), gts_eheap_new(), heap_t::heap, map_t::ht, insert_entry_into_heap(), heap_t::map, map_new(), and triangle_priority().

Referenced by gts_surface_strip().

Here is the call graph for this function:

static void heap_remove ( heap_t heap,
GtsTriangle t 
) [static]
static GtsTriangle * heap_top ( const heap_t heap) [static]

Definition at line 387 of file stripe.c.

References gts_eheap_top(), and heap_t::heap.

Referenced by gts_surface_strip().

Here is the call graph for this function:

static void insert_entry_into_heap ( gpointer  key,
gpointer  value,
gpointer  user_data 
) [static]

Definition at line 336 of file stripe.c.

References gts_eheap_insert(), and tri_data_t::pos.

Referenced by heap_new().

Here is the call graph for this function:

static void map_destroy ( map_t map) [static]

Definition at line 483 of file stripe.c.

References free_map_entry(), and map_t::ht.

Referenced by heap_destroy().

Here is the call graph for this function:

static tri_data_t * map_lookup ( const map_t map,
GtsTriangle t 
) [static]
static map_t * map_new ( GtsSurface s) [static]

Definition at line 473 of file stripe.c.

References create_map_entry(), gts_surface_foreach_face(), and map_t::ht.

Referenced by heap_new().

Here is the call graph for this function:

static void match_vertex ( GtsVertex v,
GtsVertex **  v1,
GtsVertex **  v2,
GtsVertex **  v3 
) [static]

Definition at line 164 of file stripe.c.

References vertex_is_one_of().

Referenced by find_right_turn().

Here is the call graph for this function:

static GtsVertex* non_shared_vertex1 ( GtsVertex u1,
GtsVertex u2,
GtsVertex u3,
GtsVertex v1,
GtsVertex v2,
GtsVertex v3 
) [static]

Definition at line 131 of file stripe.c.

References num_shared_vertices(), u(), vertex_is_one_of(), and vertices_are_unique().

Referenced by find_right_turn().

Here is the call graph for this function:

static guint num_shared_vertices ( GtsVertex u1,
GtsVertex u2,
GtsVertex u3,
GtsVertex v1,
GtsVertex v2,
GtsVertex v3 
) [static]

Definition at line 77 of file stripe.c.

References n, vertex_is_one_of(), and vertices_are_unique().

Referenced by find_right_turn(), and non_shared_vertex1().

Here is the call graph for this function:

static void tri_data_destroy ( tri_data_t td) [static]

Definition at line 196 of file stripe.c.

References tri_data_t::neighbors.

Referenced by free_map_entry().

static tri_data_t * tri_data_new ( GtsTriangle t) [static]

Definition at line 183 of file stripe.c.

References FALSE, gts_triangle_neighbors(), tri_data_t::neighbors, tri_data_t::pos, tri_data_t::t, and tri_data_t::used.

Referenced by create_map_entry().

Here is the call graph for this function:

static guint tri_data_num_unused_neighbors2 ( const tri_data_t td,
const map_t map 
) [static]

Definition at line 204 of file stripe.c.

References n, and tri_data_unused_neighbors2().

Referenced by decrease_key(), and triangle_priority().

Here is the call graph for this function:

static GHashTable * tri_data_unused_neighbors2 ( const tri_data_t td,
const map_t map 
) [static]

Definition at line 261 of file stripe.c.

References are_neighbors_unique(), map_lookup(), tri_data_t::neighbors, and tri_data_t::used.

Referenced by heap_remove(), and tri_data_num_unused_neighbors2().

Here is the call graph for this function:

static gdouble triangle_priority ( gpointer  item,
gpointer  data 
) [static]

Definition at line 304 of file stripe.c.

References map_lookup(), and tri_data_num_unused_neighbors2().

Referenced by heap_new().

Here is the call graph for this function:

static gboolean vertex_is_one_of ( GtsVertex v,
GtsVertex v1,
GtsVertex v2,
GtsVertex v3 
) [static]

Definition at line 68 of file stripe.c.

Referenced by match_vertex(), non_shared_vertex1(), and num_shared_vertices().

static gboolean vertices_are_unique ( GtsVertex v1,
GtsVertex v2,
GtsVertex v3 
) [static]
static gboolean vertices_match ( GtsVertex v1,
GtsVertex v2,
GtsVertex v3,
GtsVertex **  v4,
GtsVertex **  v5,
GtsVertex **  v6 
) [static]

Definition at line 100 of file stripe.c.

References TRUE, and vertices_are_unique().

Referenced by find_neighbor_backward(), and find_neighbor_forward().

Here is the call graph for this function: