ReactOS  0.4.12-dev-90-g2e2e63e
partitionX.cc File Reference
#include <stdlib.h>
#include "partitionX.h"
Include dependency graph for partitionX.cc:

Go to the source code of this file.

Macros

#define CONCAVITY_ZERO   1.0e-6
 

Functions

Int isCuspX (directedLine *v)
 
Int isReflexX (directedLine *v)
 
Int cuspTypeX (directedLine *v)
 
Int numInteriorCuspsX (directedLine *polygon)
 
void findInteriorCuspsX (directedLine *polygon, Int &ret_n_interior_cusps, directedLine **ret_interior_cusps)
 
directedLinefindDiagonal_singleCuspX (directedLine *cusp)
 

Macro Definition Documentation

◆ CONCAVITY_ZERO

#define CONCAVITY_ZERO   1.0e-6

Definition at line 43 of file partitionX.cc.

Referenced by isReflexX().

Function Documentation

◆ cuspTypeX()

Int cuspTypeX ( directedLine v)

Definition at line 89 of file partitionX.cc.

Referenced by findInteriorCuspsX(), and numInteriorCuspsX().

90 {
91  if(! isCuspX(v)) return 0;
92  else
93  {
94 //printf("isCusp,%f,%f\n", v->head()[0], v->head()[1]);
95  if(isReflexX(v))
96  {
97 // printf("isReflex\n");
98  return 1;
99  }
100  else
101  {
102 // printf("not isReflex\n");
103  return 2;
104  }
105  }
106 }
Int isCuspX(directedLine *v)
Definition: partitionX.cc:47
Int isReflexX(directedLine *v)
Definition: partitionX.cc:67

◆ findDiagonal_singleCuspX()

directedLine* findDiagonal_singleCuspX ( directedLine cusp)

Definition at line 137 of file partitionX.cc.

Referenced by monoTriangulationOpt(), monoTriangulationRecGenOpt(), and sampleMonoPoly().

138 {
140  Int is_minimal = ((compV2InX(cusp->head(), cusp->tail()) == -1)? 1:0);
141 
142  if(is_minimal)
143  for(temp = cusp->getNext(); temp != cusp; temp = temp->getNext())
144  {
145  if(compV2InX(cusp->head(), temp->head()) == 1)
146  {
147  return temp;
148  }
149  }
150  else //is maxmal
151  for(temp = cusp->getNext(); temp != cusp; temp = temp->getNext())
152  {
153  if(compV2InX(cusp->head(), temp->head()) == -1)
154  {
155  return temp;
156  }
157  }
158  return NULL;
159 }
Real * head()
directedLine * getNext()
Definition: directedLine.h:74
smooth NULL
Definition: ftsmooth.c:416
Int compV2InX(Real A[2], Real B[2])
static stack_node_t temp
Definition: rpn.c:18
Real * tail()
int Int
Definition: definitions.h:37

◆ findInteriorCuspsX()

void findInteriorCuspsX ( directedLine polygon,
Int ret_n_interior_cusps,
directedLine **  ret_interior_cusps 
)

Definition at line 121 of file partitionX.cc.

Referenced by monoTriangulationOpt(), monoTriangulationRecGenOpt(), and sampleMonoPoly().

123 {
125  ret_n_interior_cusps = 0;
126  if(cuspTypeX(polygon) == 1)
127  {
128  ret_interior_cusps[ret_n_interior_cusps++] = polygon;
129  }
130  for(temp = polygon->getNext(); temp != polygon; temp = temp->getNext())
131  if(cuspTypeX(temp) == 1)
132  {
133  ret_interior_cusps[ret_n_interior_cusps++] = temp;
134  }
135 }
directedLine * getNext()
Definition: directedLine.h:74
static stack_node_t temp
Definition: rpn.c:18
Int cuspTypeX(directedLine *v)
Definition: partitionX.cc:89

◆ isCuspX()

Int isCuspX ( directedLine v)

Definition at line 47 of file partitionX.cc.

Referenced by cuspTypeX().

48 {
49  //if v->prev <= v && v->next <= v
50  //|| v->prev >= v && v->next >= v
51  Real* T = v->head();
52  Real* P = v->getPrev()->head();
53  Real* N = v->getNext()->head();
54  if(
55  (compV2InX(T,P) != -1 &&
56  compV2InX(T,N) != -1
57  ) ||
58  (compV2InX(T,P) != 1 &&
59  compV2InX(T,N) != 1
60  )
61  )
62  return 1;
63  else
64  return 0;
65 }
Real * head()
#define T
Definition: mbstring.h:31
directedLine * getPrev()
Definition: directedLine.h:73
directedLine * getNext()
Definition: directedLine.h:74
Definition: bidi.c:97
Int compV2InX(Real A[2], Real B[2])
float Real
Definition: definitions.h:36
#define P(row, col)
Definition: m_matrix.c:147

◆ isReflexX()

Int isReflexX ( directedLine v)

Definition at line 67 of file partitionX.cc.

Referenced by cuspTypeX().

68 {
69  Real* A = v->getPrev()->head();
70  Real* B = v->head();
71  Real* C = v->tail();
72  Real Bx,By, Cx, Cy;
73  //scale them in case they are too small
74  Bx = 10*(B[0] - A[0]);
75  By = 10*(B[1] - A[1]);
76  Cx = 10*(C[0] - A[0]);
77  Cy = 10*(C[1] - A[1]);
78 
79  if(Bx*Cy - Cx*By < -CONCAVITY_ZERO) return 1;
80  else return 0;
81 }
Real * head()
#define B(row, col)
Definition: m_matrix.c:146
directedLine * getPrev()
Definition: directedLine.h:73
Definition: ttei1.cpp:12
Real * tail()
Definition: ttei6.cpp:27
float Real
Definition: definitions.h:36
#define CONCAVITY_ZERO
Definition: partitionX.cc:43

◆ numInteriorCuspsX()

Int numInteriorCuspsX ( directedLine polygon)

Definition at line 108 of file partitionX.cc.

109 {
111  int ret = 0;
112  if(cuspTypeX(polygon) == 1)
113  ret++;
114  for(temp = polygon->getNext(); temp != polygon; temp = temp->getNext())
115  if(cuspTypeX(temp) == 1)
116  ret++;
117  return ret;
118 }
directedLine * getNext()
Definition: directedLine.h:74
int ret
static stack_node_t temp
Definition: rpn.c:18
Int cuspTypeX(directedLine *v)
Definition: partitionX.cc:89