ReactOS 0.4.15-dev-8102-g108db8f
intersect.cc File Reference
#include "subdivider.h"
#include "backend.h"
Include dependency graph for intersect.cc:

Go to the source code of this file.

Enumerations

enum  i_result { INTERSECT_VERTEX , INTERSECT_EDGE }
 

Functions

static int arc_classify (Arc_ptr, int, REAL)
 
static enum i_result pwlarc_intersect (PwlArc *, int, REAL, int, int[3])
 
static void vert_interp (TrimVertex *n, TrimVertex *l, TrimVertex *r, int p, REAL val)
 

Enumeration Type Documentation

◆ i_result

Enumerator
INTERSECT_VERTEX 
INTERSECT_EDGE 

Definition at line 51 of file intersect.cc.

@ INTERSECT_VERTEX
Definition: intersect.cc:51
@ INTERSECT_EDGE
Definition: intersect.cc:51

Function Documentation

◆ arc_classify()

static int arc_classify ( Arc_ptr  jarc,
int  param,
REAL  value 
)
static

Definition at line 405 of file intersect.cc.

406{
407 REAL tdiff, hdiff;
408 if( param == 0 ) {
409 tdiff = jarc->tail()[0] - value;
410 hdiff = jarc->head()[0] - value;
411 } else {
412 tdiff = jarc->tail()[1] - value;
413 hdiff = jarc->head()[1] - value;
414 }
415
416 if( tdiff > 0.0 ) {
417 if( hdiff > 0.0 ) {
418 return 0x11;
419 } else if( hdiff == 0.0 ) {
420 return 0x12;
421 } else {
422 return 0x10;
423 }
424 } else if( tdiff == 0.0 ) {
425 if( hdiff > 0.0 ) {
426 return 0x21;
427 } else if( hdiff == 0.0 ) {
428 return 0x22;
429 } else {
430 return 0x20;
431 }
432 } else {
433 if( hdiff > 0.0 ) {
434 return 0x01;
435 } else if( hdiff == 0.0 ) {
436 return 0x02;
437 } else {
438 return 0;
439 }
440 }
441}
float REAL
Definition: types.h:41
GLfloat param
Definition: glext.h:5796
Definition: pdh_main.c:94

Referenced by Subdivider::classify_headonleft_s(), Subdivider::classify_headonleft_t(), Subdivider::classify_headonright_s(), Subdivider::classify_headonright_t(), Subdivider::classify_tailonleft_s(), Subdivider::classify_tailonleft_t(), Subdivider::classify_tailonright_s(), and Subdivider::classify_tailonright_t().

◆ pwlarc_intersect()

static enum i_result pwlarc_intersect ( PwlArc pwlArc,
int  param,
REAL  value,
int  dir,
int  loc[3] 
)
static

Definition at line 346 of file intersect.cc.

352{
353 assert( pwlArc->npts > 0 );
354
355 if( dir ) {
356 TrimVertex *v = pwlArc->pts;
357 int imin = 0;
358 int imax = pwlArc->npts - 1;
359 assert( value > v[imin].param[param] );
360 assert( value < v[imax].param[param] );
361 while( (imax - imin) > 1 ) {
362 int imid = (imax + imin)/2;
363 if( v[imid].param[param] > value )
364 imax = imid;
365 else if( v[imid].param[param] < value )
366 imin = imid;
367 else {
368 loc[1] = imid;
369 return INTERSECT_VERTEX;
370 }
371 }
372 loc[0] = imin;
373 loc[2] = imax;
374 return INTERSECT_EDGE;
375 } else {
376 TrimVertex *v = pwlArc->pts;
377 int imax = 0;
378 int imin = pwlArc->npts - 1;
379 assert( value > v[imin].param[param] );
380 assert( value < v[imax].param[param] );
381 while( (imin - imax) > 1 ) {
382 int imid = (imax + imin)/2;
383 if( v[imid].param[param] > value )
384 imax = imid;
385 else if( v[imid].param[param] < value )
386 imin = imid;
387 else {
388 loc[1] = imid;
389 return INTERSECT_VERTEX;
390 }
391 }
392 loc[0] = imin;
393 loc[2] = imax;
394 return INTERSECT_EDGE;
395 }
396}
unsigned int dir
Definition: maze.c:112
int npts
Definition: pwlarc.h:47
TrimVertex * pts
Definition: pwlarc.h:46
#define assert(x)
Definition: debug.h:53
const GLdouble * v
Definition: gl.h:2040
static int imin(int a, int b)
Definition: format.c:174
static int imax(int a, int b)
Definition: format.c:179

Referenced by Subdivider::arc_split().

◆ vert_interp()

static void vert_interp ( TrimVertex n,
TrimVertex l,
TrimVertex r,
int  p,
REAL  val 
)
inlinestatic

Definition at line 157 of file intersect.cc.

158{
159 assert( val > l->param[p]);
160 assert( val < r->param[p]);
161
162 n->nuid = l->nuid;
163
164 n->param[p] = val;
165 if( l->param[1-p] != r->param[1-p] ) {
166 REAL ratio = (val - l->param[p]) / (r->param[p] - l->param[p]);
167 n->param[1-p] = l->param[1-p] +
168 ratio * (r->param[1-p] - l->param[1-p]);
169 } else {
170 n->param[1-p] = l->param[1-p];
171 }
172}
r l[0]
Definition: byte_order.h:168
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLdouble n
Definition: glext.h:7729
GLuint GLfloat * val
Definition: glext.h:7180
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by Subdivider::arc_split().