source: trunk/src2/voronoi/vdefs.h @ 1016

Last change on this file since 1016 was 666, checked in by mmc, 18 years ago

Added voronoi code, which is currently used by the nanovis server
to generate triangular meshes for point clouds.

File size: 2.7 KB
Line 
1#ifndef __VDEFS_H
2#define __VDEFS_H
3
4#ifndef NULL
5#define NULL 0
6#endif
7
8#define DELETED -2
9
10typedef struct tagFreenode
11    {
12    struct tagFreenode * nextfree;
13    } Freenode ;
14
15
16typedef struct tagFreelist
17    {
18    Freenode * head;
19    int nodesize;
20    } Freelist ;
21
22typedef struct tagPoint
23    {
24    float x ;
25    float y ;
26    } Point ;
27
28/* structure used both for sites and for vertices */
29
30typedef struct tagSite
31    {
32    Point coord ;
33    int sitenbr ;
34    int refcnt ;
35    } Site ;
36
37
38typedef struct tagEdge
39    {
40    float a, b, c ;
41    Site * ep[2] ;
42    Site * reg[2] ;
43    int edgenbr ;
44    } Edge ;
45
46#define le 0
47#define re 1
48
49typedef struct tagHalfedge
50    {
51    struct tagHalfedge * ELleft ;
52    struct tagHalfedge * ELright ;
53    Edge * ELedge ;
54    int ELrefcnt ;
55    char ELpm ;
56    Site * vertex ;
57    float ystar ;
58    struct tagHalfedge * PQnext ;
59    } Halfedge ;
60
61/* edgelist.c */
62void ELinitialize(void) ;
63Halfedge * HEcreate(Edge *, int) ;
64void ELinsert(Halfedge *, Halfedge *) ;
65Halfedge * ELgethash(int) ;
66Halfedge * ELleftbnd(Point *) ;
67void ELdelete(Halfedge *) ;
68Halfedge * ELright(Halfedge *) ;
69Halfedge * ELleft(Halfedge *) ;
70Site * leftreg(Halfedge *) ;
71Site * rightreg(Halfedge *) ;
72extern int ELhashsize ;
73extern Site * bottomsite ;
74extern Freelist hfl ;
75extern Halfedge * ELleftend, * ELrightend, **ELhash ;
76
77/* geometry.c */
78void geominit(void) ;
79Edge * bisect(Site *, Site *) ;
80Site * intersect(Halfedge *, Halfedge *) ;
81int right_of(Halfedge *, Point *) ;
82void endpoint(Edge *, int, Site *) ;
83float dist(Site *, Site *) ;
84void makevertex(Site *) ;
85void deref(Site *) ;
86void ref(Site *) ;
87extern float deltax, deltay ;
88extern int nsites, nedges, sqrt_nsites, nvertices ;
89extern Freelist sfl, efl ;
90
91/* heap.c */
92void PQinsert(Halfedge *, Site *, float) ;
93void PQdelete(Halfedge *) ;
94int PQbucket(Halfedge *) ;
95int PQempty(void) ;
96Point PQ_min(void) ;
97Halfedge * PQextractmin(void) ;
98void PQinitialize(void) ;
99extern int PQmin, PQcount, PQhashsize ;
100extern Halfedge * PQhash ;
101
102/* main.c */
103extern int sorted, triangulate, plot, debug, nsites, siteidx ;
104extern float xmin, xmax, ymin, ymax ;
105extern Site * sites ;
106extern Freelist sfl ;
107
108/* getopt.c */
109extern int getopt(int, char *const *, const char *);
110
111/* memory.c */
112void freeinit(Freelist *, int) ;
113char *getfree(Freelist *) ;
114void makefree(Freenode *, Freelist *) ;
115char *myalloc(unsigned) ;
116
117/* output.c */
118void openpl(void) ;
119void line(float, float, float, float) ;
120void circle(float, float, float) ;
121void range(float, float, float, float) ;
122void out_bisector(Edge *) ;
123void out_ep(Edge *) ;
124void out_vertex(Site *) ;
125void out_site(Site *) ;
126void out_triple(Site *, Site *, Site *) ;
127void plotinit(void) ;
128void clip_line(Edge *) ;
129
130/* voronoi.c */
131void voronoi(Site *(*)()) ;
132
133#endif 
134
135
Note: See TracBrowser for help on using the repository browser.