ReactOS 0.4.15-dev-7961-gdcf9eb0
directedLine.h
Go to the documentation of this file.
1/*
2 * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
3 * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice including the dates of first publication and
13 * either this permission notice or a reference to
14 * http://oss.sgi.com/projects/FreeB/
15 * shall be included in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
22 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * SOFTWARE.
24 *
25 * Except as contained in this notice, the name of Silicon Graphics, Inc.
26 * shall not be used in advertising or otherwise to promote the sale, use or
27 * other dealings in this Software without prior written authorization from
28 * Silicon Graphics, Inc.
29 */
30/*
31*/
32
33#ifndef _DIRECTEDLINE_H
34#define _DIRECTEDLINE_H
35
36//#include "definitions.h"
37#include "sampledLine.h"
38
40
42 short direction; /*INCREASING or DECREASING*/
44 directedLine* next; /*double linked list*/
45 directedLine* prev; /*double linked list*/
46
47 /*in case we need a list of polygons each
48 *consisting of a double linked list
49 */
51
52 /*optimization make cutoff polygon faster*/
53/* directedLine* prevPolygon;*/
54
55 Int rootBit; /*1 if this is a root of the polygon, set by setRootBit*/
56 /*and reset by resetRootBit()*/
57
58 directedLine* rootLink; /*fast root-finding*/
59
60
61
62public:
63 directedLine(short dir, sampledLine* sl);
66
67 void init(short dir, sampledLine* sl);
68
69 Real* head(); /*points[0] if INCREASING, points[n-1] otherwise*/
70 Real* tail(); /*points[n-1] if INCREASING, points[0] otherwise*/
71 Real* getVertex(Int i); /*points[i] if INCREASING, points[n-1-i] otherwise*/
77
78 short getDirection(){return direction;}
79 void putDirection(short dir) {direction = dir;}
82
83 /*insert a new line between prev and this*/
84 void insert(directedLine* nl);
85
86 /*delete all the polygons following the link: nextPolygon.
87 *notice that sampledLine is not deleted. The caller is
88 *responsible for that
89 */
90 void deletePolygonList();
92
93 void deleteSinglePolygonWithSline(); //also delete sanmpled line
94 void deletePolygonListWithSline(); //also delete sanmpled line
95
96 void deleteSingleLine(directedLine* dline);
100
101 /*check to see if the list forms a closed polygon
102 *return 1 if yes
103 */
104 short isPolygon();
105
108
109 /*return an array of pointers.
110 *the
111 */
113
114 Int numEdges();
117
118 /*check if the head of this edge is connected to
119 *the tail of the prev
120 */
121 short isConnected();
122
123 Real polyArea();
124
125 void printSingle();
126 void printList();
127 void printAllPolygons();
128 void writeAllPolygons(char* filename);
129
130
131 /*insert a polygon: using nextPolygon*/
134
136 directedLine** toArrayAllPolygons(Int& total_num_edges);
137
139 directedLine** ret_p1,
140 directedLine** ret_p2,
141 sampledLine** generatedLine, directedLine* list);
142
143 /*generate two slines
144 */
146 directedLine** ret_p1,
147 directedLine** ret_p2,
149
151 void setRootBit() {rootBit = 1;}
152 void resetRootBit() {rootBit = 0;}
154
157
158 //the chain from begin to end is deleted (the space is deallocated)
159 //and a new edge(which connectes the head of begin and the tail of end)
160 // is inserted. The new polygon is returned.
161 //notice that "this" is arbitrary
163};
164
166
167extern Int compV2InY(Real A[2], Real B[2]);
168extern Int compV2InX(Real A[2], Real B[2]);
169
170#endif
171
unsigned int dir
Definition: maze.c:112
Definition: ehthrow.cxx:93
Definition: ehthrow.cxx:54
Int get_npoints()
Definition: directedLine.h:72
void putDirection(short dir)
Definition: directedLine.h:79
short isConnected()
short direction
Definition: directedLine.h:42
directedLine * getPrev()
Definition: directedLine.h:73
directedLine * cutoffPolygon(directedLine *p)
directedLine * prev
Definition: directedLine.h:45
void rootLinkSet(directedLine *r)
Definition: directedLine.h:155
directedLine * deleteChain(directedLine *begin, directedLine *end)
Definition: directedLine.cc:53
sampledLine * sline
Definition: directedLine.h:43
directedLine * deleteDegenerateLines()
void resetRootBit()
Definition: directedLine.h:152
void deleteSinglePolygon()
directedLine ** sortAllPolygons()
void writeAllPolygons(char *filename)
directedLine * nextPolygon
Definition: directedLine.h:50
void connectDiagonal(directedLine *v1, directedLine *v2, directedLine **ret_p1, directedLine **ret_p2, sampledLine **generatedLine, directedLine *list)
directedLine * cutIntersectionAllPoly(int &cutOccur)
void deletePolygonList()
directedLine * insertPolygon(directedLine *newpolygon)
directedLine * findRoot()
void deleteSingleLine(directedLine *dline)
Definition: directedLine.cc:88
void deleteSinglePolygonWithSline()
Real * getVertex(Int i)
void putPrev(directedLine *p)
Definition: directedLine.h:80
directedLine * next
Definition: directedLine.h:44
Int compInX(directedLine *nl)
directedLine * rootLinkFindRoot()
void putNext(directedLine *p)
Definition: directedLine.h:81
Int samePolygon(directedLine *v1, directedLine *v2)
Int compInY(directedLine *nl)
sampledLine * getSampledLine()
Definition: directedLine.h:76
void printSingle()
void connectDiagonal_2slines(directedLine *v1, directedLine *v2, directedLine **ret_p1, directedLine **ret_p2, directedLine *list)
directedLine * getNext()
Definition: directedLine.h:74
Real * head()
directedLine ** toArrayAllPolygons(Int &total_num_edges)
directedLine * deleteDegenerateLinesAllPolygons()
void setRootBit()
Definition: directedLine.h:151
void deletePolygonListWithSline()
Int toArraySinglePolygon(directedLine **array, Int index)
void printAllPolygons()
short isPolygon()
directedLine * rootLink
Definition: directedLine.h:58
Real * tail()
void printList()
short getDirection()
Definition: directedLine.h:78
directedLine * getNextPolygon()
Definition: directedLine.h:75
Int numEdgesAllPolygons()
Definition: list.h:37
Int get_npoints()
Definition: sampledLine.h:56
int Int
Definition: definitions.h:37
float Real
Definition: definitions.h:36
Int compV2InY(Real A[2], Real B[2])
directedLine * readAllPolygons(char *filename)
@ INCREASING
Definition: directedLine.h:39
@ DECREASING
Definition: directedLine.h:39
Int compV2InX(Real A[2], Real B[2])
GLuint GLuint end
Definition: gl.h:1545
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint index
Definition: glext.h:6031
GLfloat GLfloat p
Definition: glext.h:8902
GLfloat GLfloat v1
Definition: glext.h:6062
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063
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
const char * filename
Definition: ioapi.h:137
static int init
Definition: wintirpc.c:33
static clock_t begin
Definition: xmllint.c:458
static int insert
Definition: xmllint.c:138