ReactOS 0.4.15-dev-7961-gdcf9eb0
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

◆ compInY2()

static Int compInY2 ( directedLine v1,
directedLine v2 
)
static

Definition at line 447 of file directedLine.cc.

448{
449 return v1->compInY(v2);
450}
GLfloat GLfloat v1
Definition: glext.h:6062
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063

Referenced by directedLine::sortAllPolygons().

◆ compV2InX()

Int compV2InX ( Real  A[2],
Real  B[2] 
)

Definition at line 407 of file directedLine.cc.

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}
Definition: ehthrow.cxx:93
Definition: ehthrow.cxx:54

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

◆ compV2InY()

Int compV2InY ( Real  A[2],
Real  B[2] 
)

Definition at line 399 of file directedLine.cc.

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}

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

◆ myequal()

static Int myequal ( Real  a[2],
Real  b[2] 
)
static

Definition at line 106 of file directedLine.cc.

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
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
_Check_return_ _CRT_JIT_INTRINSIC double __cdecl fabs(_In_ double x)
Definition: fabs.c:17

Referenced by directedLine::deleteDegenerateLines().

◆ readAllPolygons()

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);
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);
824thisPoly->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);
837dLine->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);
845dLine->rootLinkSet(thisPoly);
846 thisPoly->insert(dLine);
847
848 ret = thisPoly->insertPolygon(ret);
849 }
850 fclose(fp);
851 return ret;
852}
void rootLinkSet(directedLine *r)
Definition: directedLine.h:155
directedLine * insertPolygon(directedLine *newpolygon)
void insert(directedLine *nl)
int Int
Definition: definitions.h:37
float Real
Definition: definitions.h:36
@ INCREASING
Definition: directedLine.h:39
#define NULL
Definition: types.h:112
#define assert(x)
Definition: debug.h:53
GLuint64EXT * result
Definition: glext.h:11304
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 const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define EOF
Definition: stdio.h:24
_Check_return_ _CRTIMP int __cdecl fscanf(_Inout_ FILE *_File, _In_z_ _Scanf_format_string_ const char *_Format,...)
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
const char * filename
Definition: ioapi.h:137
int ret