ReactOS 0.4.15-dev-8100-g1887773
gridWrap Class Reference

#include <gridWrap.h>

Public Member Functions

 gridWrap (Int nUlines, Int nVlines, Real uMin, Real uMax, Real vMin, Real vMax)
 
 gridWrap (Int nUlines, Real *uvals, Int nVlines, Real *vvlas)
 
 ~gridWrap ()
 
void print ()
 
Int get_n_ulines ()
 
Int get_n_vlines ()
 
Real get_u_min ()
 
Real get_u_max ()
 
Real get_v_min ()
 
Real get_v_max ()
 
Real get_u_value (Int i)
 
Real get_v_value (Int j)
 
Realget_u_values ()
 
Realget_v_values ()
 
void outputFanWithPoint (Int v, Int uleft, Int uright, Real vert[2], primStream *pStream)
 
void draw ()
 
Int isUniform ()
 

Private Attributes

Int n_ulines
 
Int n_vlines
 
Real u_min
 
Real u_max
 
Real v_min
 
Real v_max
 
Realu_values
 
Realv_values
 
Int is_uniform
 

Detailed Description

Definition at line 42 of file gridWrap.h.

Constructor & Destructor Documentation

◆ gridWrap() [1/2]

gridWrap::gridWrap ( Int  nUlines,
Int  nVlines,
Real  uMin,
Real  uMax,
Real  vMin,
Real  vMax 
)

Definition at line 79 of file gridWrap.cc.

83{
84 is_uniform = 1;
85 n_ulines = nUlines;
86 n_vlines = nVlines;
87 u_min = uMin;
88 u_max = uMax;
89 v_min = vMin;
90 v_max = vMax;
91 u_values = (Real*) malloc(sizeof(Real) * n_ulines);
93 v_values = (Real*) malloc(sizeof(Real) * n_vlines);
95
96 Int i;
97 assert(nUlines>=2);
98 assert(nVlines>=2);
99 Real du = (uMax-uMin)/(nUlines-1);
100 Real dv = (vMax-vMin)/(nVlines-1);
101
102 float tempu=uMin;
103 u_values[0] = tempu;
104 for(i=1; i<nUlines; i++)
105 {
106 tempu += du;
107 u_values[i] = tempu;
108 }
109 u_values[nUlines-1] = uMax;
110
111 float tempv=vMin;
112 v_values[0] = tempv;
113 for(i=1; i<nVlines; i++)
114 {
115 tempv += dv;
116 v_values[i] = tempv;
117 }
118 v_values[nVlines-1] = vMax;
119}
Real u_max
Definition: gridWrap.h:45
Int is_uniform
Definition: gridWrap.h:55
Real v_max
Definition: gridWrap.h:46
Int n_vlines
Definition: gridWrap.h:44
Real v_min
Definition: gridWrap.h:46
Real * u_values
Definition: gridWrap.h:52
Real * v_values
Definition: gridWrap.h:53
Real u_min
Definition: gridWrap.h:45
Int n_ulines
Definition: gridWrap.h:43
#define malloc
Definition: debug_ros.c:4
int Int
Definition: definitions.h:37
float Real
Definition: definitions.h:36
#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
int vMax
Definition: tritemp.h:142
int vMin
Definition: tritemp.h:142

◆ gridWrap() [2/2]

gridWrap::gridWrap ( Int  nUlines,
Real uvals,
Int  nVlines,
Real vvlas 
)

Definition at line 54 of file gridWrap.cc.

56{
57 assert(nUlines>=2);
58 assert(nVlines>=2);
59
60 is_uniform = 0;
61 n_ulines = nUlines;
62 n_vlines = nVlines;
63 u_min = uvals[0];
64 u_max = uvals[nUlines-1];
65 v_min = vvals[0];
66 v_max = vvals[nVlines-1];
67 u_values = (Real*) malloc(sizeof(Real) * n_ulines);
69 v_values = (Real*) malloc(sizeof(Real) * n_vlines);
71
72 Int i;
73 for(i=0; i<n_ulines; i++)
74 u_values[i] = uvals[i];
75 for(i=0; i<n_vlines; i++)
76 v_values[i] = vvals[i];
77}

◆ ~gridWrap()

gridWrap::~gridWrap ( )

Definition at line 121 of file gridWrap.cc.

122{
123 free(u_values);
124 free(v_values);
125}
#define free
Definition: debug_ros.c:5

Member Function Documentation

◆ draw()

void gridWrap::draw ( )

Definition at line 127 of file gridWrap.cc.

128{
129 int i,j;
131 for(i=0; i<n_ulines; i++)
132 for(j=0; j<n_vlines; j++)
134 glEnd();
135}
Real get_v_value(Int j)
Definition: gridWrap.h:83
Real get_u_value(Int i)
Definition: gridWrap.h:78
GLAPI void GLAPIENTRY glVertex2f(GLfloat x, GLfloat y)
#define GL_POINTS
Definition: gl.h:190
GLAPI void GLAPIENTRY glBegin(GLenum mode)
GLAPI void GLAPIENTRY glEnd(void)
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

◆ get_n_ulines()

Int gridWrap::get_n_ulines ( )
inline

Definition at line 71 of file gridWrap.h.

71{return n_ulines;}

Referenced by Slicer::evalRBArray(), findLeftGridIndices(), findRightGridIndices(), and sampleMonoPoly().

◆ get_n_vlines()

Int gridWrap::get_n_vlines ( )
inline

Definition at line 72 of file gridWrap.h.

72{return n_vlines;}

Referenced by Slicer::evalRBArray(), findGridChains(), and sampleMonoPoly().

◆ get_u_max()

Real gridWrap::get_u_max ( )
inline

Definition at line 74 of file gridWrap.h.

74{return u_max;}

Referenced by Slicer::evalRBArray(), findLeftGridIndices(), and findRightGridIndices().

◆ get_u_min()

Real gridWrap::get_u_min ( )
inline

Definition at line 73 of file gridWrap.h.

73{return u_min;}

Referenced by Slicer::evalRBArray(), findLeftGridIndices(), and findRightGridIndices().

◆ get_u_value()

◆ get_u_values()

Real * gridWrap::get_u_values ( )
inline

Definition at line 85 of file gridWrap.h.

85{return u_values;}

◆ get_v_max()

Real gridWrap::get_v_max ( )
inline

Definition at line 76 of file gridWrap.h.

76{return v_max;}

Referenced by Slicer::evalRBArray(), findGridChains(), and sampleMonoPoly().

◆ get_v_min()

Real gridWrap::get_v_min ( )
inline

Definition at line 75 of file gridWrap.h.

75{return v_min;}

Referenced by Slicer::evalRBArray(), findGridChains(), and sampleMonoPoly().

◆ get_v_value()

◆ get_v_values()

Real * gridWrap::get_v_values ( )
inline

Definition at line 86 of file gridWrap.h.

86{return v_values;}

◆ isUniform()

Int gridWrap::isUniform ( )
inline

Definition at line 93 of file gridWrap.h.

93{return is_uniform;}

◆ outputFanWithPoint()

void gridWrap::outputFanWithPoint ( Int  v,
Int  uleft,
Int  uright,
Real  vert[2],
primStream pStream 
)

Definition at line 137 of file gridWrap.cc.

138{
139 Int i;
140 if(uleft >= uright)
141 return; //no triangles to output.
142
143 pStream->begin();
144 pStream->insert(vert);
145
146 assert(vert[1] != v_values[v]); //don't output degenerate triangles
147
148 if(vert[1] > v_values[v]) //vertex is above this grid line: notice the orientation
149 {
150 for(i=uleft; i<=uright; i++)
151 pStream->insert(u_values[i], v_values[v]);
152 }
153 else //vertex is below the grid line
154 {
155 for(i=uright; i>= uleft; i--)
156 pStream->insert(u_values[i], v_values[v]);
157 }
158
159 pStream->end(PRIMITIVE_STREAM_FAN);
160}
void insert(Real u, Real v)
void end(Int type)
const GLdouble * v
Definition: gl.h:2040
@ PRIMITIVE_STREAM_FAN

Referenced by sampleBotLeftWithGridLine(), sampleBotLeftWithGridLinePost(), sampleBotRightWithGridLine(), sampleBotRightWithGridLinePost(), sampleCompBot(), sampleCompTop(), sampleTopLeftWithGridLine(), sampleTopLeftWithGridLinePost(), sampleTopRightWithGridLine(), and sampleTopRightWithGridLinePost().

◆ print()

void gridWrap::print ( )

Definition at line 47 of file gridWrap.cc.

48{
49 printf("n_ulines = %i\n", n_ulines);
50 printf("n_vlines = %i\n", n_vlines);
51 printf("u_min=%f, umax=%f, vmin=%f, vmax=%f\n", u_min, u_max, v_min, v_max);
52}
#define printf
Definition: freeldr.h:97

Member Data Documentation

◆ is_uniform

Int gridWrap::is_uniform
private

Definition at line 55 of file gridWrap.h.

Referenced by gridWrap(), and isUniform().

◆ n_ulines

Int gridWrap::n_ulines
private

Definition at line 43 of file gridWrap.h.

Referenced by draw(), get_n_ulines(), get_u_value(), gridWrap(), and print().

◆ n_vlines

Int gridWrap::n_vlines
private

Definition at line 44 of file gridWrap.h.

Referenced by draw(), get_n_vlines(), gridWrap(), and print().

◆ u_max

Real gridWrap::u_max
private

Definition at line 45 of file gridWrap.h.

Referenced by get_u_max(), gridWrap(), and print().

◆ u_min

Real gridWrap::u_min
private

Definition at line 45 of file gridWrap.h.

Referenced by get_u_min(), gridWrap(), and print().

◆ u_values

Real* gridWrap::u_values
private

Definition at line 52 of file gridWrap.h.

Referenced by get_u_value(), get_u_values(), gridWrap(), outputFanWithPoint(), and ~gridWrap().

◆ v_max

Real gridWrap::v_max
private

Definition at line 46 of file gridWrap.h.

Referenced by get_v_max(), gridWrap(), and print().

◆ v_min

Real gridWrap::v_min
private

Definition at line 46 of file gridWrap.h.

Referenced by get_v_min(), gridWrap(), and print().

◆ v_values

Real* gridWrap::v_values
private

Definition at line 53 of file gridWrap.h.

Referenced by get_v_value(), get_v_values(), gridWrap(), outputFanWithPoint(), and ~gridWrap().


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