ReactOS  0.4.10-dev-358-g66981e1
directedLine.cc File Reference
#include <math.h>
#include "quicksort.h"
#include "polyDBG.h"
Include dependency graph for directedLine.cc:

Go to the source code of this file.

Functions

static Int myequal (Real a[2], Real b[2])
 
Int compV2InY (Real A[2], Real B[2])
 
Int compV2InX (Real A[2], Real B[2])
 
static Int compInY2 (directedLine *v1, directedLine *v2)
 
directedLinereadAllPolygons (char *filename)
 

Function Documentation

static Int compInY2 ( directedLine v1,
directedLine v2 
)
static

Definition at line 447 of file directedLine.cc.

Referenced by directedLine::sortAllPolygons().

448 {
449  return v1->compInY(v2);
450 }
Int compInY(directedLine *nl)
Int compV2InX ( Real  A[2],
Real  B[2] 
)

Definition at line 407 of file directedLine.cc.

Referenced by DBG_is_U_monotone(), findDiagonal_singleCuspX(), is_u_maximal(), is_u_minimal(), isCuspX(), monoTriangulationOpt(), monoTriangulationRecGenOpt(), and sampleMonoPoly().

408 {
409  if(A[0] < B[0]) return -1;
410  if(A[0] == B[0] && A[1] < B[1]) return -1;
411  if(A[0] == B[0] && A[1] == B[1]) return 0;
412  return 1;
413 }
#define B(row, col)
Definition: m_matrix.c:146
Definition: ttei1.cpp:12
Int compV2InY ( Real  A[2],
Real  B[2] 
)

Definition at line 399 of file directedLine.cc.

Referenced by compChainHeadInY(), findTopAndBot(), monoPolyPart(), monoTriangulation(), monoTriangulationOpt(), monoTriangulationRec(), monoTriangulationRecGen(), sampleMonoPoly(), Slicer::slice_new(), and triangulateConvexPoly().

400 {
401  if(A[1] < B[1]) return -1;
402  if(A[1] == B[1] && A[0] < B[0]) return -1;
403  if(A[1] == B[1] && A[0] == B[0]) return 0;
404  return 1;
405 }
#define B(row, col)
Definition: m_matrix.c:146
Definition: ttei1.cpp:12
static Int myequal ( Real  a[2],
Real  b[2] 
)
static

Definition at line 106 of file directedLine.cc.

Referenced by directedLine::deleteDegenerateLines().

107 {
108  /*
109  if(a[0]==b[0] && a[1] == b[1])
110  return 1;
111  else
112  return 0;
113  */
114 
115 
116  if(fabs(a[0]-b[0]) < 0.00001 &&
117  fabs(a[1]-b[1]) < 0.00001)
118  return 1;
119  else
120  return 0;
121 
122 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
_Check_return_ _CRT_JIT_INTRINSIC double __cdecl fabs(_In_ double x)
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
directedLine* readAllPolygons ( char filename)

Definition at line 792 of file directedLine.cc.

793 {
794  Int i,j;
795  FILE* fp = fopen(filename, "r");
796  Int nPolygons;
797  int result;
798 
799  assert(fp);
800  result = fscanf(fp, "%i", &nPolygons);
801  assert(result != EOF);
802  directedLine *ret = NULL;
803 
804  for(i=0; i<nPolygons; i++)
805  {
806  Int nEdges;
807  result = fscanf(fp, "%i", &nEdges);
808  assert(result != EOF);
809  Real vert[2][2] = { { 0 } };
810  Real VV[2][2];
811  /*the first two vertices*/
812  result = fscanf(fp, "%f", &(vert[0][0]));
813  assert(result != EOF);
814  result = fscanf(fp, "%f", &(vert[0][1]));
815  assert(result != EOF);
816  result = fscanf(fp, "%f", &(vert[1][0]));
817  assert(result != EOF);
818  result = fscanf(fp, "%f", &(vert[1][1]));
819  assert(result != EOF);
820  VV[1][0] = vert[0][0];
821  VV[1][1] = vert[0][1];
822  sampledLine *sLine = new sampledLine(2, vert);
823  directedLine *thisPoly = new directedLine(INCREASING, sLine);
824 thisPoly->rootLinkSet(NULL);
825 
826  directedLine *dLine;
827  for(j=2; j<nEdges; j++)
828  {
829  vert[0][0]=vert[1][0];
830  vert[0][1]=vert[1][1];
831  result = fscanf(fp, "%f", &(vert[1][0]));
832  assert(result != EOF);
833  result = fscanf(fp, "%f", &(vert[1][1]));
834  assert(result != EOF);
835  sLine = new sampledLine(2,vert);
836  dLine = new directedLine(INCREASING, sLine);
837 dLine->rootLinkSet(thisPoly);
838  thisPoly->insert(dLine);
839  }
840 
841  VV[0][0]=vert[1][0];
842  VV[0][1]=vert[1][1];
843  sLine = new sampledLine(2,VV);
844  dLine = new directedLine(INCREASING, sLine);
845 dLine->rootLinkSet(thisPoly);
846  thisPoly->insert(dLine);
847 
848  ret = thisPoly->insertPolygon(ret);
849  }
850  fclose(fp);
851  return ret;
852 }
GLenum GLclampf GLint GLenum GLuint GLenum GLenum GLsizei GLenum const GLvoid GLfloat GLfloat GLfloat GLfloat GLclampd GLint 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 GLboolean GLboolean GLboolean GLint GLenum GLsizei const GLvoid GLenum GLint GLenum GLint GLint GLsizei GLint GLenum GLint GLint GLint GLint GLsizei GLenum GLsizei const GLuint GLboolean GLenum GLenum GLint GLsizei GLenum GLsizei GLenum const GLvoid GLboolean const GLboolean GLenum const GLdouble const GLfloat const GLdouble const GLfloat GLenum GLint GLint GLint GLint GLint GLint j
Definition: glfuncs.h:98
void rootLinkSet(directedLine *r)
Definition: directedLine.h:155
_Check_return_ _CRTIMP int __cdecl fscanf(_Inout_ FILE *_File, _In_z_ _Scanf_format_string_ const char *_Format,...)
#define assert(x)
Definition: debug.h:53
const char * filename
Definition: ioapi.h:135
GLenum GLclampf GLint i
Definition: glfuncs.h:14
directedLine * insertPolygon(directedLine *newpolygon)
smooth NULL
Definition: ftsmooth.c:416
int ret
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
float Real
Definition: definitions.h:36
#define EOF
Definition: stdio.h:24
GLuint64EXT * result
Definition: glext.h:11304
void insert(directedLine *nl)
int Int
Definition: definitions.h:37