1
/* $Xorg: miNurbs.h,v 1.4 2001/02/09 02:04:08 xorgcvs Exp $ */
3
/*****************************************************************
5
Copyright 1989,1990, 1991, 1998 The Open Group
7
Permission to use, copy, modify, distribute, and sell this software and its
8
documentation for any purpose is hereby granted without fee, provided that
9
the above copyright notice appear in all copies and that both that
10
copyright notice and this permission notice appear in supporting
13
The above copyright notice and this permission notice shall be included in
14
all copies or substantial portions of the Software.
16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
Except as contained in this notice, the name of The Open Group shall not be
24
used in advertising or otherwise to promote the sale, use or other dealings
25
in this Software without prior written authorization from The Open Group.
27
Copyright 1989,1990, 1991 by Sun Microsystems, Inc.
31
Permission to use, copy, modify, and distribute this software and its
32
documentation for any purpose and without fee is hereby granted,
33
provided that the above copyright notice appear in all copies and that
34
both that copyright notice and this permission notice appear in
35
supporting documentation, and that the names of Sun Microsystems,
36
and The Open Group, not be used in advertising or publicity
37
pertaining to distribution of the software without specific, written
40
SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
41
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
42
SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
43
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
44
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
45
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
48
******************************************************************/
54
extern unsigned nurb_debug_flags;
55
#define NURB_DEBUG_FLAG(_b) (nurb_debug_flags & (_b))
59
* 0x01 (1) Surface edge paths
60
* 0x02 (2) Surface iso curve paths
61
* 0x04 (4) Trimming data, tessellated and ordered
62
* 0x08 (8) Surface facet paths for untrimmed surfaces
63
* 0x10 (16) Trimmed surface polygons
64
* 0x20 (32) Surface facet paths
65
* 0x40 (64) Surface polygons before trimming
66
* 0x80 (128) Surface hollow-edge paths
67
* 0x100 (256) Surface grids
68
* 0x200 (512) Initial data
79
#define MAX(a,b) ( ((a) > (b)) ? (a) : (b) )
81
extern double mi_nu_ptofd[MAXORD][MAXORD];
83
#define NURB_TRIM_DATA_INIT( _t ) \
86
(_t).loops = (Nurb_trim_loop_rep *)NULL; \
87
(_t).cur_vertex = 1; \
88
(_t).vertices = (Nurb_param_point *)NULL; \
90
(_t).ep_list_size = 0; \
91
(_t).ep_list = (Nurb_edge_point *)NULL; \
94
#define NURB_SURF_STATE_INIT( _s ) \
96
(_s)->reps.facets = 0; \
97
(_s)->reps.edges = 0; \
98
(_s)->reps.isocrvs = 0; \
99
(_s)->reps.markers = 0; \
100
(_s)->reps.hollow = 0; \
101
(_s)->reps.grids = 0; \
102
(_s)->reps.normals = 0; \
103
(_s)->reps.trim_data = 0; \
104
(_s)->grids.number = 0; \
105
(_s)->grids.flags.normals = 0; \
106
(_s)->grids.grids = (Nurb_grid *)NULL; \
107
(_s)->ruknots = (ddFLOAT *)NULL; \
108
(_s)->rvknots = (ddFLOAT *)NULL; \
109
(_s)->facets = (miListHeader *)NULL; \
110
(_s)->sofas = (miSOFASStruct *)NULL; \
111
(_s)->edges = (miListHeader *)NULL; \
112
(_s)->isocrvs = (miListHeader *)NULL; \
113
(_s)->markers = (miListHeader *)NULL; \
114
(_s)->hollow = (miListHeader *)NULL; \
115
NURB_TRIM_DATA_INIT((_s)->trim_data); \
118
#define NURB_INIT_RANGE_LIST( _r ) \
121
(_r)->limits = (Nurb_limit *)NULL;
123
#define EXTENTS_OVERLAP( _ea, _eb ) \
124
(!((_eb).umin > (_ea).umax || (_eb).umax < (_ea).umin || \
125
(_eb).vmin > (_ea).vmax || (_eb).vmax < (_ea).vmin))
127
#define GET_TRIM_CURVE_TOLERANCE( _crv, _tolerance ) \
128
switch ( (_crv)->curveApprox.approxMethod ) { \
129
case PEXApproxImpDep: \
130
case PEXApproxConstantBetweenKnots: \
131
(_tolerance) = (_crv)->curveApprox.tolerance; \
134
(_tolerance) = 1.0; \
137
#define ADD_POINT_TO_LIST( _l, _r, _op, _pt ) \
139
listofddPoint *pddlist; \
140
if ( (_op) == PT_MOVE ) { \
142
MI_ALLOCLISTHEADER( (_l), \
143
MI_ROUND_LISTHEADERCOUNT( (_l)->numLists ) ); \
145
pddlist = &((_l)->ddList[(_l)->numLists-1]); \
146
pddlist->numPoints++; \
148
MI_ALLOCLISTOFDDPOINT( pddlist, \
149
MI_ROUND_LISTHEADERCOUNT(pddlist->numPoints),\
150
sizeof(ddCoord4D) ); \
151
pddlist->pts.p4Dpt[pddlist->numPoints - 1] = *((ddCoord4D *)(_pt)); \
153
MI_ALLOCLISTOFDDPOINT( pddlist, \
154
MI_ROUND_LISTHEADERCOUNT(pddlist->numPoints),\
155
sizeof(ddCoord3D) ); \
156
pddlist->pts.p3Dpt[pddlist->numPoints - 1] = *((ddCoord3D *)(_pt)); \
168
NURB_SAME_CONTOUR = 0,
169
NURB_NEW_CONTOUR = 1,
177
unsigned markers: 1; /* first order in u and v, use markers */
181
unsigned trim_data: 1;
205
typedef struct Nurb_trim_segment {
206
int first, last; /* indices in vertex list */
207
int start, end; /* effective limit of seg */
211
Nurb_param_limit extent; /* of segment */
212
struct Nurb_trim_segment *next;
216
Nurb_param_limit extent; /* of loop */
217
Nurb_trim_segment *segs; /* linked list of segments, NULL terminated */
218
} Nurb_trim_loop_rep;
222
int count; /* of rectangles this point is part of */
226
int next, prev, branch;
230
Nurb_param_point *vertices; /* of tessellated curves */
231
int cur_vertex; /* index of current vertex */
233
Nurb_trim_loop_rep *loops; /* array of representations */
234
Nurb_edge_point *ep_list; /* polygon edge points */
235
int ep_index; /* index of current one */
236
int ep_list_size; /* # allocated entries */
240
Nurb_edge_point *pts;
242
Nurb_param_limit extent;
257
ddFLOAT approx_value[2];
258
Nurb_param_limit range;
259
Nurb_param_limit param_limits;
264
Nurb_trim_data trim_data;
265
Nurb_param_point corners[5];
266
Nurb_trim_segment edge_segs[4];
267
miListHeader *facets;
268
miSOFASStruct *sofas;
270
miListHeader *isocrvs;
271
miListHeader *markers;
272
miListHeader *hollow;
275
#endif /* MI_NURB_H */