ReactOS 0.4.16-dev-250-g3ecd236
Subdivider Class Reference

#include <subdivider.h>

Collaboration diagram for Subdivider:

Public Member Functions

 Subdivider (Renderhints &, Backend &)
 
 ~Subdivider (void)
 
void clear (void)
 
void beginTrims (void)
 
void beginLoop (void)
 
void addArc (REAL *, Quilt *, long)
 
void addArc (int, TrimVertex *, long)
 
void endLoop (void)
 
void endTrims (void)
 
void beginQuilts (void)
 
void addQuilt (Quilt *)
 
void endQuilts (void)
 
void drawCurves (void)
 
void drawSurfaces (long)
 
int ccwTurn_sl (Arc_ptr, Arc_ptr)
 
int ccwTurn_sr (Arc_ptr, Arc_ptr)
 
int ccwTurn_tl (Arc_ptr, Arc_ptr)
 
int ccwTurn_tr (Arc_ptr, Arc_ptr)
 
void setJumpbuffer (JumpBuffer *)
 
void set_domain_distance_u_rate (REAL u_rate)
 
void set_domain_distance_v_rate (REAL v_rate)
 
void set_is_domain_distance_sampling (int flag)
 

Private Types

enum  dir { down , same , up , none }
 

Private Member Functions

void classify_headonleft_s (Bin &, Bin &, Bin &, REAL)
 
void classify_tailonleft_s (Bin &, Bin &, Bin &, REAL)
 
void classify_headonright_s (Bin &, Bin &, Bin &, REAL)
 
void classify_tailonright_s (Bin &, Bin &, Bin &, REAL)
 
void classify_headonleft_t (Bin &, Bin &, Bin &, REAL)
 
void classify_tailonleft_t (Bin &, Bin &, Bin &, REAL)
 
void classify_headonright_t (Bin &, Bin &, Bin &, REAL)
 
void classify_tailonright_t (Bin &, Bin &, Bin &, REAL)
 
void tessellate (Arc_ptr, REAL)
 
void monotonize (Arc_ptr, Bin &)
 
int isMonotone (Arc_ptr)
 
int decompose (Bin &, REAL)
 
void samplingSplit (Curvelist &, int)
 
void subdivideInS (Bin &)
 
void splitInS (Bin &, int, int)
 
void splitInT (Bin &, int, int)
 
void samplingSplit (Bin &, Patchlist &, int, int)
 
void nonSamplingSplit (Bin &, Patchlist &, int, int)
 
void tessellation (Bin &, Patchlist &)
 
void monosplitInS (Bin &, int, int)
 
void monosplitInT (Bin &, int, int)
 
void outline (Bin &)
 
void freejarcs (Bin &)
 
void render (Bin &)
 
void split (Bin &, Bin &, Bin &, int, REAL)
 
void tessellate (Bin &, REAL, REAL, REAL, REAL)
 
void setDegenerate (void)
 
void setNonDegenerate (void)
 
int showingDegenerate (void)
 
void setArcTypeBezier (void)
 
void setArcTypePwl (void)
 
int isBezierArcType (void)
 
void makeBorderTrim (const REAL *, const REAL *)
 
void split (Bin &, int, const REAL *, int, int)
 
void partition (Bin &, Bin &, Bin &, Bin &, Bin &, int, REAL)
 
void findIrregularS (Bin &)
 
void findIrregularT (Bin &)
 
int bbox (TrimVertex *, TrimVertex *, TrimVertex *, int)
 
void join_s (Bin &, Bin &, Arc_ptr, Arc_ptr)
 
void join_t (Bin &, Bin &, Arc_ptr, Arc_ptr)
 
int arc_split (Arc_ptr, int, REAL, int)
 
void check_s (Arc_ptr, Arc_ptr)
 
void check_t (Arc_ptr, Arc_ptr)
 
void link (Arc_ptr, Arc_ptr, Arc_ptr, Arc_ptr)
 
void simple_link (Arc_ptr, Arc_ptr)
 
BinmakePatchBoundary (const REAL *from, const REAL *to)
 

Static Private Member Functions

static int bbox (REAL, REAL, REAL, REAL, REAL, REAL)
 
static int ccw (TrimVertex *, TrimVertex *, TrimVertex *)
 

Private Attributes

Slicer slicer
 
ArcTessellator arctessellator
 
Pool arcpool
 
Pool bezierarcpool
 
Pool pwlarcpool
 
TrimVertexPool trimvertexpool
 
JumpBuffer * jumpbuffer
 
Renderhintsrenderhints
 
Backendbackend
 
Bin initialbin
 
Arc_ptr pjarc
 
int s_index
 
int t_index
 
Quiltqlist
 
Flist spbrkpts
 
Flist tpbrkpts
 
Flist smbrkpts
 
Flist tmbrkpts
 
REAL stepsizes [4]
 
int showDegenerate
 
int isArcTypeBezier
 
REAL domain_distance_u_rate
 
REAL domain_distance_v_rate
 
int is_domain_distance_sampling
 

Detailed Description

Definition at line 55 of file subdivider.h.

Member Enumeration Documentation

◆ dir

Enumerator
down 
same 
up 
none 

Definition at line 105 of file subdivider.h.

Constructor & Destructor Documentation

◆ Subdivider()

Subdivider::Subdivider ( Renderhints r,
Backend b 
)

Definition at line 112 of file subdivider.cc.

113 : slicer( b ),
115 arcpool( sizeof( Arc), 1, "arcpool" ),
116 bezierarcpool( sizeof( BezierArc ), 1, "Bezarcpool" ),
117 pwlarcpool( sizeof( PwlArc ), 1, "Pwlarcpool" ),
118 renderhints( r ),
119 backend( b )
120{
121}
Definition: arc.h:55
Definition: pwlarc.h:44
Pool bezierarcpool
Definition: subdivider.h:115
Renderhints & renderhints
Definition: subdivider.h:120
ArcTessellator arctessellator
Definition: subdivider.h:113
Backend & backend
Definition: subdivider.h:121
Pool pwlarcpool
Definition: subdivider.h:116
Slicer slicer
Definition: subdivider.h:112
Pool arcpool
Definition: subdivider.h:114
TrimVertexPool trimvertexpool
Definition: subdivider.h:117
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLboolean GLboolean GLboolean b
Definition: glext.h:6204

◆ ~Subdivider()

Subdivider::~Subdivider ( void  )

Definition at line 148 of file subdivider.cc.

149{
150}

Member Function Documentation

◆ addArc() [1/2]

void Subdivider::addArc ( int  npts,
TrimVertex pts,
long  _nuid 
)

Definition at line 177 of file subdivider.cc.

178{
179 Arc *jarc = new(arcpool) Arc( arc_none, _nuid );
180 jarc->pwlArc = new(pwlarcpool) PwlArc( npts, pts );
181 initialbin.addarc( jarc );
182 pjarc = jarc->append( pjarc );
183}
Arc_ptr append(Arc_ptr)
Definition: arc.cc:335
PwlArc * pwlArc
Definition: arc.h:65
void addarc(Arc_ptr)
Definition: bin.h:70
Bin initialbin
Definition: subdivider.h:123
Arc_ptr pjarc
Definition: subdivider.h:124
@ arc_none
Definition: arc.h:52

◆ addArc() [2/2]

void Subdivider::addArc ( REAL cpts,
Quilt quilt,
long  _nuid 
)

Definition at line 157 of file subdivider.cc.

158{
159 BezierArc *bezierArc = new(bezierarcpool) BezierArc;
160 Arc *jarc = new(arcpool) Arc( arc_none, _nuid );
161 jarc->pwlArc = 0;
162 jarc->bezierArc = bezierArc;
163 bezierArc->order = quilt->qspec->order;
164 bezierArc->stride = quilt->qspec->stride;
165 bezierArc->mapdesc = quilt->mapdesc;
166 bezierArc->cpts = cpts;
167 initialbin.addarc( jarc );
168 pjarc = jarc->append( pjarc );
169}
BezierArc * bezierArc
Definition: arc.h:64
Mapdesc * mapdesc
Definition: quilt.h:67
Quiltspec qspec[MAXDIM]
Definition: quilt.h:69
Mapdesc * mapdesc
Definition: bezierarc.h:48
REAL * cpts
Definition: bezierarc.h:44
int stride
Definition: bezierarc.h:46
int order
Definition: bezierarc.h:45
int order
Definition: quilt.h:55
int stride
Definition: quilt.h:52

Referenced by NurbsTessellator::do_endsurface().

◆ addQuilt()

void Subdivider::addQuilt ( Quilt quilt)

Definition at line 192 of file subdivider.cc.

193{
194 quilt->next = qlist;
195 qlist = quilt;
196}
Quilt * next
Definition: quilt.h:71
Quilt * qlist
Definition: subdivider.h:127

Referenced by NurbsTessellator::do_endcurve(), and NurbsTessellator::do_endsurface().

◆ arc_split()

int Subdivider::arc_split ( Arc_ptr  jarc,
int  param,
REAL  value,
int  dir 
)
private

Definition at line 175 of file intersect.cc.

176{
177 int maxvertex = jarc->pwlArc->npts;
178 Arc_ptr jarc1;
179 TrimVertex* v = jarc->pwlArc->pts;
180
181 int loc[3];
182 switch( pwlarc_intersect( jarc->pwlArc, param, value, dir, loc ) ) {
183
184 // When the parameter value lands on a vertex, life is sweet
185 case INTERSECT_VERTEX: {
186 jarc1 = new(arcpool) Arc( jarc, new( pwlarcpool) PwlArc( maxvertex-loc[1], &v[loc[1]] ) );
187 jarc->pwlArc->npts = loc[1] + 1;
188 jarc1->next = jarc->next;
189 jarc1->next->prev = jarc1;
190 jarc->next = jarc1;
191 jarc1->prev = jarc;
192 assert(jarc->check() != 0);
193 return 2;
194 }
195
196 // When the parameter value intersects an edge, we have to
197 // interpolate a new vertex. There are special cases
198 // if the new vertex is adjacent to one or both of the
199 // endpoints of the arc.
200 case INTERSECT_EDGE: {
201 int i, j;
202 if( dir == 0 ) {
203 i = loc[0];
204 j = loc[2];
205 } else {
206 i = loc[2];
207 j = loc[0];
208 }
209
210#ifndef NOTDEF
211 // The split is between vertices at index j and i, in that
212 // order (j < i)
213
214 // JEB: This code is my idea of how to do the split without
215 // increasing the number of links. I'm doing this so that
216 // the is_rect routine can recognize rectangles created by
217 // subdivision. In exchange for simplifying the curve list,
218 // however, it costs in allocated space and vertex copies.
219
220 TrimVertex *newjunk = trimvertexpool.get(maxvertex -i+1 /*-j*/);
221 int k;
222 for(k=0; k<maxvertex-i; k++)
223 {
224 newjunk[k+1] = v[i+k];
225 newjunk[k+1].nuid = jarc->nuid;
226 }
227
228 TrimVertex *vcopy = trimvertexpool.get(maxvertex);
229 for(k=0; k<maxvertex; k++)
230 {
231 vcopy[k].param[0] = v[k].param[0];
232 vcopy[k].param[1] = v[k].param[1];
233 }
234 jarc->pwlArc->pts=vcopy;
235
236 v[i].nuid = jarc->nuid;
237 v[j].nuid = jarc->nuid;
238 vert_interp( &newjunk[0], &v[loc[0]], &v[loc[2]], param, value );
239
240 if( showingDegenerate() )
241 backend.triangle( &v[i], &newjunk[0], &v[j] );
242
243 vcopy[j+1].param[0]=newjunk[0].param[0];
244 vcopy[j+1].param[1]=newjunk[0].param[1];
245
246
247 jarc1 = new(arcpool) Arc( jarc,
248 new(pwlarcpool) PwlArc(maxvertex-i+1 , newjunk ) );
249
250 jarc->pwlArc->npts = j+2;
251 jarc1->next = jarc->next;
252 jarc1->next->prev = jarc1;
253 jarc->next = jarc1;
254 jarc1->prev = jarc;
255 assert(jarc->check() != 0);
256
257 return 2;
258#endif //not NOTDEF
259 // JEB: This is the original version:
260#ifdef NOTDEF
261 Arc_ptr jarc2, jarc3;
262
263 TrimVertex *newjunk = trimvertexpool.get(3);
264 v[i].nuid = jarc->nuid;
265 v[j].nuid = jarc->nuid;
266 newjunk[0] = v[j];
267 newjunk[2] = v[i];
268 vert_interp( &newjunk[1], &v[loc[0]], &v[loc[2]], param, value );
269
270 if( showingDegenerate() )
271 backend.triangle( &newjunk[2], &newjunk[1], &newjunk[0] );
272
273 // New vertex adjacent to both endpoints
274 if (maxvertex == 2) {
275 jarc1 = new(arcpool) Arc( jarc, new(pwlarcpool) PwlArc( 2, newjunk+1 ) );
276 jarc->pwlArc->npts = 2;
277 jarc->pwlArc->pts = newjunk;
278 jarc1->next = jarc->next;
279 jarc1->next->prev = jarc1;
280 jarc->next = jarc1;
281 jarc1->prev = jarc;
282 assert(jarc->check() != 0);
283
284 return 2;
285
286 // New vertex adjacent to ending point of arc
287 } else if (maxvertex - j == 2) {
288 jarc1 = new(arcpool) Arc( jarc, new(pwlarcpool) PwlArc( 2, newjunk ) );
289 jarc2 = new(arcpool) Arc( jarc, new(pwlarcpool) PwlArc( 2, newjunk+1 ) );
290 jarc->pwlArc->npts = maxvertex-1;
291 jarc2->next = jarc->next;
292 jarc2->next->prev = jarc2;
293 jarc->next = jarc1;
294 jarc1->prev = jarc;
295 jarc1->next = jarc2;
296 jarc2->prev = jarc1;
297 assert(jarc->check() != 0);
298 return 31;
299
300 // New vertex adjacent to starting point of arc
301 } else if (i == 1) {
302 jarc1 = new(arcpool) Arc( jarc, new(pwlarcpool) PwlArc( 2, newjunk+1 ) );
303 jarc2 = new(arcpool) Arc( jarc,
304 new(pwlarcpool) PwlArc( maxvertex-1, &jarc->pwlArc->pts[1] ) );
305 jarc->pwlArc->npts = 2;
306 jarc->pwlArc->pts = newjunk;
307 jarc2->next = jarc->next;
308 jarc2->next->prev = jarc2;
309 jarc->next = jarc1;
310 jarc1->prev = jarc;
311 jarc1->next = jarc2;
312 jarc2->prev = jarc1;
313 assert(jarc->check() != 0);
314 return 32;
315
316 // It's somewhere in the middle
317 } else {
318 jarc1 = new(arcpool) Arc( jarc, new(pwlarcpool) PwlArc( 2, newjunk ) );
319 jarc2 = new(arcpool) Arc( jarc, new(pwlarcpool) PwlArc( 2, newjunk+1 ) );
320 jarc3 = new(arcpool) Arc( jarc, new(pwlarcpool) PwlArc( maxvertex-i, v+i ) );
321 jarc->pwlArc->npts = j + 1;
322 jarc3->next = jarc->next;
323 jarc3->next->prev = jarc3;
324 jarc->next = jarc1;
325 jarc1->prev = jarc;
326 jarc1->next = jarc2;
327 jarc2->prev = jarc1;
328 jarc2->next = jarc3;
329 jarc3->prev = jarc2;
330 assert(jarc->check() != 0);
331 return 4;
332 }
333#endif // NOTDEF
334 }
335 default:
336 return -1; //picked -1 since it's not used
337 }
338}
void triangle(TrimVertex *, TrimVertex *, TrimVertex *)
Definition: backend.cc:517
int npts
Definition: pwlarc.h:47
int showingDegenerate(void)
Definition: subdivider.h:155
TrimVertex * get(int)
REAL param[2]
Definition: trimvertex.h:45
long nuid
Definition: trimvertex.h:50
class Arc * Arc_ptr
Definition: arc.h:50
#define assert(x)
Definition: debug.h:53
const GLdouble * v
Definition: gl.h:2040
GLfloat param
Definition: glext.h:5796
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
@ INTERSECT_VERTEX
Definition: intersect.cc:51
@ INTERSECT_EDGE
Definition: intersect.cc:51
static void vert_interp(TrimVertex *n, TrimVertex *l, TrimVertex *r, int p, REAL val)
Definition: intersect.cc:157
static enum i_result pwlarc_intersect(PwlArc *, int, REAL, int, int[3])
Definition: intersect.cc:346
int k
Definition: mpi.c:3369
Definition: pdh_main.c:94

Referenced by partition().

◆ bbox() [1/2]

int Subdivider::bbox ( REAL  sa,
REAL  sb,
REAL  sc,
REAL  ta,
REAL  tb,
REAL  tc 
)
staticprivate

Definition at line 511 of file ccw.cc.

516{
517#ifndef NDEBUG
518 assert( tc >= ta );
519 assert( tc <= tb );
520#endif
521
522 if( sa < sb ) {
523 if( sc <= sa ) {
524 return -1;
525 } else if( sb <= sc ) {
526 return 1;
527 } else {
528 return 0;
529 }
530 } else if( sa > sb ) {
531 if( sc >= sa ) {
532 return 1;
533 } else if( sb >= sc ) {
534 return -1;
535 } else {
536 return 0;
537 }
538 } else {
539 if( sc > sa ) {
540 return 1;
541 } else if( sb > sc ) {
542 return -1;
543 } else {
544 return 0;
545 }
546 }
547}
static struct sockaddr_in sa
Definition: adnsresfilter.c:69
superblock * sb
Definition: btrfs.c:4261
const GLfloat * tc
Definition: glext.h:8925
static const WCHAR tb[]
Definition: suminfo.c:285

◆ bbox() [2/2]

int Subdivider::bbox ( TrimVertex a,
TrimVertex b,
TrimVertex c,
int  p 
)
inlineprivate

Definition at line 50 of file ccw.cc.

51{
52 return bbox( a->param[p], b->param[p], c->param[p],
53 a->param[1-p], b->param[1-p], c->param[1-p] );
54}
FT_BBox bbox
Definition: ftbbox.c:446
const GLubyte * c
Definition: glext.h:8905
GLfloat GLfloat p
Definition: glext.h:8902
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

◆ beginLoop()

void Subdivider::beginLoop ( void  )
inline

Definition at line 194 of file subdivider.h.

195{
196 pjarc = 0;
197}

Referenced by NurbsTessellator::do_endsurface().

◆ beginQuilts()

void Subdivider::beginQuilts ( void  )

Definition at line 186 of file subdivider.cc.

187{
188 qlist = 0;
189}

Referenced by NurbsTessellator::do_endcurve(), and NurbsTessellator::do_endsurface().

◆ beginTrims()

void Subdivider::beginTrims ( void  )
inline

Definition at line 61 of file subdivider.h.

61{}

Referenced by NurbsTessellator::do_endsurface().

◆ ccw()

int Subdivider::ccw ( TrimVertex a,
TrimVertex b,
TrimVertex c 
)
staticprivate

Definition at line 558 of file ccw.cc.

559{
560 REAL d = det3( a, b, c );
561 if( glu_abs(d) < 0.0001 ) return -1;
562 return (d < 0.0) ? 0 : 1;
563}
float REAL
Definition: types.h:41
#define d
Definition: ke_i.h:81
REAL glu_abs(REAL x)
Definition: simplemath.h:50
REAL det3(TrimVertex *a, TrimVertex *b, TrimVertex *c)
Definition: trimvertex.h:56

Referenced by ccwTurn_sl(), ccwTurn_sr(), ccwTurn_tl(), and ccwTurn_tr().

◆ ccwTurn_sl()

int Subdivider::ccwTurn_sl ( Arc_ptr  j1,
Arc_ptr  j2 
)

Definition at line 170 of file ccw.cc.

171{
172 TrimVertex *v1 = &j1->pwlArc->pts[j1->pwlArc->npts-1];
173 TrimVertex *v1last = &j1->pwlArc->pts[0];
174 TrimVertex *v2 = &j2->pwlArc->pts[0];
175 TrimVertex *v2last = &j2->pwlArc->pts[j2->pwlArc->npts-1];
176 TrimVertex *v1next = v1-1;
177 TrimVertex *v2next = v2+1;
178 int sgn;
179
180 assert( v1 != v1last );
181 assert( v2 != v2last );
182
183#ifndef NDEBUG
184 _glu_dprintf( "arc_ccw_turn, p = %d\n", 0 );
185#endif
186
187 // the arcs lie on the line (0 == v1->param[0])
188 if( v1->param[0] == v1next->param[0] && v2->param[0] == v2next->param[0] )
189 return 0;
190
191 if( v2next->param[0] > v2->param[0] || v1next->param[0] > v1->param[0] )
192 ::mylongjmp( jumpbuffer, 28 );
193
194 if( v1->param[1] < v2->param[1] )
195 return 1;
196 else if( v1->param[1] > v2->param[1] )
197 return 0;
198
199 while( 1 ) {
200 if( v1next->param[0] > v2next->param[0] ) {
201#ifndef NDEBUG
202 _glu_dprintf( "case c\n" );
203#endif
204 assert( v1->param[0] >= v1next->param[0] );
205 assert( v2->param[0] >= v1next->param[0] );
206 switch( bbox( v2next, v2, v1next, 1 ) ) {
207 case -1:
208 return 1;
209 case 0:
210 sgn = ccw( v1next, v2, v2next );
211 if( sgn != -1 )
212 return sgn;
213 else {
214 v1 = v1next--;
215#ifdef DEBUG
216 _glu_dprintf( "decr\n" );
217#endif
218 if( v1 == v1last ) {
219#ifdef DEBUG
220 _glu_dprintf( "no good results\n" );
221#endif
222 return 0; // ill-conditioned, guess answer
223 }
224 }
225 break;
226 case 1:
227 return 0;
228 }
229 } else if( v1next->param[0] < v2next->param[0] ) {
230#ifndef NDEBUG
231 _glu_dprintf( "case d\n" );
232#endif
233 assert( v1->param[0] >= v2next->param[0] );
234 assert( v2->param[0] >= v2next->param[0] );
235 switch( bbox( v1next, v1, v2next, 1 ) ) {
236 case -1:
237 return 0;
238 case 0:
239 sgn = ccw( v1next, v1, v2next );
240 if( sgn != -1 )
241 return sgn;
242 else {
243 v2 = v2next++;
244#ifdef DEBUG
245 _glu_dprintf( "incr\n" );
246#endif
247 if( v2 == v2last ) {
248#ifdef DEBUG
249 _glu_dprintf( "no good results\n" );
250#endif
251 return 0; // ill-conditioned, guess answer
252 }
253 }
254 break;
255 case 1:
256 return 1;
257 }
258 } else {
259#ifdef DEBUG
260 _glu_dprintf( "case cd\n" );
261#endif
262 if( v1next->param[1] < v2next->param[1] )
263 return 1;
264 else if( v1next->param[1] > v2next->param[1] )
265 return 0;
266 else {
267 v2 = v2next++;
268#ifdef DEBUG
269 _glu_dprintf( "incr\n" );
270#endif
271 if( v2 == v2last ) {
272#ifdef DEBUG
273 _glu_dprintf( "no good results\n" );
274#endif
275 return 0; // ill-conditioned, guess answer
276 }
277 }
278 }
279 }
280}
static int ccw(TrimVertex *, TrimVertex *, TrimVertex *)
Definition: ccw.cc:558
JumpBuffer * jumpbuffer
Definition: subdivider.h:119
GLfloat GLfloat v1
Definition: glext.h:6062
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063
long sgn(REAL x)
Definition: varray.cc:48

Referenced by classify_headonleft_s(), classify_tailonleft_s(), findIrregularT(), and ArcSdirSorter::qscmp().

◆ ccwTurn_sr()

int Subdivider::ccwTurn_sr ( Arc_ptr  j1,
Arc_ptr  j2 
)

Definition at line 57 of file ccw.cc.

58{
59 TrimVertex *v1 = &j1->pwlArc->pts[j1->pwlArc->npts-1];
60 TrimVertex *v1last = &j1->pwlArc->pts[0];
61 TrimVertex *v2 = &j2->pwlArc->pts[0];
62 TrimVertex *v2last = &j2->pwlArc->pts[j2->pwlArc->npts-1];
63 TrimVertex *v1next = v1-1;
64 TrimVertex *v2next = v2+1;
65 int sgn;
66
67 assert( v1 != v1last );
68 assert( v2 != v2last );
69
70#ifndef NDEBUG
71 _glu_dprintf( "arc_ccw_turn, p = %d\n", 0 );
72#endif
73
74 // the arcs lie on the line (0 == v1->param[0])
75 if( v1->param[0] == v1next->param[0] && v2->param[0] == v2next->param[0] )
76 return 0;
77
78 if( v2next->param[0] < v2->param[0] || v1next->param[0] < v1->param[0] )
79 ::mylongjmp( jumpbuffer, 28 );
80
81 if( v1->param[1] < v2->param[1] )
82 return 0;
83 else if( v1->param[1] > v2->param[1] )
84 return 1;
85
86 while( 1 ) {
87 if( v1next->param[0] < v2next->param[0] ) {
88#ifndef NDEBUG
89 _glu_dprintf( "case a\n" );
90#endif
91 assert( v1->param[0] <= v1next->param[0] );
92 assert( v2->param[0] <= v1next->param[0] );
93 switch( bbox( v2, v2next, v1next, 1 ) ) {
94 case -1:
95 return 0;
96 case 0:
97 sgn = ccw( v1next, v2, v2next );
98 if( sgn != -1 ) {
99 return sgn;
100 } else {
101#ifdef DEBUG
102 _glu_dprintf( "decr\n" );
103#endif
104 v1 = v1next--;
105 if( v1 == v1last ) {
106#ifdef DEBUG
107 _glu_dprintf( "no good results\n" );
108#endif
109 return 0; // ill-conditioned, guess answer
110 }
111 }
112 break;
113 case 1:
114 return 1;
115 }
116 } else if( v1next->param[0] > v2next->param[0] ) {
117#ifndef NDEBUG
118 _glu_dprintf( "case b\n" );
119#endif
120 assert( v1->param[0] <= v2next->param[0] );
121 assert( v2->param[0] <= v2next->param[0] );
122 switch( bbox( v1, v1next, v2next, 1 ) ) {
123 case -1:
124 return 1;
125 case 0:
126 sgn = ccw( v1next, v1, v2next );
127 if( sgn != -1 ) {
128 return sgn;
129 } else {
130#ifdef DEBUG
131 _glu_dprintf( "incr\n" );
132#endif
133 v2 = v2next++;
134 if( v2 == v2last ) {
135#ifdef DEBUG
136 _glu_dprintf( "no good results\n" );
137#endif
138 return 0; // ill-conditioned, guess answer
139 }
140 }
141 break;
142 case 1:
143 return 0;
144 }
145 } else {
146#ifndef NDEBUG
147 _glu_dprintf( "case ab\n" );
148#endif
149 if( v1next->param[1] < v2next->param[1] )
150 return 0;
151 else if( v1next->param[1] > v2next->param[1] )
152 return 1;
153 else {
154#ifdef DEBUG
155 _glu_dprintf( "incr\n" );
156#endif
157 v2 = v2next++;
158 if( v2 == v2last ) {
159#ifdef DEBUG
160 _glu_dprintf( "no good results\n" );
161#endif
162 return 0; // ill-conditioned, guess answer
163 }
164 }
165 }
166 }
167}

Referenced by classify_headonright_s(), classify_tailonright_s(), findIrregularT(), and ArcSdirSorter::qscmp().

◆ ccwTurn_tl()

int Subdivider::ccwTurn_tl ( Arc_ptr  j1,
Arc_ptr  j2 
)

Definition at line 396 of file ccw.cc.

397{
398 TrimVertex *v1 = &j1->pwlArc->pts[j1->pwlArc->npts-1];
399 TrimVertex *v1last = &j1->pwlArc->pts[0];
400 TrimVertex *v2 = &j2->pwlArc->pts[0];
401 TrimVertex *v2last = &j2->pwlArc->pts[j2->pwlArc->npts-1];
402 TrimVertex *v1next = v1-1;
403 TrimVertex *v2next = v2+1;
404 int sgn;
405
406 assert( v1 != v1last );
407 assert( v2 != v2last );
408
409#ifndef NDEBUG
410 _glu_dprintf( "arc_ccw_turn, p = %d\n", 1 );
411#endif
412
413 // the arcs lie on the line (1 == v1->param[1])
414 if( v1->param[1] == v1next->param[1] && v2->param[1] == v2next->param[1] )
415 return 0;
416
417 if( v2next->param[1] > v2->param[1] || v1next->param[1] > v1->param[1] )
418 ::mylongjmp( jumpbuffer, 28 );
419
420 if( v1->param[0] < v2->param[0] )
421 return 0;
422 else if( v1->param[0] > v2->param[0] )
423 return 1;
424
425 while( 1 ) {
426 if( v1next->param[1] > v2next->param[1] ) {
427#ifndef NDEBUG
428 _glu_dprintf( "case c\n" );
429#endif
430 assert( v1->param[1] >= v1next->param[1] );
431 assert( v2->param[1] >= v1next->param[1] );
432 switch( bbox( v2next, v2, v1next, 0 ) ) {
433 case -1:
434 return 0;
435 case 0:
436 sgn = ccw( v1next, v2, v2next );
437 if( sgn != -1 )
438 return sgn;
439 else {
440 v1 = v1next--;
441#ifdef DEBUG
442 _glu_dprintf( "decr\n" );
443#endif
444 if( v1 == v1last ) {
445#ifdef DEBUG
446 _glu_dprintf( "no good results\n" );
447#endif
448 return 0; // ill-conditioned, guess answer
449 }
450 }
451 break;
452 case 1:
453 return 1;
454 }
455 } else if( v1next->param[1] < v2next->param[1] ) {
456#ifndef NDEBUG
457 _glu_dprintf( "case d\n" );
458 assert( v1->param[1] >= v2next->param[1] );
459 assert( v2->param[1] >= v2next->param[1] );
460#endif
461 switch( bbox( v1next, v1, v2next, 0 ) ) {
462 case -1:
463 return 1;
464 case 0:
465 sgn = ccw( v1next, v1, v2next );
466 if( sgn != -1 )
467 return sgn;
468 else {
469 v2 = v2next++;
470#ifdef DEBUG
471 _glu_dprintf( "incr\n" );
472#endif
473 if( v2 == v2last ) {
474#ifdef DEBUG
475 _glu_dprintf( "no good results\n" );
476#endif
477 return 0; // ill-conditioned, guess answer
478 }
479 }
480 break;
481 case 1:
482 return 0;
483 }
484 } else {
485#ifdef DEBUG
486 _glu_dprintf( "case cd\n" );
487#endif
488 if( v1next->param[0] < v2next->param[0] )
489 return 0;
490 else if( v1next->param[0] > v2next->param[0] )
491 return 1;
492 else {
493 v2 = v2next++;
494#ifdef DEBUG
495 _glu_dprintf( "incr\n" );
496#endif
497 if( v2 == v2last ) {
498#ifdef DEBUG
499 _glu_dprintf( "no good results\n" );
500#endif
501 return 0; // ill-conditioned, guess answer
502 }
503 }
504 }
505 }
506}

Referenced by classify_headonleft_t(), classify_tailonleft_t(), and ArcTdirSorter::qscmp().

◆ ccwTurn_tr()

int Subdivider::ccwTurn_tr ( Arc_ptr  j1,
Arc_ptr  j2 
)

Definition at line 283 of file ccw.cc.

284{
285 TrimVertex *v1 = &j1->pwlArc->pts[j1->pwlArc->npts-1];
286 TrimVertex *v1last = &j1->pwlArc->pts[0];
287 TrimVertex *v2 = &j2->pwlArc->pts[0];
288 TrimVertex *v2last = &j2->pwlArc->pts[j2->pwlArc->npts-1];
289 TrimVertex *v1next = v1-1;
290 TrimVertex *v2next = v2+1;
291 int sgn;
292
293 assert( v1 != v1last );
294 assert( v2 != v2last );
295
296#ifndef NDEBUG
297 _glu_dprintf( "arc_ccw_turn, p = %d\n", 1 );
298#endif
299
300 // the arcs lie on the line (1 == v1->param[1])
301 if( v1->param[1] == v1next->param[1] && v2->param[1] == v2next->param[1] )
302 return 0;
303
304 if( v2next->param[1] < v2->param[1] || v1next->param[1] < v1->param[1] )
305 ::mylongjmp( jumpbuffer, 28 );
306
307 if( v1->param[0] < v2->param[0] )
308 return 1;
309 else if( v1->param[0] > v2->param[0] )
310 return 0;
311
312 while( 1 ) {
313 if( v1next->param[1] < v2next->param[1] ) {
314#ifndef NDEBUG
315 _glu_dprintf( "case a\n" );
316#endif
317 assert( v1->param[1] <= v1next->param[1] );
318 assert( v2->param[1] <= v1next->param[1] );
319 switch( bbox( v2, v2next, v1next, 0 ) ) {
320 case -1:
321 return 1;
322 case 0:
323 sgn = ccw( v1next, v2, v2next );
324 if( sgn != -1 ) {
325 return sgn;
326 } else {
327#ifdef DEBUG
328 _glu_dprintf( "decr\n" );
329#endif
330 v1 = v1next--;
331 if( v1 == v1last ) {
332#ifdef DEBUG
333 _glu_dprintf( "no good results\n" );
334#endif
335 return 0; // ill-conditioned, guess answer
336 }
337 }
338 break;
339 case 1:
340 return 0;
341 }
342 } else if( v1next->param[1] > v2next->param[1] ) {
343#ifndef NDEBUG
344 _glu_dprintf( "case b\n" );
345#endif
346 assert( v1->param[1] <= v2next->param[1] );
347 assert( v2->param[1] <= v2next->param[1] );
348 switch( bbox( v1, v1next, v2next, 0 ) ) {
349 case -1:
350 return 0;
351 case 0:
352 sgn = ccw( v1next, v1, v2next );
353 if( sgn != -1 ) {
354 return sgn;
355 } else {
356#ifdef DEBUG
357 _glu_dprintf( "incr\n" );
358#endif
359 v2 = v2next++;
360 if( v2 == v2last ) {
361#ifdef DEBUG
362 _glu_dprintf( "no good results\n" );
363#endif
364 return 0; // ill-conditioned, guess answer
365 }
366 }
367 break;
368 case 1:
369 return 1;
370 }
371 } else {
372#ifdef DEBUG
373 _glu_dprintf( "case ab\n" );
374#endif
375 if( v1next->param[0] < v2next->param[0] )
376 return 1;
377 else if( v1next->param[0] > v2next->param[0] )
378 return 0;
379 else {
380#ifdef DEBUG
381 _glu_dprintf( "incr\n" );
382#endif
383 v2 = v2next++;
384 if( v2 == v2last ) {
385#ifdef DEBUG
386 _glu_dprintf( "no good results\n" );
387#endif
388 return 0; // ill-conditioned, guess answer
389 }
390 }
391 }
392 }
393}

Referenced by classify_headonright_t(), classify_tailonright_t(), and ArcTdirSorter::qscmp().

◆ check_s()

void Subdivider::check_s ( Arc_ptr  jarc1,
Arc_ptr  jarc2 
)
private

Definition at line 122 of file splitarcs.cc.

123{
124 assert( jarc1->check( ) != 0 );
125 assert( jarc2->check( ) != 0 );
126 assert( jarc1->next->check( ) != 0 );
127 assert( jarc2->next->check( ) != 0 );
128 assert( jarc1 != jarc2 );
129
130 /* XXX - if these assertions fail, it is due to user error or
131 undersampling */
132 if( ! ( jarc1->tail()[0] < (jarc1)->head()[0] ) ) {
133#ifndef NDEBUG
134 _glu_dprintf( "s difference %f\n", (jarc1)->tail()[0] - (jarc1)->head()[0] );
135#endif
136 ::mylongjmp( jumpbuffer, 28 );
137 }
138
139 if( ! ( jarc2->tail()[0] > (jarc2)->head()[0] ) ) {
140#ifndef NDEBUG
141 _glu_dprintf( "s difference %f\n", (jarc2)->tail()[0] - (jarc2)->head()[0] );
142#endif
143 ::mylongjmp( jumpbuffer, 28 );
144 }
145}
struct outqueuenode * tail
Definition: adnsresfilter.c:66
struct outqueuenode * head
Definition: adnsresfilter.c:66

Referenced by split().

◆ check_t()

void Subdivider::check_t ( Arc_ptr  jarc1,
Arc_ptr  jarc2 
)
private

Definition at line 221 of file splitarcs.cc.

222{
223 assert( jarc1->check( ) != 0 );
224 assert( jarc2->check( ) != 0 );
225 assert( jarc1->next->check( ) != 0 );
226 assert( jarc2->next->check( ) != 0 );
227 assert( jarc1 != jarc2 );
228
229 /* XXX - if these assertions fail, it is due to user error or
230 undersampling */
231 if( ! ( jarc1->tail()[1] < (jarc1)->head()[1] ) ) {
232#ifndef NDEBUG
233 _glu_dprintf( "t difference %f\n", jarc1->tail()[1] - (jarc1)->head()[1] );
234#endif
235 ::mylongjmp( jumpbuffer, 28 );
236 }
237
238 if( ! ( jarc2->tail()[1] > (jarc2)->head()[1] ) ) {
239#ifndef NDEBUG
240 _glu_dprintf( "t difference %f\n", jarc2->tail()[1] - (jarc2)->head()[1] );
241#endif
242 ::mylongjmp( jumpbuffer, 28 );
243 }
244}

Referenced by split().

◆ classify_headonleft_s()

void Subdivider::classify_headonleft_s ( Bin bin,
Bin in,
Bin out,
REAL  val 
)
private

Definition at line 499 of file intersect.cc.

500{
501 /* tail on line, head at left */
502 Arc_ptr j;
503
504 while( (j = bin.removearc()) != NULL ) {
505 assert( arc_classify( j, 0, val ) == 0x20 );
506
507 j->setitail();
508
509 REAL diff = j->prev->tail()[0] - val;
510 if( diff > 0.0 ) {
511 out.addarc( j );
512 } else if( diff < 0.0 ) {
513 if( ccwTurn_sl( j->prev, j ) )
514 out.addarc( j );
515 else
516 in.addarc( j );
517 } else {
518 if( j->prev->tail()[1] > j->prev->head()[1] )
519 in.addarc( j );
520 else
521 out.addarc( j );
522 }
523 }
524}
int ccwTurn_sl(Arc_ptr, Arc_ptr)
Definition: ccw.cc:170
#define NULL
Definition: types.h:112
GLuint in
Definition: glext.h:9616
GLuint GLfloat * val
Definition: glext.h:7180
static int arc_classify(Arc_ptr, int, REAL)
Definition: intersect.cc:405
static struct _PeImage bin
static FILE * out
Definition: regtests2xml.c:44

Referenced by partition().

◆ classify_headonleft_t()

void Subdivider::classify_headonleft_t ( Bin bin,
Bin in,
Bin out,
REAL  val 
)
private

Definition at line 527 of file intersect.cc.

528{
529 /* tail on line, head at left */
530 Arc_ptr j;
531
532 while( (j = bin.removearc()) != NULL ) {
533 assert( arc_classify( j, 1, val ) == 0x20 );
534 j->setitail();
535
536 REAL diff = j->prev->tail()[1] - val;
537 if( diff > 0.0 ) {
538 out.addarc( j );
539 } else if( diff < 0.0 ) {
540 if( ccwTurn_tl( j->prev, j ) )
541 out.addarc( j );
542 else
543 in.addarc( j );
544 } else {
545 if( j->prev->tail()[0] > j->prev->head()[0] )
546 out.addarc( j );
547 else
548 in.addarc( j );
549 }
550 }
551}
int ccwTurn_tl(Arc_ptr, Arc_ptr)
Definition: ccw.cc:396

Referenced by partition().

◆ classify_headonright_s()

void Subdivider::classify_headonright_s ( Bin bin,
Bin in,
Bin out,
REAL  val 
)
private

Definition at line 611 of file intersect.cc.

612{
613 /* tail on line, head at right */
614 Arc_ptr j;
615
616 while( (j = bin.removearc()) != NULL ) {
617 assert( arc_classify( j, 0, val ) == 0x21 );
618
619 j->setitail();
620
621 REAL diff = j->prev->tail()[0] - val;
622 if( diff > 0.0 ) {
623 if( ccwTurn_sr( j->prev, j ) )
624 out.addarc( j );
625 else
626 in.addarc( j );
627 } else if( diff < 0.0 ) {
628 out.addarc( j );
629 } else {
630 if( j->prev->tail()[1] > j->prev->head()[1] )
631 out.addarc( j );
632 else
633 in.addarc( j );
634 }
635 }
636}
int ccwTurn_sr(Arc_ptr, Arc_ptr)
Definition: ccw.cc:57

Referenced by partition().

◆ classify_headonright_t()

void Subdivider::classify_headonright_t ( Bin bin,
Bin in,
Bin out,
REAL  val 
)
private

Definition at line 639 of file intersect.cc.

640{
641 /* tail on line, head at right */
642 Arc_ptr j;
643
644 while( (j = bin.removearc()) != NULL ) {
645 assert( arc_classify( j, 1, val ) == 0x21 );
646
647 j->setitail();
648
649 REAL diff = j->prev->tail()[1] - val;
650 if( diff > 0.0 ) {
651 if( ccwTurn_tr( j->prev, j ) )
652 out.addarc( j );
653 else
654 in.addarc( j );
655 } else if( diff < 0.0 ) {
656 out.addarc( j );
657 } else {
658 if( j->prev->tail()[0] > j->prev->head()[0] )
659 in.addarc( j );
660 else
661 out.addarc( j );
662 }
663 }
664}
int ccwTurn_tr(Arc_ptr, Arc_ptr)
Definition: ccw.cc:283

Referenced by partition().

◆ classify_tailonleft_s()

void Subdivider::classify_tailonleft_s ( Bin bin,
Bin in,
Bin out,
REAL  val 
)
private

Definition at line 445 of file intersect.cc.

446{
447 /* tail at left, head on line */
448 Arc_ptr j;
449
450 while( (j = bin.removearc()) != NULL ) {
451 assert( arc_classify( j, 0, val ) == 0x02 );
452 j->clearitail();
453
454 REAL diff = j->next->head()[0] - val;
455 if( diff > 0.0 ) {
456 in.addarc( j );
457 } else if( diff < 0.0 ) {
458 if( ccwTurn_sl( j, j->next ) )
459 out.addarc( j );
460 else
461 in.addarc( j );
462 } else {
463 if( j->next->tail()[1] > j->next->head()[1] )
464 in.addarc(j);
465 else
466 out.addarc(j);
467 }
468 }
469}

Referenced by partition().

◆ classify_tailonleft_t()

void Subdivider::classify_tailonleft_t ( Bin bin,
Bin in,
Bin out,
REAL  val 
)
private

Definition at line 472 of file intersect.cc.

473{
474 /* tail at left, head on line */
475 Arc_ptr j;
476
477 while( (j = bin.removearc()) != NULL ) {
478 assert( arc_classify( j, 1, val ) == 0x02 );
479 j->clearitail();
480
481 REAL diff = j->next->head()[1] - val;
482 if( diff > 0.0 ) {
483 in.addarc( j );
484 } else if( diff < 0.0 ) {
485 if( ccwTurn_tl( j, j->next ) )
486 out.addarc( j );
487 else
488 in.addarc( j );
489 } else {
490 if (j->next->tail()[0] > j->next->head()[0] )
491 out.addarc( j );
492 else
493 in.addarc( j );
494 }
495 }
496}

Referenced by partition().

◆ classify_tailonright_s()

void Subdivider::classify_tailonright_s ( Bin bin,
Bin in,
Bin out,
REAL  val 
)
private

Definition at line 555 of file intersect.cc.

556{
557 /* tail at right, head on line */
558 Arc_ptr j;
559
560 while( (j = bin.removearc()) != NULL ) {
561 assert( arc_classify( j, 0, val ) == 0x12);
562
563 j->clearitail();
564
565 REAL diff = j->next->head()[0] - val;
566 if( diff > 0.0 ) {
567 if( ccwTurn_sr( j, j->next ) )
568 out.addarc( j );
569 else
570 in.addarc( j );
571 } else if( diff < 0.0 ) {
572 in.addarc( j );
573 } else {
574 if( j->next->tail()[1] > j->next->head()[1] )
575 out.addarc( j );
576 else
577 in.addarc( j );
578 }
579 }
580}

Referenced by partition().

◆ classify_tailonright_t()

void Subdivider::classify_tailonright_t ( Bin bin,
Bin in,
Bin out,
REAL  val 
)
private

Definition at line 583 of file intersect.cc.

584{
585 /* tail at right, head on line */
586 Arc_ptr j;
587
588 while( (j = bin.removearc()) != NULL ) {
589 assert( arc_classify( j, 1, val ) == 0x12);
590
591 j->clearitail();
592
593 REAL diff = j->next->head()[1] - val;
594 if( diff > 0.0 ) {
595 if( ccwTurn_tr( j, j->next ) )
596 out.addarc( j );
597 else
598 in.addarc( j );
599 } else if( diff < 0.0 ) {
600 in.addarc( j );
601 } else {
602 if( j->next->tail()[0] > j->next->head()[0] )
603 in.addarc( j );
604 else
605 out.addarc( j );
606 }
607 }
608}

Referenced by partition().

◆ clear()

void Subdivider::clear ( void  )

Definition at line 135 of file subdivider.cc.

136{
138 arcpool.clear();
141}
void clear(void)
Definition: bufpool.cc:100
void clear(void)
Definition: trimvertpool.cc:81

Referenced by NurbsTessellator::resetObjects().

◆ decompose()

int Subdivider::decompose ( Bin bin,
REAL  geo_stepsize 
)
private

Definition at line 56 of file monotonizer.cc.

57{
58 Arc_ptr jarc;
59 for( jarc=bin.firstarc(); jarc; jarc=bin.nextarc() ) {
60 if( ! jarc->isTessellated() ) {
61 /* points have not been transformed, therefore they may be either
62 homogeneous or inhomogeneous */
63 tessellate( jarc, geo_stepsize );
64 if( jarc->isDisconnected() || jarc->next->isDisconnected() )
65 return 1;
66 }
67 }
68
69 for( jarc=bin.firstarc(); jarc; jarc=bin.nextarc() ) {
70 monotonize( jarc, bin );
71 }
72
73#ifndef NDEBUG
74 for( jarc=bin.firstarc(); jarc; jarc=bin.nextarc() ) {
75 assert( isMonotone( jarc ) != 0 );
76 }
77#endif
78
79 return 0;
80}
int isMonotone(Arc_ptr)
Definition: monotonizer.cc:210
void tessellate(Arc_ptr, REAL)
Definition: monotonizer.cc:83
void monotonize(Arc_ptr, Bin &)
Definition: monotonizer.cc:114

Referenced by drawSurfaces().

◆ drawCurves()

void Subdivider::drawCurves ( void  )

Definition at line 56 of file curvesub.cc.

57{
58 REAL from[1], to[1];
59 Flist bpts;
60 qlist->getRange( from, to, bpts );
61
63
65 for( int i=bpts.start; i<bpts.end-1; i++ ) {
66 REAL pta, ptb;
67 pta = bpts.pts[i];
68 ptb = bpts.pts[i+1];
69
70 qlist->downloadAll( &pta, &ptb, backend );
71
72 Curvelist curvelist( qlist, pta, ptb );
74 }
76}
void endcurv(void)
Definition: backend.cc:585
void bgncurv(void)
Definition: backend.cc:529
Definition: flist.h:42
REAL * pts
Definition: flist.h:44
int start
Definition: flist.h:46
int end
Definition: flist.h:47
void downloadAll(REAL *, REAL *, Backend &)
Definition: quilt.cc:157
void getRange(REAL *, REAL *, Flist &, Flist &)
Definition: quilt.cc:186
int maxsubdivisions
Definition: renderhints.h:55
void init(void)
Definition: renderhints.cc:63
void samplingSplit(Curvelist &, int)
Definition: curvesub.cc:85
CardRegion * from
Definition: spigame.cpp:19

Referenced by NurbsTessellator::do_endcurve().

◆ drawSurfaces()

void Subdivider::drawSurfaces ( long  nuid)

Definition at line 204 of file subdivider.cc.

205{
206 renderhints.init( );
207
208 if (qlist == NULL)
209 {
210 //initialbin could be nonempty due to some errors
212 return;
213 }
214
215 for( Quilt *q = qlist; q; q = q->next ) {
216 if( q->isCulled( ) == CULL_TRIVIAL_REJECT ) {
218 return;
219 }
220 }
221
222
223 REAL from[2], to[2];
225#ifdef OPTIMIZE_UNTRIMED_CASE
226 //perform optimization only when the samplng method is
227 //DOMAIN_DISTANCE and the display methdo is either
228 //fill or outline_polygon.
230#endif
231
232 if( ! initialbin.isnonempty() ) {
233#ifdef OPTIMIZE_UNTRIMED_CASE
234 if(! optimize )
235 {
236
237 makeBorderTrim( from, to );
238 }
239#else
240 makeBorderTrim( from, to );
241#endif
242 } else {
243 REAL rate[2];
245
246 if( decompose( initialbin, min(rate[0], rate[1]) ) )
247 mylongjmp( jumpbuffer, 31 );
248 }
249
251
252#ifdef PARTITION_TEST
255{
256 for(int i=spbrkpts.start; i<spbrkpts.end-1; i++){
257 for(int j=tpbrkpts.start; j<tpbrkpts.end-1; j++){
258 Real pta[2], ptb[2];
259 pta[0] = spbrkpts.pts[i];
260 ptb[0] = spbrkpts.pts[i+1];
261 pta[1] = tpbrkpts.pts[j];
262 ptb[1] = tpbrkpts.pts[j+1];
263 qlist->downloadAll(pta, ptb, backend);
264
265 directedLine *poly;
266
267 {
268
270
272
273 sampledLine* retSampledLines;
274//printf("before MC_partition\n");
275 poly = MC_partitionY(poly, &retSampledLines);
276//printf("after MC_partition\n");
277
278 }
279
280
281 {
282 primStream pStream(5000,5000);
284
285 for(temp=poly; temp != NULL; temp=temp->getNextPolygon())
286
287 monoTriangulation(temp, &pStream);
288
289 slicer.evalStream(&pStream);
290
291 }
292 //need to clean up space
293 }
294 }
297 return;
298
299 /*
300 printf("num_polygons=%i\n", poly->numPolygons());
301 printf("num_edges=%i\n", poly->numEdgesAllPolygons());
302 poly->writeAllPolygons("zloutputFile");
303 return;
304 {
305 primStream pStream(20,20);
306 for(directedLine* tempD = poly; tempD != NULL; tempD = tempD->getNextPolygon())
307 monoTriangulation(tempD, &pStream);
308 }
309 return;
310 */
311}
312#endif //PARTITION_TEST
313
314
315#ifdef OPTIMIZE_UNTRIMED_CASE
316 if( (!initialbin.isnonempty()) && optimize )
317 {
318 int i,j;
319 int num_u_steps;
320 int num_v_steps;
321 for(i=spbrkpts.start; i<spbrkpts.end-1; i++){
322 for(j=tpbrkpts.start; j<tpbrkpts.end-1; j++){
323 Real pta[2], ptb[2];
324 pta[0] = spbrkpts.pts[i];
325 ptb[0] = spbrkpts.pts[i+1];
326 pta[1] = tpbrkpts.pts[j];
327 ptb[1] = tpbrkpts.pts[j+1];
328 qlist->downloadAll(pta, ptb, backend);
329
330 num_u_steps = (int) (domain_distance_u_rate * (ptb[0]-pta[0]));
331 num_v_steps = (int) (domain_distance_v_rate * (ptb[1]-pta[1]));
332
333 if(num_u_steps <= 0) num_u_steps = 1;
334 if(num_v_steps <= 0) num_v_steps = 1;
335
336 backend.surfgrid(pta[0], ptb[0], num_u_steps,
337 ptb[1], pta[1], num_v_steps);
338 backend.surfmesh(0,0,num_u_steps,num_v_steps);
339
340
341
342 continue;
343 /* the following is left for reference purpose, don't delete
344 {
345 Bin* tempSource;
346 Patchlist patchlist(qlist, pta, ptb);
347 patchlist.getstepsize();
348
349 tempSource=makePatchBoundary(pta, ptb);
350
351 tessellation(*tempSource, patchlist);
352
353 render(*tempSource);
354 delete tempSource;
355 }
356 */
357 }
358 }
359 }
360 else
362#else
363
365#endif
366
368
369}
void bgnsurf(int, int, long)
Definition: backend.cc:58
void endsurf(void)
Definition: backend.cc:178
void surfmesh(long, long, long, long)
Definition: backend.cc:136
void surfgrid(REAL, REAL, long, REAL, REAL, long)
Definition: backend.cc:126
int isnonempty(void)
Definition: bin.h:54
Definition: quilt.h:64
void findRates(Flist &slist, Flist &tlist, REAL[2])
Definition: quilt.cc:230
REAL display_method
Definition: renderhints.h:49
void evalStream(primStream *)
Definition: slicer.cc:1027
void freejarcs(Bin &)
Definition: subdivider.cc:846
REAL domain_distance_u_rate
Definition: subdivider.h:188
int is_domain_distance_sampling
Definition: subdivider.h:190
int decompose(Bin &, REAL)
Definition: monotonizer.cc:56
void makeBorderTrim(const REAL *, const REAL *)
Definition: subdivider.cc:757
REAL domain_distance_v_rate
Definition: subdivider.h:189
Flist spbrkpts
Definition: subdivider.h:128
Flist tpbrkpts
Definition: subdivider.h:129
void subdivideInS(Bin &)
Definition: subdivider.cc:372
directedLine * deleteDegenerateLinesAllPolygons()
directedLine * bin_to_DLineLoops(Bin &bin)
float Real
Definition: definitions.h:36
#define CULL_TRIVIAL_REJECT
Definition: defines.h:40
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
directedLine * MC_partitionY(directedLine *polygons, sampledLine **retSampledLines)
Definition: monoChain.cc:647
#define min(a, b)
Definition: monoChain.cc:55
void monoTriangulation(directedLine *monoPolygon, primStream *pStream)
#define N_OUTLINE_PATCH
Definition: nurbsconsts.h:75
int rate
Definition: pcmconverter.c:97
static calc_node_t temp
Definition: rpn_ieee.c:38

Referenced by NurbsTessellator::do_endsurface().

◆ endLoop()

void Subdivider::endLoop ( void  )
inline

Definition at line 65 of file subdivider.h.

65{}

Referenced by NurbsTessellator::do_endsurface().

◆ endQuilts()

void Subdivider::endQuilts ( void  )
inline

Definition at line 70 of file subdivider.h.

70{}

Referenced by NurbsTessellator::do_endcurve(), and NurbsTessellator::do_endsurface().

◆ endTrims()

void Subdivider::endTrims ( void  )
inline

Definition at line 66 of file subdivider.h.

66{}

Referenced by NurbsTessellator::do_endsurface().

◆ findIrregularS()

void Subdivider::findIrregularS ( Bin bin)
private

Definition at line 658 of file subdivider.cc.

659{
660 assert( bin.firstarc()->check() != 0 );
661
662 smbrkpts.grow( bin.numarcs() );
663
664 for( Arc_ptr jarc=bin.firstarc(); jarc; jarc=bin.nextarc() ) {
665 REAL *a = jarc->prev->tail();
666 REAL *b = jarc->tail();
667 REAL *c = jarc->head();
668
669 if( b[1] == a[1] && b[1] == c[1] ) continue;
670
671 //corrected code
672 if((b[1]<=a[1] && b[1] <= c[1]) ||
673 (b[1]>=a[1] && b[1] >= c[1]))
674 {
675 //each arc (jarc, jarc->prev, jarc->next) is a
676 //monotone arc consisting of multiple line segements.
677 //it may happen that jarc->prev and jarc->next are the same,
678 //that is, jarc->prev and jarc form a closed loop.
679 //In such case, a and c will be the same.
680 if(a[0]==c[0] && a[1] == c[1])
681 {
682 if(jarc->pwlArc->npts >2)
683 {
684 c = jarc->pwlArc->pts[jarc->pwlArc->npts-2].param;
685 }
686 else
687 {
688 assert(jarc->prev->pwlArc->npts>2);
689 a = jarc->prev->pwlArc->pts[jarc->prev->pwlArc->npts-2].param;
690 }
691
692 }
693 if(area(a,b,c) < 0)
694 {
695 smbrkpts.add(b[0]);
696 }
697
698 }
699
700 /* old code,
701 if( b[1] <= a[1] && b[1] <= c[1] ) {
702 if( ! ccwTurn_tr( jarc->prev, jarc ) )
703 smbrkpts.add( b[0] );
704 } else if( b[1] >= a[1] && b[1] >= c[1] ) {
705 if( ! ccwTurn_tl( jarc->prev, jarc ) )
706 smbrkpts.add( b[0] );
707 }
708 */
709
710 }
711
713}
void filter(void)
Definition: flist.cc:76
void grow(int)
Definition: flist.cc:94
void add(REAL x)
Definition: flist.cc:66
Flist smbrkpts
Definition: subdivider.h:130
static Real area(Real A[2], Real B[2], Real C[2])
Definition: polyDBG.cc:50

Referenced by nonSamplingSplit().

◆ findIrregularT()

void Subdivider::findIrregularT ( Bin bin)
private

Definition at line 722 of file subdivider.cc.

723{
724 assert( bin.firstarc()->check() != 0 );
725
726 tmbrkpts.grow( bin.numarcs() );
727
728 for( Arc_ptr jarc=bin.firstarc(); jarc; jarc=bin.nextarc() ) {
729 REAL *a = jarc->prev->tail();
730 REAL *b = jarc->tail();
731 REAL *c = jarc->head();
732
733 if( b[0] == a[0] && b[0] == c[0] ) continue;
734
735 if( b[0] <= a[0] && b[0] <= c[0] ) {
736 if( a[1] != b[1] && b[1] != c[1] ) continue;
737 if( ! ccwTurn_sr( jarc->prev, jarc ) )
738 tmbrkpts.add( b[1] );
739 } else if ( b[0] >= a[0] && b[0] >= c[0] ) {
740 if( a[1] != b[1] && b[1] != c[1] ) continue;
741 if( ! ccwTurn_sl( jarc->prev, jarc ) )
742 tmbrkpts.add( b[1] );
743 }
744 }
745 tmbrkpts.filter( );
746}
Flist tmbrkpts
Definition: subdivider.h:131

Referenced by monosplitInS().

◆ freejarcs()

void Subdivider::freejarcs ( Bin bin)
private

Definition at line 846 of file subdivider.cc.

847{
848 bin.adopt(); /* XXX - should not be necessary */
849
850 Arc_ptr jarc;
851 while( (jarc = bin.removearc()) != NULL ) {
852 if( jarc->pwlArc ) jarc->pwlArc->deleteMe( pwlarcpool );
853 jarc->pwlArc = 0;
854 if( jarc->bezierArc) jarc->bezierArc->deleteMe( bezierarcpool );
855 jarc->bezierArc = 0;
856 jarc->deleteMe( arcpool );
857 }
858}

Referenced by drawSurfaces(), monosplitInS(), monosplitInT(), nonSamplingSplit(), samplingSplit(), splitInS(), splitInT(), and subdivideInS().

◆ isBezierArcType()

int Subdivider::isBezierArcType ( void  )
inlineprivate

Definition at line 158 of file subdivider.h.

158{ return isArcTypeBezier; }
int isArcTypeBezier
Definition: subdivider.h:134

Referenced by join_s(), and join_t().

◆ isMonotone()

int Subdivider::isMonotone ( Arc_ptr  jarc)
private

Definition at line 210 of file monotonizer.cc.

211{
212 TrimVertex *firstvert = jarc->pwlArc->pts;
213 TrimVertex *lastvert = firstvert + (jarc->pwlArc->npts - 1);
214
215 if( firstvert == lastvert ) return 1;
216
217 TrimVertex *vert = firstvert;
218 enum dir sdir;
219 enum dir tdir;
220
221 REAL diff = vert[1].param[0] - vert[0].param[0];
222 if( diff == 0.0 )
223 sdir = same;
224 else if( diff < 0.0 )
225 sdir = down;
226 else
227 sdir = up;
228
229 diff = vert[1].param[1] - vert[0].param[1];
230 if( diff == 0.0 )
231 tdir = same;
232 else if( diff < 0.0 )
233 tdir = down;
234 else
235 tdir = up;
236
237 if( (sdir == same) && (tdir == same) ) return 0;
238
239 for( ++vert ; vert != lastvert; vert++ ) {
240 diff = vert[1].param[0] - vert[0].param[0];
241 if( diff == 0.0 ) {
242 if( sdir != same ) return 0;
243 } else if( diff < 0.0 ) {
244 if( sdir != down ) return 0;
245 } else {
246 if( sdir != up ) return 0;
247 }
248
249 diff = vert[1].param[1] - vert[0].param[1];
250 if( diff == 0.0 ) {
251 if( tdir != same ) return 0;
252 } else if( diff < 0.0 ) {
253 if( tdir != down ) return 0;
254 } else {
255 if( tdir != up ) return 0;
256 }
257 }
258 return 1;
259}

Referenced by decompose().

◆ join_s()

void Subdivider::join_s ( Bin left,
Bin right,
Arc_ptr  jarc1,
Arc_ptr  jarc2 
)
private

Definition at line 180 of file splitarcs.cc.

181{
182 assert( jarc1->check( ) != 0);
183 assert( jarc2->check( ) != 0);
184 assert( jarc1 != jarc2 );
185
186 if( ! jarc1->getitail() )
187 jarc1 = jarc1->next;
188
189 if( ! jarc2->getitail() )
190 jarc2 = jarc2->next;
191
192 REAL s = jarc1->tail()[0];
193 REAL t1 = jarc1->tail()[1];
194 REAL t2 = jarc2->tail()[1];
195
196 if( t1 == t2 ) {
197 simple_link( jarc1, jarc2 );
198 } else {
199 Arc_ptr newright = new(arcpool) Arc( arc_right, 0 );
200 Arc_ptr newleft = new(arcpool) Arc( arc_left, 0 );
201 assert( t1 < t2 );
202 if( isBezierArcType() ) {
203 arctessellator.bezier( newright, s, s, t1, t2 );
204 arctessellator.bezier( newleft, s, s, t2, t1 );
205 } else {
206 arctessellator.pwl_right( newright, s, t1, t2, stepsizes[0] );
207 arctessellator.pwl_left( newleft, s, t2, t1, stepsizes[2] );
208 }
209 link( jarc1, jarc2, newright, newleft );
210 left.addarc( newright );
211 right.addarc( newleft );
212 }
213
214 assert( jarc1->check( ) != 0 );
215 assert( jarc2->check( ) != 0 );
216 assert( jarc1->next->check( ) != 0);
217 assert( jarc2->next->check( ) != 0);
218}
void pwl_right(Arc_ptr, REAL, REAL, REAL, REAL)
Definition: arctess.cc:155
void bezier(Arc_ptr, REAL, REAL, REAL, REAL)
Definition: arctess.cc:79
void pwl_left(Arc_ptr, REAL, REAL, REAL, REAL)
Definition: arctess.cc:125
REAL stepsizes[4]
Definition: subdivider.h:132
int isBezierArcType(void)
Definition: subdivider.h:158
void simple_link(Arc_ptr, Arc_ptr)
Definition: splitarcs.cc:164
const WCHAR * link
Definition: db.cpp:997
@ arc_left
Definition: arc.h:52
@ arc_right
Definition: arc.h:52
GLdouble s
Definition: gl.h:2039
GLdouble GLdouble right
Definition: glext.h:10859
GLint left
Definition: glext.h:7726

Referenced by split().

◆ join_t()

void Subdivider::join_t ( Bin bottom,
Bin top,
Arc_ptr  jarc1,
Arc_ptr  jarc2 
)
private

Definition at line 252 of file splitarcs.cc.

253{
254 assert( jarc1->check( ) != 0 );
255 assert( jarc2->check( ) != 0 );
256 assert( jarc1->next->check( ) != 0 );
257 assert( jarc2->next->check( ) != 0 );
258 assert( jarc1 != jarc2 );
259
260 if( ! jarc1->getitail() )
261 jarc1 = jarc1->next;
262
263 if( ! jarc2->getitail() )
264 jarc2 = jarc2->next;
265
266 REAL s1 = jarc1->tail()[0];
267 REAL s2 = jarc2->tail()[0];
268 REAL t = jarc1->tail()[1];
269
270 if( s1 == s2 ) {
271 simple_link( jarc1, jarc2 );
272 } else {
273 Arc_ptr newtop = new(arcpool) Arc( arc_top, 0 );
274 Arc_ptr newbot = new(arcpool) Arc( arc_bottom, 0 );
275 assert( s1 > s2 );
276 if( isBezierArcType() ) {
277 arctessellator.bezier( newtop, s1, s2, t, t );
278 arctessellator.bezier( newbot, s2, s1, t, t );
279 } else {
280 arctessellator.pwl_top( newtop, t, s1, s2, stepsizes[1] );
281 arctessellator.pwl_bottom( newbot, t, s2, s1, stepsizes[3] );
282 }
283 link( jarc1, jarc2, newtop, newbot );
284 bottom.addarc( newtop );
285 top.addarc( newbot );
286 }
287
288 assert( jarc1->check( ) != 0 );
289 assert( jarc2->check( ) != 0 );
290 assert( jarc1->next->check( ) != 0 );
291 assert( jarc2->next->check( ) != 0 );
292}
void pwl_top(Arc_ptr, REAL, REAL, REAL, REAL)
Definition: arctess.cc:185
void pwl_bottom(Arc_ptr, REAL, REAL, REAL, REAL)
Definition: arctess.cc:214
@ arc_bottom
Definition: arc.h:52
@ arc_top
Definition: arc.h:52
GLdouble GLdouble t
Definition: gl.h:2047
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLint GLint bottom
Definition: glext.h:7726
struct S1 s1
struct S2 s2

Referenced by split().

◆ link()

void Subdivider::link ( Arc_ptr  jarc1,
Arc_ptr  jarc2,
Arc_ptr  up,
Arc_ptr  down 
)
inlineprivate

Definition at line 148 of file splitarcs.cc.

149{
150 up->nuid = down->nuid = 0; // XXX
151
152 up->next = jarc2;
153 down->next = jarc1;
154 up->prev = jarc1->prev;
155 down->prev = jarc2->prev;
156
157 down->next->prev = down;
158 up->next->prev = up;
159 down->prev->next = down;
160 up->prev->next = up;
161}

◆ makeBorderTrim()

void Subdivider::makeBorderTrim ( const REAL from,
const REAL to 
)
private

Definition at line 757 of file subdivider.cc.

758{
759 REAL smin = from[0];
760 REAL smax = to[0];
761 REAL tmin = from[1];
762 REAL tmax = to[1];
763
764 pjarc = 0;
765
766 Arc_ptr jarc = new(arcpool) Arc( arc_bottom, 0 );
767 arctessellator.bezier( jarc, smin, smax, tmin, tmin );
768 initialbin.addarc( jarc );
769 pjarc = jarc->append( pjarc );
770
771 jarc = new(arcpool) Arc( arc_right, 0 );
772 arctessellator.bezier( jarc, smax, smax, tmin, tmax );
773 initialbin.addarc( jarc );
774 pjarc = jarc->append( pjarc );
775
776 jarc = new(arcpool) Arc( arc_top, 0 );
777 arctessellator.bezier( jarc, smax, smin, tmax, tmax );
778 initialbin.addarc( jarc );
779 pjarc = jarc->append( pjarc );
780
781 jarc = new(arcpool) Arc( arc_left, 0 );
782 arctessellator.bezier( jarc, smin, smin, tmax, tmin );
783 initialbin.addarc( jarc );
784 jarc->append( pjarc );
785
786 assert( jarc->check() != 0 );
787}

Referenced by drawSurfaces().

◆ makePatchBoundary()

Bin * Subdivider::makePatchBoundary ( const REAL from,
const REAL to 
)
private

Definition at line 73 of file subdivider.cc.

74{
75 Bin* ret = new Bin();
76 REAL smin = from[0];
77 REAL smax = to[0];
78 REAL tmin = from[1];
79 REAL tmax = to[1];
80
81 pjarc = 0;
82
83 Arc_ptr jarc = new(arcpool) Arc( arc_bottom, 0 );
84 arctessellator.bezier( jarc, smin, smax, tmin, tmin );
85 ret->addarc( jarc );
86 pjarc = jarc->append( pjarc );
87
88 jarc = new(arcpool) Arc( arc_right, 0 );
89 arctessellator.bezier( jarc, smax, smax, tmin, tmax );
90 ret->addarc( jarc );
91 pjarc = jarc->append( pjarc );
92
93 jarc = new(arcpool) Arc( arc_top, 0 );
94 arctessellator.bezier( jarc, smax, smin, tmax, tmax );
95 ret->addarc( jarc );
96 pjarc = jarc->append( pjarc );
97
98 jarc = new(arcpool) Arc( arc_left, 0 );
99 arctessellator.bezier( jarc, smin, smin, tmax, tmin );
100 ret->addarc( jarc );
101 jarc->append( pjarc );
102
103 assert( jarc->check() != 0 );
104 return ret;
105}
Definition: bin.h:44
int ret

◆ monosplitInS()

void Subdivider::monosplitInS ( Bin source,
int  start,
int  end 
)
private

Definition at line 597 of file subdivider.cc.

598{
599 if( source.isnonempty() ) {
600 if( start != end ) {
601 int i = start + (end - start) / 2;
602 Bin left, right;
603 split( source, left, right, 0, smbrkpts.pts[i] );
605 monosplitInS( right, i+1, end );
606 } else {
608 outline( source );
609 freejarcs( source );
610 } else {
615 }
616 }
617 }
618}
void monosplitInT(Bin &, int, int)
Definition: subdivider.cc:626
void findIrregularT(Bin &)
Definition: subdivider.cc:722
void monosplitInS(Bin &, int, int)
Definition: subdivider.cc:597
void setArcTypePwl(void)
Definition: subdivider.h:157
void split(Bin &, Bin &, Bin &, int, REAL)
Definition: splitarcs.cc:58
void setDegenerate(void)
Definition: subdivider.h:153
GLuint start
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545
#define N_OUTLINE_SUBDIV_S
Definition: nurbsconsts.h:80
Definition: mesh.c:5330

Referenced by monosplitInS(), and nonSamplingSplit().

◆ monosplitInT()

void Subdivider::monosplitInT ( Bin source,
int  start,
int  end 
)
private

Definition at line 626 of file subdivider.cc.

627{
628 if( source.isnonempty() ) {
629 if( start != end ) {
630 int i = start + (end - start) / 2;
631 Bin left, right;
632 split( source, left, right, 1, tmbrkpts.pts[i] );
634 monosplitInT( right, i+1, end );
635 } else {
637 outline( source );
638 freejarcs( source );
639 } else {
640/*
641printf("*******render\n");
642source.show("source\n");
643*/
644 render( source );
645 freejarcs( source );
646 }
647 }
648 }
649}
#define N_OUTLINE_SUBDIV_ST
Definition: nurbsconsts.h:81
static void render(void)
Definition: ssstars.c:272

Referenced by monosplitInS(), and monosplitInT().

◆ monotonize()

void Subdivider::monotonize ( Arc_ptr  jarc,
Bin bin 
)
private

Definition at line 114 of file monotonizer.cc.

115{
116 TrimVertex *firstvert = jarc->pwlArc->pts;
117 TrimVertex *lastvert = firstvert + (jarc->pwlArc->npts - 1);
118 long uid = jarc->nuid;
119 arc_side side = jarc->getside();
120 dir sdir = none;
121 dir tdir = none;
122 int degenerate = 1;
123
124 int nudegenerate;
125 int change;
126
127 TrimVertex *vert;
128 for( vert = firstvert; vert != lastvert; vert++ ) {
129
130 nudegenerate = 1;
131 change = 0;
132
133 /* check change relative to s axis, clear degenerate bit if needed */
134 REAL sdiff = vert[1].param[0] - vert[0].param[0];
135 if( sdiff == 0 ) {
136 if( sdir != same ) {
137 sdir = same;
138 change = 1;
139 }
140 } else if( sdiff < 0.0 ) {
141 if( sdir != down ) {
142 sdir = down;
143 change = 1;
144 }
145 nudegenerate = 0;
146 } else {
147 if( sdir != up ) {
148 sdir = up;
149 change = 1;
150 }
151 nudegenerate = 0;
152 }
153
154 /* check change relative to t axis, clear degenerate bit if needed */
155 REAL tdiff = vert[1].param[1] - vert[0].param[1];
156 if( tdiff == 0 ) {
157 if( tdir != same ) {
158 tdir = same;
159 change = 1;
160 }
161 } else if( tdiff < 0.0 ) {
162 if( tdir != down ) {
163 tdir = down;
164 change = 1;
165 }
166 nudegenerate = 0;
167 } else {
168 if( tdir != up ) {
169 tdir = up;
170 change = 1;
171 }
172 nudegenerate = 0;
173 }
174
175 if( change ) {
176 if( ! degenerate ) {
177 /* make last segment into separate pwl curve */
178 jarc->pwlArc->npts = vert - firstvert + 1;
179 jarc = (new(arcpool) Arc( side, uid ))->append( jarc );
180 jarc->pwlArc = new(pwlarcpool) PwlArc();
181 bin.addarc( jarc );
182 }
183 firstvert = jarc->pwlArc->pts = vert;
184 degenerate = nudegenerate;
185 }
186 }
187 jarc->pwlArc->npts = vert - firstvert + 1;
188
189 if( degenerate ) {
190 /* remove jarc from circularly linked list */
191 jarc->prev->next = jarc->next;
192 jarc->next->prev = jarc->prev;
193
194 assert( jarc->prev->check( ) != 0 );
195 assert( jarc->next->check( ) != 0 );
196
197 /* remove jarc from bin */
198 bin.remove_this_arc( jarc );
199
200 jarc->pwlArc->deleteMe( pwlarcpool ); jarc->pwlArc = 0;
201 jarc->deleteMe( arcpool );
202 }
203}
arc_side
Definition: arc.h:52
static void append(struct dump_context *dc, const void *data, unsigned size)
Definition: minidump.c:397

Referenced by decompose().

◆ nonSamplingSplit()

void Subdivider::nonSamplingSplit ( Bin source,
Patchlist patchlist,
int  subdivisions,
int  param 
)
private

Definition at line 520 of file subdivider.cc.

525{
526 if( patchlist.needsNonSamplingSubdivision() && (subdivisions > 0) ) {
527 param = 1 - param;
528
529 Bin left, right;
530 REAL mid = ( patchlist.pspec[param].range[0] +
531 patchlist.pspec[param].range[1] ) * 0.5;
532 split( source, left, right, param, mid );
533 Patchlist subpatchlist( patchlist, param, mid );
534 if( left.isnonempty() ) {
535 if( subpatchlist.cullCheck() == CULL_TRIVIAL_REJECT )
536 freejarcs( left );
537 else
538 nonSamplingSplit( left, subpatchlist, subdivisions-1, param );
539 }
540 if( right.isnonempty() ) {
541 if( patchlist.cullCheck() == CULL_TRIVIAL_REJECT )
542 freejarcs( right );
543 else
544 nonSamplingSplit( right, patchlist, subdivisions-1, param );
545 }
546
547 } else {
548 // make bbox calls
549 patchlist.bbox();
550 backend.patch( patchlist.pspec[0].range[0], patchlist.pspec[0].range[1],
551 patchlist.pspec[1].range[0], patchlist.pspec[1].range[1] );
552
554 outline( source );
555 freejarcs( source );
556 } else {
561 }
562 }
563}
void patch(REAL, REAL, REAL, REAL)
Definition: backend.cc:89
void bbox()
Definition: patchlist.cc:137
Pspec pspec[2]
Definition: patchlist.h:66
int needsNonSamplingSubdivision(void)
Definition: patchlist.cc:144
int cullCheck(void)
Definition: patchlist.cc:96
void nonSamplingSplit(Bin &, Patchlist &, int, int)
Definition: subdivider.cc:520
void findIrregularS(Bin &)
Definition: subdivider.cc:658
#define N_OUTLINE_SUBDIV
Definition: nurbsconsts.h:79
REAL range[3]
Definition: patch.h:47

Referenced by nonSamplingSplit(), and samplingSplit().

◆ outline()

void Subdivider::outline ( Bin bin)
private

Definition at line 824 of file subdivider.cc.

825{
826 bin.markall();
827 for( Arc_ptr jarc=bin.firstarc(); jarc; jarc=bin.nextarc() ) {
828 if( jarc->ismarked() ) {
829 assert( jarc->check( ) != 0 );
830 Arc_ptr jarchead = jarc;
831 do {
832 slicer.outline( jarc );
833 jarc->clearmark();
834 jarc = jarc->prev;
835 } while (jarc != jarchead);
836 }
837 }
838}
void outline(Arc_ptr)
Definition: slicer.cc:1292

◆ partition()

void Subdivider::partition ( Bin bin,
Bin left,
Bin intersections,
Bin right,
Bin unknown,
int  param,
REAL  value 
)
private

Definition at line 61 of file intersect.cc.

63{
64 Bin headonleft, headonright, tailonleft, tailonright;
65
66 for( Arc_ptr jarc = bin.removearc(); jarc; jarc = bin.removearc() ) {
67
68 REAL tdiff = jarc->tail()[param] - value;
69 REAL hdiff = jarc->head()[param] - value;
70
71 if( tdiff > 0.0 ) {
72 if( hdiff > 0.0 ) {
73 right.addarc( jarc );
74 } else if( hdiff == 0.0 ) {
75 tailonright.addarc( jarc );
76 } else {
77 Arc_ptr jtemp;
78 switch( arc_split(jarc, param, value, 0) ) {
79 case 2:
80 tailonright.addarc( jarc );
81 headonleft.addarc( jarc->next );
82 break;
83 case 31:
84 assert( jarc->head()[param] > value );
85 right.addarc( jarc );
86 tailonright.addarc( jtemp = jarc->next );
87 headonleft.addarc( jtemp->next );
88 break;
89 case 32:
90 assert( jarc->head()[param] <= value );
91 tailonright .addarc( jarc );
92 headonleft.addarc( jtemp = jarc->next );
93 left.addarc( jtemp->next );
94 break;
95 case 4:
96 right.addarc( jarc );
97 tailonright.addarc( jtemp = jarc->next );
98 headonleft.addarc( jtemp = jtemp->next );
99 left.addarc( jtemp->next );
100 }
101 }
102 } else if( tdiff == 0.0 ) {
103 if( hdiff > 0.0 ) {
104 headonright.addarc( jarc );
105 } else if( hdiff == 0.0 ) {
106 unknown.addarc( jarc );
107 } else {
108 headonleft.addarc( jarc );
109 }
110 } else {
111 if( hdiff > 0.0 ) {
112 Arc_ptr jtemp;
113 switch( arc_split(jarc, param, value, 1) ) {
114 case 2:
115 tailonleft.addarc( jarc );
116 headonright.addarc( jarc->next );
117 break;
118 case 31:
119 assert( jarc->head()[param] < value );
120 left.addarc( jarc );
121 tailonleft.addarc( jtemp = jarc->next );
122 headonright.addarc( jtemp->next );
123 break;
124 case 32:
125 assert( jarc->head()[param] >= value );
126 tailonleft.addarc( jarc );
127 headonright.addarc( jtemp = jarc->next );
128 right.addarc( jtemp->next );
129 break;
130 case 4:
131 left.addarc( jarc );
132 tailonleft.addarc( jtemp = jarc->next );
133 headonright.addarc( jtemp = jtemp->next );
134 right.addarc( jtemp->next );
135 }
136 } else if( hdiff == 0.0 ) {
137 tailonleft.addarc( jarc );
138 } else {
139 left.addarc( jarc );
140 }
141 }
142 }
143 if( param == 0 ) {
144 classify_headonleft_s( headonleft, intersections, left, value );
145 classify_tailonleft_s( tailonleft, intersections, left, value );
146 classify_headonright_s( headonright, intersections, right, value );
147 classify_tailonright_s( tailonright, intersections, right, value );
148 } else {
149 classify_headonleft_t( headonleft, intersections, left, value );
150 classify_tailonleft_t( tailonleft, intersections, left, value );
151 classify_headonright_t( headonright, intersections, right, value );
152 classify_tailonright_t( tailonright, intersections, right, value );
153 }
154}
void classify_tailonright_s(Bin &, Bin &, Bin &, REAL)
Definition: intersect.cc:555
void classify_tailonleft_s(Bin &, Bin &, Bin &, REAL)
Definition: intersect.cc:445
void classify_tailonleft_t(Bin &, Bin &, Bin &, REAL)
Definition: intersect.cc:472
void classify_tailonright_t(Bin &, Bin &, Bin &, REAL)
Definition: intersect.cc:583
void classify_headonleft_t(Bin &, Bin &, Bin &, REAL)
Definition: intersect.cc:527
void classify_headonleft_s(Bin &, Bin &, Bin &, REAL)
Definition: intersect.cc:499
void classify_headonright_s(Bin &, Bin &, Bin &, REAL)
Definition: intersect.cc:611
int arc_split(Arc_ptr, int, REAL, int)
Definition: intersect.cc:175
void classify_headonright_t(Bin &, Bin &, Bin &, REAL)
Definition: intersect.cc:639
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1605

Referenced by split().

◆ render()

void Subdivider::render ( Bin bin)
private

Definition at line 795 of file subdivider.cc.

796{
797 bin.markall();
798
799#ifdef N_ISOLINE_S
801#else
802 slicer.setisolines( 0 );
803#endif
804
805 for( Arc_ptr jarc=bin.firstarc(); jarc; jarc=bin.nextarc() ) {
806 if( jarc->ismarked() ) {
807 assert( jarc->check( ) != 0 );
808 Arc_ptr jarchead = jarc;
809 do {
810 jarc->clearmark();
811 jarc = jarc->next;
812 } while (jarc != jarchead);
813 slicer.slice( jarc );
814 }
815 }
816}
void setisolines(int)
Definition: slicer.cc:1197
void slice(Arc_ptr)
Definition: slicer.cc:1165
#define N_ISOLINE_S
Definition: nurbsconsts.h:82

◆ samplingSplit() [1/2]

void Subdivider::samplingSplit ( Bin source,
Patchlist patchlist,
int  subdivisions,
int  param 
)
private

Definition at line 469 of file subdivider.cc.

474{
475 if( ! source.isnonempty() ) return;
476
477 if( patchlist.cullCheck() == CULL_TRIVIAL_REJECT ) {
478 freejarcs( source );
479 return;
480 }
481
482 patchlist.getstepsize();
483
485 tessellation( source, patchlist );
486 outline( source );
487 freejarcs( source );
488 return;
489 }
490
491 //patchlist.clamp();
492
493 tessellation( source, patchlist );
494
495 if( patchlist.needsSamplingSubdivision() && (subdivisions > 0) ) {
496 if( ! patchlist.needsSubdivision( 0 ) )
497 param = 1;
498 else if( ! patchlist.needsSubdivision( 1 ) )
499 param = 0;
500 else
501 param = 1 - param;
502
503 Bin left, right;
504 REAL mid = ( patchlist.pspec[param].range[0] +
505 patchlist.pspec[param].range[1] ) * 0.5;
506 split( source, left, right, param, mid );
507 Patchlist subpatchlist( patchlist, param, mid );
508 samplingSplit( left, subpatchlist, subdivisions-1, param );
509 samplingSplit( right, patchlist, subdivisions-1, param );
510 } else {
513 nonSamplingSplit( source, patchlist, subdivisions, param );
516 }
517}
void getstepsize(void)
Definition: patchlist.cc:114
int needsSamplingSubdivision(void)
Definition: patchlist.cc:153
int needsSubdivision(int)
Definition: patchlist.cc:166
void tessellation(Bin &, Patchlist &)
Definition: subdivider.cc:571
void setArcTypeBezier(void)
Definition: subdivider.h:156

◆ samplingSplit() [2/2]

void Subdivider::samplingSplit ( Curvelist curvelist,
int  subdivisions 
)
private

Definition at line 85 of file curvesub.cc.

86{
87 if( curvelist.cullCheck() == CULL_TRIVIAL_REJECT ) return;
88
89 curvelist.getstepsize();
90
91 if( curvelist.needsSamplingSubdivision() && (subdivisions > 0) ) {
92 REAL mid = ( curvelist.range[0] + curvelist.range[1] ) * 0.5;
93 Curvelist lowerlist( curvelist, mid );
94 samplingSplit( lowerlist, subdivisions-1 ); // lower
95 samplingSplit( curvelist, subdivisions-1 ); // upper
96 } else {
97 long nu = 1 + ((long) (curvelist.range[2] / curvelist.stepsize));
98 backend.curvgrid( curvelist.range[0], curvelist.range[1], nu );
99 backend.curvmesh( 0, nu );
100 }
101}
void curvmesh(long, long)
Definition: backend.cc:561
void curvgrid(REAL, REAL, long)
Definition: backend.cc:555
void getstepsize(void)
Definition: curvelist.cc:94
float range[3]
Definition: curvelist.h:58
float stepsize
Definition: curvelist.h:60
int cullCheck(void)
Definition: curvelist.cc:85
int needsSamplingSubdivision()
Definition: curvelist.cc:108
#define long
Definition: qsort.c:33

Referenced by drawCurves(), samplingSplit(), and splitInT().

◆ set_domain_distance_u_rate()

void Subdivider::set_domain_distance_u_rate ( REAL  u_rate)
inline

Definition at line 82 of file subdivider.h.

83 {
85 }

Referenced by NurbsTessellator::set_domain_distance_u_rate().

◆ set_domain_distance_v_rate()

void Subdivider::set_domain_distance_v_rate ( REAL  v_rate)
inline

Definition at line 86 of file subdivider.h.

87 {
89 }

Referenced by NurbsTessellator::set_domain_distance_v_rate().

◆ set_is_domain_distance_sampling()

void Subdivider::set_is_domain_distance_sampling ( int  flag)
inline

Definition at line 90 of file subdivider.h.

91 {
93 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean flag
Definition: glfuncs.h:52

Referenced by NurbsTessellator::set_is_domain_distance_sampling().

◆ setArcTypeBezier()

void Subdivider::setArcTypeBezier ( void  )
inlineprivate

Definition at line 156 of file subdivider.h.

156{ isArcTypeBezier = 1; }

Referenced by samplingSplit(), splitInS(), splitInT(), and subdivideInS().

◆ setArcTypePwl()

void Subdivider::setArcTypePwl ( void  )
inlineprivate

Definition at line 157 of file subdivider.h.

157{ isArcTypeBezier = 0; }

Referenced by monosplitInS(), nonSamplingSplit(), and samplingSplit().

◆ setDegenerate()

void Subdivider::setDegenerate ( void  )
inlineprivate

Definition at line 153 of file subdivider.h.

153{ showDegenerate = 1; }
int showDegenerate
Definition: subdivider.h:133

Referenced by monosplitInS(), nonSamplingSplit(), samplingSplit(), and splitInT().

◆ setJumpbuffer()

void Subdivider::setJumpbuffer ( JumpBuffer *  j)

Definition at line 124 of file subdivider.cc.

125{
126 jumpbuffer = j;
127}

Referenced by NurbsTessellator::NurbsTessellator().

◆ setNonDegenerate()

void Subdivider::setNonDegenerate ( void  )
inlineprivate

Definition at line 154 of file subdivider.h.

154{ showDegenerate = 0; }

Referenced by splitInS(), splitInT(), and subdivideInS().

◆ showingDegenerate()

int Subdivider::showingDegenerate ( void  )
inlineprivate

Definition at line 155 of file subdivider.h.

155{ return showDegenerate; }

Referenced by arc_split().

◆ simple_link()

void Subdivider::simple_link ( Arc_ptr  jarc1,
Arc_ptr  jarc2 
)
inlineprivate

Definition at line 164 of file splitarcs.cc.

165{
166 Arc_ptr tmp = jarc2->prev;
167 jarc2->prev = jarc1->prev;
168 jarc1->prev = tmp;
169 jarc2->prev->next = jarc2;
170 jarc1->prev->next = jarc1;
171}

Referenced by join_s(), and join_t().

◆ split() [1/2]

void Subdivider::split ( Bin bin,
Bin left,
Bin right,
int  param,
REAL  value 
)
private

Definition at line 58 of file splitarcs.cc.

59{
60 Bin intersections, unknown;
61
62 partition( bin, left, intersections, right, unknown, param, value );
63
64 int count = intersections.numarcs();
65 if( count % 2 ) {
66#ifndef NDEBUG
67 left.show( "left" );
68 intersections.show( "intersections" );
69 right.show( "right" );
70#endif
71 ::mylongjmp( jumpbuffer, 29 );
72 }
73
74 Arc_ptr arclist[MAXARCS], *list;
75 if( count >= MAXARCS ) {
76 list = new Arc_ptr[count];
77 } else {
78 list = arclist;
79 }
80
81 Arc_ptr jarc, *last, *lptr;
82 for( last = list; (jarc=intersections.removearc()) != NULL; last++ )
83 *last = jarc;
84
85 if( param == 0 ) { /* sort into increasing t order */
86 ArcSdirSorter sorter(*this);
87 sorter.qsort( list, count );
88
89 //::qsort ((void *)list, count, sizeof(Arc_ptr), (cmpfunc)compare_s);
90 for( lptr=list; lptr<last; lptr+=2 )
91 check_s ( lptr[0], lptr[1] );
92 for( lptr=list; lptr<last; lptr+=2 )
93 join_s ( left, right, lptr[0], lptr[1] );
94 for( lptr=list; lptr != last; lptr++ ) {
95 if( ((*lptr)->head()[0] <= value) && ((*lptr)->tail()[0] <= value) )
96 left.addarc( *lptr );
97 else
98 right.addarc( *lptr );
99 }
100 } else { /* sort into decreasing s order */
101 ArcTdirSorter sorter(*this);
102 sorter.qsort( list, count );
103 //::qsort ((void *)list, count, sizeof(Arc_ptr), (cmpfunc)compare_t);
104 for( lptr=list; lptr<last; lptr+=2 )
105 check_t ( lptr[0], lptr[1] );
106 for( lptr=list; lptr<last; lptr+=2 )
107 join_t ( left, right, lptr[0], lptr[1] );
108 for( lptr=list; lptr != last; lptr++ ) {
109 if( ((*lptr)->head()[1] <= value) && ((*lptr)->tail()[1] <= value) )
110 left.addarc( *lptr );
111 else
112 right.addarc( *lptr );
113 }
114 }
115
116 if( list != arclist ) delete[] list;
117 unknown.adopt();
118}
Arc_ptr removearc(void)
Definition: bin.h:82
int numarcs(void)
Definition: bin.cc:84
void show(const char *)
Definition: bin.cc:122
void check_t(Arc_ptr, Arc_ptr)
Definition: splitarcs.cc:221
void join_s(Bin &, Bin &, Arc_ptr, Arc_ptr)
Definition: splitarcs.cc:180
void check_s(Arc_ptr, Arc_ptr)
Definition: splitarcs.cc:122
void partition(Bin &, Bin &, Bin &, Bin &, Bin &, int, REAL)
Definition: intersect.cc:61
void join_t(Bin &, Bin &, Arc_ptr, Arc_ptr)
Definition: splitarcs.cc:252
Definition: list.h:37
GLuint GLuint GLsizei count
Definition: gl.h:1545
static UINT UINT last
Definition: font.c:45
#define list
Definition: rosglue.h:35
#define MAXARCS
Definition: splitarcs.cc:50

Referenced by monosplitInS(), monosplitInT(), nonSamplingSplit(), samplingSplit(), splitInS(), and splitInT().

◆ split() [2/2]

void Subdivider::split ( Bin ,
int  ,
const REAL ,
int  ,
int   
)
private

◆ splitInS()

void Subdivider::splitInS ( Bin source,
int  start,
int  end 
)
private

Definition at line 391 of file subdivider.cc.

392{
393 if( source.isnonempty() ) {
394 if( start != end ) {
395 int i = start + (end - start) / 2;
396 Bin left, right;
397 split( source, left, right, 0, spbrkpts.pts[i] );
398 splitInS( left, start, i );
399 splitInS( right, i+1, end );
400 } else {
401 if( start == spbrkpts.start || start == spbrkpts.end ) {
402 freejarcs( source );
404 outline( source );
405 freejarcs( source );
406 } else {
409 s_index = start;
411 }
412 }
413 }
414}
void splitInT(Bin &, int, int)
Definition: subdivider.cc:422
void setNonDegenerate(void)
Definition: subdivider.h:154
void splitInS(Bin &, int, int)
Definition: subdivider.cc:391
#define N_OUTLINE_PARAM_S
Definition: nurbsconsts.h:77

Referenced by splitInS(), and subdivideInS().

◆ splitInT()

void Subdivider::splitInT ( Bin source,
int  start,
int  end 
)
private

Definition at line 422 of file subdivider.cc.

423{
424 if( source.isnonempty() ) {
425 if( start != end ) {
426 int i = start + (end - start) / 2;
427 Bin left, right;
428 split( source, left, right, 1, tpbrkpts.pts[i] );
429 splitInT( left, start, i );
430 splitInT( right, i+1, end );
431 } else {
432 if( start == tpbrkpts.start || start == tpbrkpts.end ) {
433 freejarcs( source );
435 outline( source );
436 freejarcs( source );
437 } else {
438 t_index = start;
441
442 REAL pta[2], ptb[2];
443 pta[0] = spbrkpts.pts[s_index-1];
444 pta[1] = tpbrkpts.pts[t_index-1];
445
446 ptb[0] = spbrkpts.pts[s_index];
447 ptb[1] = tpbrkpts.pts[t_index];
448 qlist->downloadAll( pta, ptb, backend );
449
450 Patchlist patchlist( qlist, pta, ptb );
451/*
452printf("-------samplingSplit-----\n");
453source.show("samplingSplit source");
454*/
458 }
459 }
460 }
461}
#define N_OUTLINE_PARAM_ST
Definition: nurbsconsts.h:78

Referenced by splitInS(), and splitInT().

◆ subdivideInS()

void Subdivider::subdivideInS ( Bin source)
private

Definition at line 372 of file subdivider.cc.

373{
375 outline( source );
376 freejarcs( source );
377 } else {
381 }
382}
#define N_OUTLINE_PARAM
Definition: nurbsconsts.h:76

Referenced by drawSurfaces().

◆ tessellate() [1/2]

void Subdivider::tessellate ( Arc_ptr  jarc,
REAL  geo_stepsize 
)
private

Definition at line 83 of file monotonizer.cc.

84{
85 BezierArc *b = jarc->bezierArc;
86 Mapdesc *mapdesc = b->mapdesc;
87
88 if( mapdesc->isRational() ) {
89 REAL max = mapdesc->calcVelocityRational( b->cpts, b->stride, b->order );
90 REAL arc_stepsize = (max > 1.0) ? (1.0/max) : 1.0;
91 if( jarc->bezierArc->order != 2 )
92 arctessellator.tessellateNonlinear( jarc, geo_stepsize, arc_stepsize, 1 );
93 else {
94 arctessellator.tessellateLinear( jarc, geo_stepsize, arc_stepsize, 1 );
95 }
96 } else {
97 REAL max = mapdesc->calcVelocityNonrational( b->cpts, b->stride, b->order );
98 REAL arc_stepsize = (max > 1.0) ? (1.0/max) : 1.0;
99 if( jarc->bezierArc->order != 2 )
100 arctessellator.tessellateNonlinear( jarc, geo_stepsize, arc_stepsize, 0 );
101 else {
102 arctessellator.tessellateLinear( jarc, geo_stepsize, arc_stepsize, 0 );
103 }
104 }
105}
void tessellateNonlinear(Arc_ptr, REAL, REAL, int)
Definition: arctess.cc:324
void tessellateLinear(Arc_ptr, REAL, REAL, int)
Definition: arctess.cc:279
int isRational(void)
Definition: mapdesc.h:192
REAL calcVelocityNonrational(REAL *, int, int)
Definition: mapdesc.cc:744
REAL calcVelocityRational(REAL *, int, int)
Definition: mapdesc.cc:723
#define max(a, b)
Definition: svc.c:63

Referenced by decompose(), and tessellation().

◆ tessellate() [2/2]

void Subdivider::tessellate ( Bin bin,
REAL  rrate,
REAL  trate,
REAL  lrate,
REAL  brate 
)
private

Definition at line 876 of file subdivider.cc.

877{
878 for( Arc_ptr jarc=bin.firstarc(); jarc; jarc=bin.nextarc() ) {
879 if( jarc->isbezier( ) ) {
880 assert( jarc->pwlArc->npts == 2 );
881 TrimVertex *pts = jarc->pwlArc->pts;
882 REAL s1 = pts[0].param[0];
883 REAL t1 = pts[0].param[1];
884 REAL s2 = pts[1].param[0];
885 REAL t2 = pts[1].param[1];
886
887 jarc->pwlArc->deleteMe( pwlarcpool ); jarc->pwlArc = 0;
888
889 switch( jarc->getside() ) {
890 case arc_left:
891 assert( s1 == s2 );
892 arctessellator.pwl_left( jarc, s1, t1, t2, lrate );
893 break;
894 case arc_right:
895 assert( s1 == s2 );
896 arctessellator.pwl_right( jarc, s1, t1, t2, rrate );
897 break;
898 case arc_top:
899 assert( t1 == t2 );
900 arctessellator.pwl_top( jarc, t1, s1, s2, trate );
901 break;
902 case arc_bottom:
903 assert( t1 == t2 );
904 arctessellator.pwl_bottom( jarc, t1, s1, s2, brate );
905 break;
906 case arc_none:
907 (void) abort();
908 break;
909 }
910 assert( ! jarc->isbezier() );
911 assert( jarc->check() != 0 );
912 }
913 }
914}
#define abort()
Definition: i386-dis.c:34

◆ tessellation()

void Subdivider::tessellation ( Bin bin,
Patchlist patchlist 
)
private

Definition at line 571 of file subdivider.cc.

572{
573 // tessellate unsampled trim curves
574 tessellate( bin, patchlist.pspec[1].sidestep[1], patchlist.pspec[0].sidestep[1],
575 patchlist.pspec[1].sidestep[0], patchlist.pspec[0].sidestep[0] );
576
577 // set interior sampling rates
578 slicer.setstriptessellation( patchlist.pspec[0].stepsize, patchlist.pspec[1].stepsize );
579
580 //added by zl: set the order which will be used in slicer.c++
581 slicer.set_ulinear( (patchlist.get_uorder() == 2));
582 slicer.set_vlinear( (patchlist.get_vorder() == 2));
583
584 // set boundary sampling rates
585 stepsizes[0] = patchlist.pspec[1].stepsize;
586 stepsizes[1] = patchlist.pspec[0].stepsize;
587 stepsizes[2] = patchlist.pspec[1].stepsize;
588 stepsizes[3] = patchlist.pspec[0].stepsize;
589}
int get_vorder()
Definition: patchlist.h:83
int get_uorder()
Definition: patchlist.h:76
void set_ulinear(int ulinear_flag)
Definition: slicer.h:63
void set_vlinear(int vlinear_flag)
Definition: slicer.h:67
void setstriptessellation(REAL, REAL)
Definition: slicer.cc:1203
REAL sidestep[2]
Definition: patch.h:48
REAL stepsize
Definition: patch.h:49

Referenced by samplingSplit().

Member Data Documentation

◆ arcpool

Pool Subdivider::arcpool
private

◆ arctessellator

ArcTessellator Subdivider::arctessellator
private

Definition at line 113 of file subdivider.h.

Referenced by join_s(), join_t(), makeBorderTrim(), makePatchBoundary(), and tessellate().

◆ backend

Backend& Subdivider::backend
private

◆ bezierarcpool

Pool Subdivider::bezierarcpool
private

Definition at line 115 of file subdivider.h.

Referenced by addArc(), clear(), and freejarcs().

◆ domain_distance_u_rate

REAL Subdivider::domain_distance_u_rate
private

Definition at line 188 of file subdivider.h.

Referenced by drawSurfaces(), and set_domain_distance_u_rate().

◆ domain_distance_v_rate

REAL Subdivider::domain_distance_v_rate
private

Definition at line 189 of file subdivider.h.

Referenced by drawSurfaces(), and set_domain_distance_v_rate().

◆ initialbin

Bin Subdivider::initialbin
private

Definition at line 123 of file subdivider.h.

Referenced by addArc(), drawSurfaces(), and makeBorderTrim().

◆ is_domain_distance_sampling

int Subdivider::is_domain_distance_sampling
private

Definition at line 190 of file subdivider.h.

Referenced by drawSurfaces(), and set_is_domain_distance_sampling().

◆ isArcTypeBezier

int Subdivider::isArcTypeBezier
private

Definition at line 134 of file subdivider.h.

Referenced by isBezierArcType(), setArcTypeBezier(), and setArcTypePwl().

◆ jumpbuffer

JumpBuffer* Subdivider::jumpbuffer
private

◆ pjarc

Arc_ptr Subdivider::pjarc
private

Definition at line 124 of file subdivider.h.

Referenced by addArc(), beginLoop(), makeBorderTrim(), and makePatchBoundary().

◆ pwlarcpool

Pool Subdivider::pwlarcpool
private

Definition at line 116 of file subdivider.h.

Referenced by addArc(), arc_split(), clear(), freejarcs(), monotonize(), and tessellate().

◆ qlist

Quilt* Subdivider::qlist
private

Definition at line 127 of file subdivider.h.

Referenced by addQuilt(), beginQuilts(), drawCurves(), drawSurfaces(), and splitInT().

◆ renderhints

◆ s_index

int Subdivider::s_index
private

Definition at line 125 of file subdivider.h.

Referenced by splitInS(), and splitInT().

◆ showDegenerate

int Subdivider::showDegenerate
private

Definition at line 133 of file subdivider.h.

Referenced by setDegenerate(), setNonDegenerate(), and showingDegenerate().

◆ slicer

Slicer Subdivider::slicer
private

Definition at line 112 of file subdivider.h.

Referenced by drawSurfaces(), outline(), render(), and tessellation().

◆ smbrkpts

Flist Subdivider::smbrkpts
private

Definition at line 130 of file subdivider.h.

Referenced by findIrregularS(), monosplitInS(), and nonSamplingSplit().

◆ spbrkpts

Flist Subdivider::spbrkpts
private

Definition at line 128 of file subdivider.h.

Referenced by drawSurfaces(), splitInS(), splitInT(), and subdivideInS().

◆ stepsizes

REAL Subdivider::stepsizes[4]
private

Definition at line 132 of file subdivider.h.

Referenced by join_s(), join_t(), and tessellation().

◆ t_index

int Subdivider::t_index
private

Definition at line 126 of file subdivider.h.

Referenced by splitInT().

◆ tmbrkpts

Flist Subdivider::tmbrkpts
private

Definition at line 131 of file subdivider.h.

Referenced by findIrregularT(), monosplitInS(), and monosplitInT().

◆ tpbrkpts

Flist Subdivider::tpbrkpts
private

Definition at line 129 of file subdivider.h.

Referenced by drawSurfaces(), splitInS(), and splitInT().

◆ trimvertexpool

TrimVertexPool Subdivider::trimvertexpool
private

Definition at line 117 of file subdivider.h.

Referenced by arc_split(), and clear().


The documentation for this class was generated from the following files: