ReactOS 0.4.16-dev-117-g38f21f9
reflexChain Class Reference

#include <monoTriangulation.h>

Public Member Functions

 reflexChain (Int size, Int isIncreasing)
 
 ~reflexChain ()
 
void insert (Real u, Real v)
 
void insert (Real v[2])
 
void processNewVertex (Real v[2], primStream *pStream)
 
void outputFan (Real v[2], primStream *pStream)
 
void processNewVertex (Real v[2], Backend *backend)
 
void outputFan (Real v[2], Backend *backend)
 
void print ()
 

Private Attributes

Real2queue
 
Int isIncreasing
 
Int index_queue
 
Int size_queue
 

Detailed Description

Definition at line 43 of file monoTriangulation.h.

Constructor & Destructor Documentation

◆ reflexChain()

reflexChain::reflexChain ( Int  size,
Int  isIncreasing 
)

Definition at line 1342 of file monoTriangulation.cc.

1343{
1344 queue = (Real2*) malloc(sizeof(Real2) * size);
1345 assert(queue);
1346 index_queue = 0;
1347 size_queue = size;
1348 isIncreasing = is_increasing;
1349}
Definition: _queue.h:67
#define malloc
Definition: debug_ros.c:4
Real Real2[2]
Definition: definitions.h:38
#define assert(x)
Definition: debug.h:53
GLsizeiptr size
Definition: glext.h:5919

◆ ~reflexChain()

reflexChain::~reflexChain ( )

Definition at line 1351 of file monoTriangulation.cc.

1352{
1353 free(queue);
1354}
#define free
Definition: debug_ros.c:5

Member Function Documentation

◆ insert() [1/2]

void reflexChain::insert ( Real  u,
Real  v 
)

Definition at line 1359 of file monoTriangulation.cc.

1360{
1361 Int i;
1362 if(index_queue >= size_queue) {
1363 Real2 *temp = (Real2*) malloc(sizeof(Real2) * (2*size_queue+1));
1364 assert(temp);
1365
1366 /*copy*/
1367 for(i=0; i<index_queue; i++){
1368 temp[i][0] = queue[i][0];
1369 temp[i][1] = queue[i][1];
1370 }
1371
1372 free(queue);
1373 queue = temp;
1374 size_queue = 2*size_queue + 1;
1375 }
1376
1377 queue[index_queue][0] = u;
1378 queue[index_queue][1] = v;
1379 index_queue ++;
1380}
int Int
Definition: definitions.h:37
const GLdouble * v
Definition: gl.h:2040
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
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 * u
Definition: glfuncs.h:240
static calc_node_t temp
Definition: rpn_ieee.c:38

◆ insert() [2/2]

void reflexChain::insert ( Real  v[2])

Definition at line 1382 of file monoTriangulation.cc.

1383{
1384 insert(v[0], v[1]);
1385}
static int insert
Definition: xmllint.c:138

◆ outputFan() [1/2]

void reflexChain::outputFan ( Real  v[2],
Backend backend 
)

Definition at line 43 of file monoTriangulationBackend.cc.

44{
45 Int i;
46 /*
47 TrimVertex trimVert;
48 */
49 backend->bgntfan();
50
51 /*
52 trimVert.param[0]=v[0];
53 trimVert.param[1]=v[1];
54 backend->tmeshvert(&trimVert);
55 */
56 backend->tmeshvert(v[0], v[1]);
57
58 if(isIncreasing) {
59 for(i=0; i<index_queue; i++)
60 {
61 /*
62 trimVert.param[0]=queue[i][0];
63 trimVert.param[1]=queue[i][1];
64 backend->tmeshvert(&trimVert);
65 */
66 backend->tmeshvert(queue[i][0], queue[i][1]);
67 }
68 }
69 else {
70 for(i=index_queue-1; i>=0; i--)
71 {
72 /*
73 trimVert.param[0]=queue[i][0];
74 trimVert.param[1]=queue[i][1];
75 backend->tmeshvert(&trimVert);
76 */
77 backend->tmeshvert(queue[i][0], queue[i][1]);
78 }
79 }
80 backend->endtfan();
81}
void tmeshvert(GridTrimVertex *)
Definition: backend.cc:269
void bgntfan()
Definition: backend.cc:185
void endtfan()
Definition: backend.cc:197

◆ outputFan() [2/2]

void reflexChain::outputFan ( Real  v[2],
primStream pStream 
)

Definition at line 1404 of file monoTriangulation.cc.

1405{
1406 Int i;
1407 pStream->begin();
1408 pStream->insert(v);
1409 if(isIncreasing) {
1410 for(i=0; i<index_queue; i++)
1411 pStream->insert(queue[i]);
1412 }
1413 else {
1414 for(i=index_queue-1; i>=0; i--)
1415 pStream->insert(queue[i]);
1416 }
1417 pStream->end(PRIMITIVE_STREAM_FAN);
1418}
void insert(Real u, Real v)
void end(Int type)
@ PRIMITIVE_STREAM_FAN

Referenced by monoTriangulationRec(), monoTriangulationRecFun(), monoTriangulationRecFunBackend(), monoTriangulationRecFunGen(), and monoTriangulationRecGen().

◆ print()

void reflexChain::print ( )

Definition at line 1474 of file monoTriangulation.cc.

1475{
1476 Int i;
1477 printf("reflex chain: isIncreasing=%i\n", isIncreasing);
1478 for(i=0; i<index_queue; i++) {
1479 printf("(%f,%f) ", queue[i][0], queue[i][1]);
1480 }
1481 printf("\n");
1482}
#define printf
Definition: freeldr.h:97

◆ processNewVertex() [1/2]

void reflexChain::processNewVertex ( Real  v[2],
Backend backend 
)

Definition at line 83 of file monoTriangulationBackend.cc.

84{
85 Int i,j,k;
87 /*TrimVertex trimVert;*/
88 /*if there are at most one vertex in the queue, then simply insert
89 */
90 if(index_queue <=1){
91 insert(v);
92 return;
93 }
94
95 /*there are at least two vertices in the queue*/
96 j=index_queue-1;
97
98 for(i=j; i>=1; i--) {
99 if(isIncreasing) {
100 isReflex = (area(queue[i-1], queue[i], v) <= 0.0);
101 }
102 else /*decreasing*/{
103 isReflex = (area(v, queue[i], queue[i-1]) <= 0.0);
104 }
105 if(isReflex) {
106 break;
107 }
108 }
109
110 /*
111 *if i<j then vertices: i+1--j are convex
112 * output triangle fan:
113 * v, and queue[i], i+1, ..., j
114 */
115 if(i<j)
116 {
117 backend->bgntfan();
118 /*
119 trimVert.param[0]=v[0];
120 trimVert.param[1]=v[1];
121 backend->tmeshvert(& trimVert);
122 */
123 backend->tmeshvert(v[0], v[1]);
124
125 if(isIncreasing) {
126 for(k=i; k<=j; k++)
127 {
128 /*
129 trimVert.param[0]=queue[k][0];
130 trimVert.param[1]=queue[k][1];
131 backend->tmeshvert(& trimVert);
132 */
133 backend->tmeshvert(queue[k][0], queue[k][1]);
134 }
135 }
136 else {
137 for(k=j; k>=i; k--)
138 {
139 /*
140 trimVert.param[0]=queue[k][0];
141 trimVert.param[1]=queue[k][1];
142 backend->tmeshvert(& trimVert);
143 */
144 backend->tmeshvert(queue[k][0], queue[k][1]);
145 }
146 }
147
148 backend->endtfan();
149 }
150
151 /*delete vertices i+1--j from the queue*/
152 index_queue = i+1;
153 /*finally insert v at the end of the queue*/
154 insert(v);
155
156}
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
int k
Definition: mpi.c:3369
Int isReflex(directedLine *v)
Definition: partitionY.cc:122
static Real area(Real A[2], Real B[2], Real C[2])
Definition: polyDBG.cc:50

◆ processNewVertex() [2/2]

void reflexChain::processNewVertex ( Real  v[2],
primStream pStream 
)

Definition at line 1420 of file monoTriangulation.cc.

1421{
1422 Int i,j,k;
1423 Int isReflex;
1424 /*if there are at most one vertex in the queue, then simply insert
1425 */
1426 if(index_queue <=1){
1427 insert(v);
1428 return;
1429 }
1430
1431 /*there are at least two vertices in the queue*/
1432 j=index_queue-1;
1433
1434 for(i=j; i>=1; i--) {
1435 if(isIncreasing) {
1436 isReflex = (area(queue[i-1], queue[i], v) <= 0.0);
1437 }
1438 else /*decreasing*/{
1439 isReflex = (area(v, queue[i], queue[i-1]) <= 0.0);
1440 }
1441 if(isReflex) {
1442 break;
1443 }
1444 }
1445
1446 /*
1447 *if i<j then vertices: i+1--j are convex
1448 * output triangle fan:
1449 * v, and queue[i], i+1, ..., j
1450 */
1451 if(i<j)
1452 {
1453 pStream->begin();
1454 pStream->insert(v);
1455 if(isIncreasing) {
1456 for(k=i; k<=j; k++)
1457 pStream->insert(queue[k]);
1458 }
1459 else {
1460 for(k=j; k>=i; k--)
1461 pStream->insert(queue[k]);
1462 }
1463
1464 pStream->end(PRIMITIVE_STREAM_FAN);
1465 }
1466
1467 /*delete vertices i+1--j from the queue*/
1468 index_queue = i+1;
1469 /*finally insert v at the end of the queue*/
1470 insert(v);
1471
1472}

Referenced by monoTriangulation2(), monoTriangulationRec(), monoTriangulationRecFun(), monoTriangulationRecFunBackend(), monoTriangulationRecFunGen(), and monoTriangulationRecGen().

Member Data Documentation

◆ index_queue

Int reflexChain::index_queue
private

Definition at line 51 of file monoTriangulation.h.

Referenced by insert(), outputFan(), print(), processNewVertex(), and reflexChain().

◆ isIncreasing

Int reflexChain::isIncreasing
private

Definition at line 50 of file monoTriangulation.h.

Referenced by outputFan(), print(), processNewVertex(), and reflexChain().

◆ queue

Real2* reflexChain::queue
private

Definition at line 44 of file monoTriangulation.h.

◆ size_queue

Int reflexChain::size_queue
private

Definition at line 52 of file monoTriangulation.h.

Referenced by insert(), and reflexChain().


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