ReactOS 0.4.16-dev-329-g9223134
Varray Class Reference

#include <varray.h>

Public Member Functions

 Varray ()
 
 ~Varray ()
 
long init (REAL, Arc *, Arc *)
 

Public Attributes

REALvarray
 
REAL vval [1000]
 
long voffset [1000]
 
long numquads
 

Private Member Functions

void update (Arc *, long[2], REAL)
 
void grow (long)
 
void append (REAL)
 

Private Attributes

long size
 

Detailed Description

Definition at line 43 of file varray.h.

Constructor & Destructor Documentation

◆ Varray()

Varray::Varray ( void  )

Definition at line 54 of file varray.cc.

55{
56 int i;
57
58 varray = 0;
59 size = 0;
60 numquads = 0;
61
62 for (i = 0; i < 1000; i++) {
63 vval[i] = 0;
64 voffset[i] = 0;
65 }
66}
long numquads
Definition: varray.h:51
REAL * varray
Definition: varray.h:48
long voffset[1000]
Definition: varray.h:50
REAL vval[1000]
Definition: varray.h:49
GLsizeiptr size
Definition: glext.h:5919
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

◆ ~Varray()

Varray::~Varray ( void  )

Definition at line 68 of file varray.cc.

69{
70 if( varray ) delete[] varray;
71}

Member Function Documentation

◆ append()

void Varray::append ( REAL  v)
inlineprivate

Definition at line 61 of file varray.h.

62{
63 if( v != vval[numquads] )
64 vval[++numquads] = v;
65}
const GLdouble * v
Definition: gl.h:2040

Referenced by init(), and update().

◆ grow()

void Varray::grow ( long  guess)
private

Definition at line 87 of file varray.cc.

88{
89 if( size < guess ) {
90 size = guess * 2;
91 if( varray ) delete[] varray;
92 varray = new REAL[size];
93 assert( varray != 0 );
94 }
95}
long size
Definition: varray.h:54
float REAL
Definition: types.h:41
#define assert(x)
Definition: debug.h:53

Referenced by init().

◆ init()

long Varray::init ( REAL  ,
Arc ,
Arc  
)

Definition at line 98 of file varray.cc.

99{
100 Arc_ptr left = toparc->next;
101 Arc_ptr right = toparc;
102 long ldir[2], rdir[2];
103
104 ldir[0] = sgn( left->tail()[0] - left->prev->tail()[0] );
105 ldir[1] = sgn( left->tail()[1] - left->prev->tail()[1] );
106 rdir[0] = sgn( right->tail()[0] - right->prev->tail()[0] );
107 rdir[1] = sgn( right->tail()[1] - right->prev->tail()[1] );
108
109 vval[0] = toparc->tail()[1];
110 numquads = 0;
111
112 while( 1 ) {
113 switch( sgn( left->tail()[1] - right->prev->tail()[1] ) ) {
114 case 1:
115 left = left->next;
116 update( left, ldir, left->prev->tail()[1] );
117 break;
118 case -1:
119 right = right->prev;
120 update( right, rdir, right->tail()[1] );
121 break;
122 case 0:
123 if( glu_abs(left->tail()[1] - botarc->tail()[1]) < TINY) goto end;
124 if( glu_abs(left->tail()[0]-right->prev->tail()[0]) < TINY &&
125 glu_abs(left->tail()[1]-right->prev->tail()[1]) < TINY) goto end;
126 left = left->next;
127 break;
128 }
129 }
130
131end:
132 append( botarc->tail()[1] );
133
134 grow( ((long) ((vval[0] - vval[numquads])/delta)) + numquads + 2 );
135
136 long i, index = 0;
137 for( i=0; i<numquads; i++ ) {
138 voffset[i] = index;
139 varray[index++] = vval[i];
140 REAL dist = vval[i] - vval[i+1];
141 if( dist > delta ) {
142 long steps = ((long) (dist/delta)) +1;
143 float deltav = - dist / (REAL) steps;
144 for( long j=1; j<steps; j++ )
145 varray[index++] = vval[i] + j * deltav;
146 }
147 }
148 voffset[i] = index;
149 varray[index] = vval[i];
150 return index;
151}
#define index(s, c)
Definition: various.h:29
void update(Arc *, long[2], REAL)
Definition: varray.cc:74
void append(REAL)
Definition: varray.h:61
void grow(long)
Definition: varray.cc:87
class Arc * Arc_ptr
Definition: arc.h:50
GLuint GLuint end
Definition: gl.h:1545
GLuint index
Definition: glext.h:6031
GLdouble GLdouble right
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
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
static DWORD DWORD DWORD DWORD * steps
Definition: cursoricon.c:1638
#define long
Definition: qsort.c:33
REAL glu_abs(REAL x)
Definition: simplemath.h:50
long sgn(REAL x)
Definition: varray.cc:48
#define TINY
Definition: varray.cc:47

Referenced by Slicer::slice_old().

◆ update()

void Varray::update ( Arc ,
long  [2],
REAL   
)
inlineprivate

Definition at line 74 of file varray.cc.

75{
76 register long ds = sgn(arc->tail()[0] - arc->prev->tail()[0]);
77 register long dt = sgn(arc->tail()[1] - arc->prev->tail()[1]);
78
79 if( dir[0] != ds || dir[1] != dt ) {
80 dir[0] = ds;
81 dir[1] = dt;
82 append( val );
83 }
84}
unsigned int dir
Definition: maze.c:112
GLuint GLfloat * val
Definition: glext.h:7180
#define ds
Definition: i386-dis.c:443

Referenced by init().

Member Data Documentation

◆ numquads

long Varray::numquads

Definition at line 51 of file varray.h.

Referenced by append(), init(), Slicer::slice_old(), and Varray().

◆ size

long Varray::size
private

Definition at line 54 of file varray.h.

Referenced by grow().

◆ varray

REAL* Varray::varray

Definition at line 48 of file varray.h.

Referenced by grow(), init(), Slicer::slice_old(), Varray(), and ~Varray().

◆ voffset

long Varray::voffset[1000]

Definition at line 50 of file varray.h.

Referenced by init(), Slicer::slice_old(), and Varray().

◆ vval

REAL Varray::vval[1000]

Definition at line 49 of file varray.h.

Referenced by append(), init(), Slicer::slice_old(), and Varray().


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