ReactOS 0.4.15-dev-7942-gd23573b
Knotvector Struct Reference

#include <knotvector.h>

Public Member Functions

 Knotvector (void)
 
 ~Knotvector (void)
 
void init (long, long, long, INREAL *)
 
int validate (void)
 
void show (const char *)
 

Public Attributes

long order
 
long knotcount
 
long stride
 
Knotknotlist
 

Detailed Description

Definition at line 41 of file knotvector.h.

Constructor & Destructor Documentation

◆ Knotvector()

Knotvector::Knotvector ( void  )

Definition at line 62 of file knotvector.cc.

63{
64 knotcount = 0;
65 stride = 0;
66 order = 0;
67 knotlist = 0;
68}
GLsizei stride
Definition: glext.h:5848
GLuint GLdouble GLdouble GLint GLint order
Definition: glext.h:11194
long knotcount
Definition: knotvector.h:49
Knot * knotlist
Definition: knotvector.h:51

◆ ~Knotvector()

Knotvector::~Knotvector ( void  )

Definition at line 70 of file knotvector.cc.

71{
72 if( knotlist ) delete[] knotlist;
73}

Member Function Documentation

◆ init()

void Knotvector::init ( long  _knotcount,
long  _stride,
long  _order,
INREAL _knotlist 
)

Definition at line 50 of file knotvector.cc.

51{
52 knotcount = _knotcount;
53 stride = _stride;
54 order = _order;
55 knotlist = new Knot[_knotcount];
56 assert( knotlist != 0 );
57
58 for( int i = 0; i != _knotcount; i++ )
59 knotlist[i] = (Knot) _knotlist[i];
60}
REAL Knot
Definition: types.h:45
#define assert(x)
Definition: debug.h:53
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

Referenced by NurbsTessellator::nurbscurve(), and NurbsTessellator::nurbssurface().

◆ show()

void Knotvector::show ( const char msg)

Definition at line 132 of file knotvector.cc.

133{
134#ifndef NDEBUG
135 _glu_dprintf( "%s\n", msg );
136 _glu_dprintf( "order = %ld, count = %ld\n", order, knotcount );
137
138 for( int i=0; i<knotcount; i++ )
139 _glu_dprintf( "knot[%d] = %g\n", i, knotlist[i] );
140#endif
141}
#define msg(x)
Definition: auth_time.c:54

Referenced by NurbsTessellator::do_check_knots().

◆ validate()

int Knotvector::validate ( void  )

Definition at line 75 of file knotvector.cc.

76{
77 /* kindex is used as an array index so subtract one first,
78 * this propagates throughout the code so study carefully */
79 long kindex = knotcount-1;
80
81 if( order < 1 || order > MAXORDER ) {
82 // spline order un-supported
83 return( 1 );
84 }
85
86 if( knotcount < (2 * order) ) {
87 // too few knots
88 return( 2 );
89 }
90
91 if( identical( knotlist[kindex-(order-1)], knotlist[order-1]) ) {
92 // valid knot range is empty
93 return( 3 );
94 }
95
96 for( long i = 0; i < kindex; i++)
97 if( knotlist[i] > knotlist[i+1] ) {
98 // decreasing knot sequence
99 return( 4 );
100 }
101
102 /* check for valid multiplicity */
103
104 /* kindex is currently the index of the last knot.
105 * In the next loop it is decremented to ignore the last knot
106 * and the loop stops when kindex is 2 so as to ignore the first
107 * knot as well. These knots are not used in computing
108 * knot multiplicities.
109 */
110
111 long multi = 1;
112 for( ; kindex >= 1; kindex-- ) {
113 if( knotlist[kindex] - knotlist[kindex-1] < TOLERANCE ) {
114 multi++;
115 continue;
116 }
117 if ( multi > order ) {
118 // knot multiplicity greater than order of spline
119 return( 5 );
120 }
121 multi = 1;
122 }
123
124 if ( multi > order ) {
125 // knot multiplicity greater than order of spline
126 return( 5 );
127 }
128
129 return 0;
130}
#define MAXORDER
Definition: defines.h:45
#define TOLERANCE
Definition: knotvector.h:55
int identical(Knot x, Knot y)
Definition: knotvector.h:58

Referenced by NurbsTessellator::do_check_knots().

Member Data Documentation

◆ knotcount

long Knotvector::knotcount

Definition at line 49 of file knotvector.h.

Referenced by init(), Knotvector(), Splinespec::kspecinit(), show(), and validate().

◆ knotlist

Knot* Knotvector::knotlist

Definition at line 51 of file knotvector.h.

Referenced by init(), Knotvector(), Splinespec::kspecinit(), show(), validate(), and ~Knotvector().

◆ order

long Knotvector::order

Definition at line 48 of file knotvector.h.

Referenced by Splinespec::kspecinit().

◆ stride

long Knotvector::stride

Definition at line 50 of file knotvector.h.

Referenced by Splinespec::kspecinit().


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