2 ** License Applicability. Except to the extent portions of this file are
3 ** made subject to an alternative license as permitted in the SGI Free
4 ** Software License B, Version 1.1 (the "License"), the contents of this
5 ** file are subject only to the provisions of the License. You may not use
6 ** this file except in compliance with the License. You may obtain a copy
7 ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
8 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
10 ** http://oss.sgi.com/projects/FreeB
12 ** Note that, as provided in the License, the Software is distributed on an
13 ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
14 ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
15 ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
16 ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
18 ** Original Code. The Original Code is: OpenGL Sample Implementation,
19 ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
20 ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
21 ** Copyright in any portions created by third parties is as indicated
22 ** elsewhere herein. All Rights Reserved.
24 ** Additional Notice Provisions: The application programming interfaces
25 ** established by SGI in conjunction with the Original Code are The
26 ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
27 ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
28 ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
29 ** Window System(R) (Version 1.3), released October 19, 1998. This software
30 ** was created using the OpenGL(R) version 1.2.1 Sample Implementation
31 ** published by SGI, but has not been independently verified as being
32 ** compliant with the OpenGL(R) version 1.2.1 Specification.
34 ** $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
37 ** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/gridWrap.h,v 1.1 2001/03/17 00:25:41 brianp Exp $
44 #include "definitions.h"
46 #include "primitiveStream.h"
55 /*cache the coordinate values for efficiency.
56 *these are redundant information when
59 Real
* u_values
; /*size is n_ulines*/
60 Real
* v_values
; /*size is n_vlines*/
65 //uniform grid constructor
66 gridWrap(Int nUlines
, Int nVlines
,
71 //nonuniform grid constructor.
72 gridWrap(Int nUlines
, Real
*uvals
,
73 Int nVlines
, Real
*vvlas
78 Int
get_n_ulines() {return n_ulines
;}
79 Int
get_n_vlines() {return n_vlines
;}
80 Real
get_u_min() {return u_min
;}
81 Real
get_u_max() {return u_max
;}
82 Real
get_v_min() {return v_min
;}
83 Real
get_v_max() {return v_max
;}
85 Real
get_u_value(Int i
)
88 /*if(i>=n_ulines){printf("ERROR, n_ulines=%i,i=%i\n",n_ulines,i);exit(0);}*/
90 Real
get_v_value(Int j
) {return v_values
[j
];}
92 Real
* get_u_values() {return u_values
;}
93 Real
* get_v_values() {return v_values
;}
95 void outputFanWithPoint(Int v
, Int uleft
, Int uright
,
96 Real vert
[2], primStream
* pStream
);
100 Int
isUniform() {return is_uniform
;}
103 class gridBoundaryChain
{
107 Int
* ulineIndices
; /*each v line has a boundary*/
108 Int
* innerIndices
; /*the segment of the vertical gridline from */
109 /*(innerIndices[i], i) to (innerIndices[i+1], i-1) */
110 /*is inside the polygon: i=1,...,nVlines-1*/
112 Real2
* vertices
; /*one grid point at each grid V-line, cached for efficiency*/
115 gridBoundaryChain(gridWrap
* gr
, Int first_vline_index
, Int n_vlines
, Int
* uline_indices
, Int
* inner_indices
);
124 /*i indexes the vlines in this chain.
126 Int
getVlineIndex(Int i
) {return firstVlineIndex
-i
;}
127 Int
getUlineIndex(Int i
) {return ulineIndices
[i
];}
128 Real
get_u_value(Int i
) {return vertices
[i
][0];}
129 Real
get_v_value(Int i
) {return vertices
[i
][1];}
130 Int
get_nVlines() {return nVlines
;}
131 Int
getInnerIndex(Int i
) {return innerIndices
[i
];}
132 Real
getInner_u_value(Int i
) {return grid
->get_u_value(innerIndices
[i
]);}
134 Real
* get_vertex(Int i
) {return vertices
[i
];}
135 gridWrap
* getGrid() {return grid
;}
136 void leftEndFan(Int i
, primStream
* pStream
);
137 void rightEndFan(Int i
, primStream
* pStream
);
139 Int
lookfor(Real v
, Int i1
, Int i2
); //find i in [i1,i2] so that vertices[i][1]>= v > vertices[i+1][1]