1 /***********************************************************************/
2 /* Open Visualization Data Explorer                                    */
3 /* (C) Copyright IBM Corp. 1989,1999                                   */
4 /* ALL RIGHTS RESERVED                                                 */
5 /* This code licensed under the                                        */
6 /*    "IBM PUBLIC LICENSE - Open Visualization Data Explorer"          */
7 /***********************************************************************/
8 /*
9  * $Header: /src/master/dx/src/exec/dxmods/_newtri.h,v 1.1 2000/08/24 20:04:16 davidt Exp $
10  */
11 
12 #include <dxconfig.h>
13 
14 #ifndef  __NEWTRI_H_
15 #define  __NEWTRI_H_
16 
17 #include <dx/dx.h>
18 
19 typedef struct
20 {
21     float               u;
22     float               v;
23 } Point2;
24 
25 typedef struct
26 {
27     Point2              ll;
28     Point2              ur;
29 } BBox;
30 
31 typedef struct BVertex
32 {
33     struct BVertex      *next;          /* boundary pointers         */
34     struct BVertex      *prev;
35     struct Loop         *lp;            /* initial parent loop       */
36     int                 id;             /* point id                  */
37     Point2              pos;            /* projection of vertex      */
38     int                 tried;
39     int                 pass;
40 } BVertex;
41 
42 typedef struct
43 {
44     int                 *faces;         /* the input faces              */
45     int                 *loops;         /* the input loops              */
46     int                 *edges;         /* the input edges              */
47     float               *points;        /* the input points             */
48     int                 *map;           /* the faces to triangles map   */
49     int                 nfaces;         /* # of faces                   */
50     int                 nloops;         /* # of loops                   */
51     int                 nedges;         /* # of edges                   */
52     int                 npoints;        /* # of points                  */
53     int                 nDim;           /* dimensionality of points     */
54 } FLEP;
55 
56 typedef struct Loop
57 {
58     struct Loop         *next;
59     struct Loop         *prev;
60     int                 nvert;          /* number of vertices        */
61     int                 *vids;          /* pointer to vertices       */
62     BVertex             *base;          /* base of linked list       */
63     int                 merged;         /* this loop has been merged */
64     int                 sign;           /* direction of rotation     */
65     BBox                box;            /* loop bounding box         */
66 } Loop;
67 
68 /*
69  * For the tree representing the loop nesting...
70  */
71 typedef struct treenode *TreeNode;
72 
73 struct treenode
74 {
75     Loop                *loop;
76     TreeNode            sibling;
77     TreeNode            children;
78     int                 nChildren;
79     int                 level;
80 };
81 
82 Error _dxfTriangulateField(Field);
83 int     _dxf_TriangleCount (int *f, int nf, int *l, int nl, int *e, int ne);
84 int     _dxf__TriangleCount (FLEP *in);
85 Error   _dxf_TriangulateFLEP (int *f, int nf, int *l, int nl, int *e, int ne,
86                 float *p, int np, Vector *normal, Triangle *tris, int *ntri,
87                 int *map, int nDim);
88 Error   _dxf__TriangulateFLEP (FLEP *in, Vector *normal, Triangle *tris, int *ntri,
89                  FLEP *valid);
90 
91 
92 #endif /* __NEWTRI_H_ */
93 
94