ReactOS 0.4.16-dev-88-ga65b6ae
Knotspec Struct Reference
Collaboration diagram for Knotspec:

Public Member Functions

 Knotspec (void)
 
 ~Knotspec (void)
 
void factors (void)
 
void insert (REAL *)
 
void preselect ()
 
void select (void)
 
void copy (INREAL *, REAL *)
 
void breakpoints (void)
 
void knots (void)
 
void transform (REAL *)
 
void showpts (REAL *)
 
void pt_io_copy (REAL *, INREAL *)
 
void pt_oo_copy (REAL *, REAL *)
 
void pt_oo_sum (REAL *, REAL *, REAL *, Knot, Knot)
 

Public Attributes

long order
 
Knot_ptr inkbegin
 
Knot_ptr inkend
 
Knot_ptr outkbegin
 
Knot_ptr outkend
 
Knot_ptr kleft
 
Knot_ptr kright
 
Knot_ptr kfirst
 
Knot_ptr klast
 
Knot_ptr sbegin
 
Breakptbbegin
 
Breakptbend
 
int ncoords
 
int prestride
 
int poststride
 
int preoffset
 
int postoffset
 
int prewidth
 
int postwidth
 
int istransformed
 
Knotspecnext
 
Knotspeckspectotrans
 

Detailed Description

Definition at line 54 of file tobezier.cc.

Constructor & Destructor Documentation

◆ Knotspec()

Knotspec::Knotspec ( void  )

Definition at line 315 of file tobezier.cc.

316{
317 bbegin = 0;
318 sbegin = 0;
319 outkbegin = 0;
320}
Knot_ptr sbegin
Definition: tobezier.cc:64
Breakpt * bbegin
Definition: tobezier.cc:65
Knot_ptr outkbegin
Definition: tobezier.cc:58

◆ ~Knotspec()

Knotspec::~Knotspec ( void  )

Definition at line 608 of file tobezier.cc.

609{
610 if( bbegin ) delete[] bbegin;
611 if( sbegin ) delete[] sbegin;
612 if( outkbegin ) delete[] outkbegin;
613}

Member Function Documentation

◆ breakpoints()

void Knotspec::breakpoints ( void  )

Definition at line 505 of file tobezier.cc.

506{
507 Breakpt *ubpt = bbegin;
508 Breakpt *ubend = bend;
509 long nfactors = 0;
510
511 ubpt->value = ubend->value;
512 ubpt->multi = ubend->multi;
513
514 kleft = kright;
515
516 for( ; kright != klast; kright++ ) {
517 if ( identical(*kright,ubpt->value) ) {
518 (ubpt->multi)++;
519 } else {
520 ubpt->def = (int) (order - ubpt->multi);
521 nfactors += (ubpt->def * (ubpt->def - 1)) / 2;
522 (++ubpt)->value = *kright;
523 ubpt->multi = 1;
524 }
525 }
526 ubpt->def = (int) (order - ubpt->multi);
527 nfactors += (ubpt->def * (ubpt->def - 1)) / 2;
528
529 bend = ubpt;
530
531 if( nfactors ) {
532 sbegin = new Knot[nfactors];
533 } else {
534 sbegin = NULL;
535 }
536}
#define NULL
Definition: types.h:112
REAL Knot
Definition: types.h:45
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
GLuint GLdouble GLdouble GLint GLint order
Definition: glext.h:11194
int identical(Knot x, Knot y)
Definition: knotvector.h:58
int def
Definition: tobezier.cc:51
int multi
Definition: tobezier.cc:50
Knot value
Definition: tobezier.cc:49
Breakpt * bend
Definition: tobezier.cc:66
Knot_ptr klast
Definition: tobezier.cc:63
Knot_ptr kright
Definition: tobezier.cc:61
Knot_ptr kleft
Definition: tobezier.cc:60
Definition: pdh_main.c:94

Referenced by select().

◆ copy()

void Knotspec::copy ( INREAL inpt,
REAL outpt 
)

Definition at line 330 of file tobezier.cc.

331{
332 inpt = (INREAL *) (((char *) inpt) + preoffset);
333
334 if( next ) {
335 for( REAL *lpt=outpt+prewidth; outpt != lpt; outpt += poststride ) {
336 next->copy( inpt, outpt );
337 inpt = (INREAL *) (((char *) inpt) + prestride);
338 }
339 } else {
340 for( REAL *lpt=outpt+prewidth; outpt != lpt; outpt += poststride ) {
341 pt_io_copy( outpt, inpt );
342 inpt = (INREAL *) (((char *) inpt) + prestride);
343 }
344 }
345}
#define INREAL
Definition: types.h:40
float REAL
Definition: types.h:41
Knotspec * next
Definition: tobezier.cc:75
int prestride
Definition: tobezier.cc:68
int poststride
Definition: tobezier.cc:69
void copy(INREAL *, REAL *)
Definition: tobezier.cc:330
int preoffset
Definition: tobezier.cc:70
int prewidth
Definition: tobezier.cc:72
void pt_io_copy(REAL *, INREAL *)
Definition: tobezier.cc:622

Referenced by Splinespec::copy(), and copy().

◆ factors()

void Knotspec::factors ( void  )

Definition at line 374 of file tobezier.cc.

375{
376 Knot *mid = (outkend - 1) - order + bend->multi;
377 Knot_ptr fptr = sbegin;
378
379 for( Breakpt *bpt = bend; bpt >= bbegin; bpt-- ) {
380 mid -= bpt->multi; // last knot less than knot to insert
381 int def = bpt->def - 1; // number of knots to insert
382 if( def <= 0 ) continue;
383 Knot kv = bpt->value; // knot to insert
384
385 Knot *kf = (mid-def) + (order-1);
386 for( Knot *kl = kf + def; kl != kf; kl-- ) {
387 Knot *kh, *kt;
388 for( kt=kl, kh=mid; kt != kf; kh--, kt-- )
389 *(fptr++) = (kv - *kh) / (*kt - *kh);
390 *kl = kv;
391 }
392 }
393}
REAL * Knot_ptr
Definition: types.h:45
Knot_ptr outkend
Definition: tobezier.cc:59

Referenced by select().

◆ insert()

void Knotspec::insert ( REAL p)

Definition at line 403 of file tobezier.cc.

404{
405 Knot_ptr fptr = sbegin;
406 REAL *srcpt = p + prewidth - poststride;
407 REAL *dstpt = p + postwidth + postoffset - poststride;
408 Breakpt *bpt = bend;
409
410 for( REAL *pend = srcpt - poststride*bpt->def; srcpt != pend; pend +=poststride ) {
411 REAL *p1 = srcpt;
412 for( REAL *p2 = srcpt-poststride; p2 != pend; p1 = p2, p2 -= poststride ) {
413 pt_oo_sum( p1, p1, p2, *fptr, 1.0-*fptr );
414 fptr++;
415 }
416 }
417
418 for( --bpt; bpt >= bbegin; bpt-- ) {
419
420 for( int multi = bpt->multi; multi > 0; multi-- ) {
421 pt_oo_copy( dstpt, srcpt );
422 dstpt -= poststride;
423 srcpt -= poststride;
424 }
425
426 for( REAL *pend = srcpt - poststride*bpt->def; srcpt != pend; pend +=poststride, dstpt-=poststride ) {
427 pt_oo_copy( dstpt, srcpt );
428 REAL *p1 = srcpt;
429
430 for( REAL *p2 = srcpt-poststride; p2 != pend; p1=p2, p2 -= poststride ) {
431 pt_oo_sum( p1, p1, p2, *fptr, 1.0-*fptr );
432 fptr++;
433 }
434 }
435 }
436}
GLfloat GLfloat p
Definition: glext.h:8902
int postwidth
Definition: tobezier.cc:73
void pt_oo_copy(REAL *, REAL *)
Definition: tobezier.cc:647
void pt_oo_sum(REAL *, REAL *, REAL *, Knot, Knot)
Definition: tobezier.cc:670
int postoffset
Definition: tobezier.cc:71

Referenced by transform().

◆ knots()

void Knotspec::knots ( void  )

Definition at line 547 of file tobezier.cc.

548{
549 Knot_ptr inkpt = kleft - order;
551
552 /* allocate space for knots and factors */
553 outkbegin = new Knot[inkend-inkpt];
554 Knot_ptr outkpt;
555 for( outkpt = outkbegin; inkpt != inkend; inkpt++, outkpt++ )
556 *outkpt = *inkpt;
557
558 outkend = outkpt;
559}
long order
Definition: tobezier.cc:55
Knot_ptr inkend
Definition: tobezier.cc:57

Referenced by select().

◆ preselect()

void Knotspec::preselect ( void  )

Definition at line 446 of file tobezier.cc.

447{
448 Knot kval;
449
450 /* position klast after last knot of "last" breakpoint */
451 for( klast = inkend - order, kval = *klast; klast != inkend; klast++ )
452 if( ! identical( *klast, kval ) ) break;
453
454 /* position kfirst after last knot of "first" breakpoint */
455 for( kfirst = inkbegin+order-1, kval= *kfirst; kfirst != inkend; kfirst++ )
456 if( ! identical( *kfirst, kval ) ) break;
457
458 /* compute multiplicity of first breakpoint */
459 Knot_ptr k;
460 for( k = kfirst - 1; k >= inkbegin; k-- )
461 if( ! identical( kval, *k ) ) break;
462 k++;
463
464 /* allocate space for breakpoints -
465 use worst case estimate on number of breakpoints */
466
467 bbegin = new Breakpt[(klast - kfirst)+1];
468 /* record multiplicity and value of first breakpoint */
469 bbegin->multi = kfirst - k;
470 bbegin->value = kval;
471 bend = bbegin;
472
473 kleft = kright = kfirst;
474}
int k
Definition: mpi.c:3369
Knot_ptr kfirst
Definition: tobezier.cc:62
Knot_ptr inkbegin
Definition: tobezier.cc:56

◆ pt_io_copy()

void Knotspec::pt_io_copy ( REAL topt,
INREAL frompt 
)

Definition at line 622 of file tobezier.cc.

623{
624 switch( ncoords ) {
625 case 4:
626 topt[3] = (REAL) frompt[3];
627 case 3:
628 topt[2] = (REAL) frompt[2];
629 case 2:
630 topt[1] = (REAL) frompt[1];
631 case 1:
632 topt[0] = (REAL) frompt[0];
633 break;
634 default: {
635 for( int i = 0; i < ncoords; i++ )
636 *topt++ = (REAL) *frompt++;
637 }
638 }
639}
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
int ncoords
Definition: tobezier.cc:67

Referenced by copy().

◆ pt_oo_copy()

void Knotspec::pt_oo_copy ( REAL topt,
REAL frompt 
)

Definition at line 647 of file tobezier.cc.

648{
649 switch( ncoords ) {
650 case 4:
651 topt[3] = frompt[3];
652 case 3:
653 topt[2] = frompt[2];
654 case 2:
655 topt[1] = frompt[1];
656 case 1:
657 topt[0] = frompt[0];
658 break;
659 default:
660 memcpy( topt, frompt, ncoords * sizeof( REAL ) );
661 }
662}
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878

Referenced by insert().

◆ pt_oo_sum()

void Knotspec::pt_oo_sum ( REAL x,
REAL y,
REAL z,
Knot  a,
Knot  b 
)

Definition at line 670 of file tobezier.cc.

671{
672 switch( ncoords ) {
673 case 4:
674 x[3] = a * y[3] + b * z[3];
675 case 3:
676 x[2] = a * y[2] + b * z[2];
677 case 2:
678 x[1] = a * y[1] + b * z[1];
679 case 1:
680 x[0] = a * y[0] + b * z[0];
681 break;
682 default: {
683 for( int i = 0; i < ncoords; i++ )
684 *x++ = a * *y++ + b * *z++;
685 }
686 }
687}
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLdouble GLdouble z
Definition: glext.h:5874

Referenced by insert().

◆ select()

void Knotspec::select ( void  )

Definition at line 485 of file tobezier.cc.

486{
487 breakpoints();
488 knots();
489 factors();
490
492 postwidth = (int)((bend - bbegin) * order);
494 postoffset = (bbegin->def > 1) ? (bbegin->def-1) : 0;
495}
void knots(void)
Definition: tobezier.cc:547
void factors(void)
Definition: tobezier.cc:374
void breakpoints(void)
Definition: tobezier.cc:505

◆ showpts()

void Knotspec::showpts ( REAL outpt)

Definition at line 354 of file tobezier.cc.

355{
356 if( next ) {
357 for( REAL *lpt=outpt+prewidth; outpt != lpt; outpt += poststride )
358 next->showpts( outpt );
359 } else {
360 for( REAL *lpt=outpt+prewidth; outpt != lpt; outpt += poststride )
361 _glu_dprintf( "show %g %g %g\n", outpt[0], outpt[1], outpt[2] );
362 }
363}
void showpts(REAL *)
Definition: tobezier.cc:354

Referenced by showpts().

◆ transform()

void Knotspec::transform ( REAL p)

Definition at line 570 of file tobezier.cc.

571{
572 if( next ) {
573 if( this == kspectotrans ) {
574 next->transform( p );
575 } else {
576 if( istransformed ) {
577 p += postoffset;
578 for( REAL *pend = p + postwidth; p != pend; p += poststride )
579 next->transform( p );
580 } else {
581 REAL *pend = p + prewidth;
582 for( ; p != pend; p += poststride )
583 next->transform( p );
584 }
585 }
586 } else {
587 if( this == kspectotrans ) {
588 insert( p );
589 } else {
590 if( istransformed ) {
591 p += postoffset;
592 for( REAL *pend = p + postwidth; p != pend; p += poststride )
594 } else {
595 REAL *pend = p + prewidth;
596 for( ; p != pend; p += poststride )
598 }
599 }
600 }
601}
void transform(REAL *)
Definition: tobezier.cc:570
int istransformed
Definition: tobezier.cc:74
Knotspec * kspectotrans
Definition: tobezier.cc:76
void insert(REAL *)
Definition: tobezier.cc:403
static int insert
Definition: xmllint.c:138

Referenced by transform(), and Splinespec::transform().

Member Data Documentation

◆ bbegin

Breakpt* Knotspec::bbegin

Definition at line 65 of file tobezier.cc.

Referenced by breakpoints(), factors(), insert(), Knotspec(), preselect(), select(), and ~Knotspec().

◆ bend

Breakpt* Knotspec::bend

Definition at line 66 of file tobezier.cc.

Referenced by breakpoints(), factors(), insert(), knots(), preselect(), and select().

◆ inkbegin

Knot_ptr Knotspec::inkbegin

Definition at line 56 of file tobezier.cc.

Referenced by Splinespec::kspecinit(), preselect(), and select().

◆ inkend

Knot_ptr Knotspec::inkend

Definition at line 57 of file tobezier.cc.

Referenced by knots(), Splinespec::kspecinit(), and preselect().

◆ istransformed

int Knotspec::istransformed

Definition at line 74 of file tobezier.cc.

Referenced by transform(), and Splinespec::transform().

◆ kfirst

Knot_ptr Knotspec::kfirst

Definition at line 62 of file tobezier.cc.

Referenced by preselect().

◆ klast

Knot_ptr Knotspec::klast

Definition at line 63 of file tobezier.cc.

Referenced by breakpoints(), and preselect().

◆ kleft

Knot_ptr Knotspec::kleft

Definition at line 60 of file tobezier.cc.

Referenced by breakpoints(), knots(), preselect(), and select().

◆ kright

Knot_ptr Knotspec::kright

Definition at line 61 of file tobezier.cc.

Referenced by breakpoints(), knots(), and preselect().

◆ kspectotrans

Knotspec* Knotspec::kspectotrans

Definition at line 76 of file tobezier.cc.

Referenced by transform().

◆ ncoords

int Knotspec::ncoords

Definition at line 67 of file tobezier.cc.

Referenced by pt_io_copy(), pt_oo_copy(), and pt_oo_sum().

◆ next

◆ order

long Knotspec::order

Definition at line 55 of file tobezier.cc.

Referenced by knots(), Splinespec::kspecinit(), and select().

◆ outkbegin

Knot_ptr Knotspec::outkbegin

Definition at line 58 of file tobezier.cc.

Referenced by knots(), Knotspec(), select(), and ~Knotspec().

◆ outkend

Knot_ptr Knotspec::outkend

Definition at line 59 of file tobezier.cc.

Referenced by factors(), knots(), and select().

◆ postoffset

int Knotspec::postoffset

Definition at line 71 of file tobezier.cc.

Referenced by insert(), select(), and transform().

◆ poststride

int Knotspec::poststride

Definition at line 69 of file tobezier.cc.

Referenced by copy(), insert(), showpts(), and transform().

◆ postwidth

int Knotspec::postwidth

Definition at line 73 of file tobezier.cc.

Referenced by insert(), select(), and transform().

◆ preoffset

int Knotspec::preoffset

Definition at line 70 of file tobezier.cc.

Referenced by copy(), and select().

◆ prestride

int Knotspec::prestride

Definition at line 68 of file tobezier.cc.

Referenced by copy(), and Splinespec::kspecinit().

◆ prewidth

int Knotspec::prewidth

Definition at line 72 of file tobezier.cc.

Referenced by copy(), insert(), select(), showpts(), and transform().

◆ sbegin

Knot_ptr Knotspec::sbegin

Definition at line 64 of file tobezier.cc.

Referenced by breakpoints(), factors(), insert(), Knotspec(), and ~Knotspec().


The documentation for this struct was generated from the following file: