ReactOS 0.4.15-dev-7918-g2a2556c
partitionY.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 *partitionY.h:
32 *partition a polygon into a Y-monotone polygon:
33 * A polygon is Y-monotone if the boundary can be split into two polygon chains
34 *A and B such that each chain is Y-monotonic that is the intersection of any
35 *horizontal line intersects each chain has at most one connected componenets
36 * (empty, single point or a single line).
37 *
38 * A vertex is a cusp if both its ajacent vertices are either at or above v,
39 *or both at or below v. In addition, at least one of the ajacent verteces is
40 *strictly below or above v.
41 * A vertex is a relex vertex if the internals angle is strictly greater than
42 *180. In other words, if the signed area is negative:
43 *(x1, y1), (x2, y2), (x3, y3) are the three vertices along a polygon, the
44 *order is such that left hand side is inside the polygon. Then (x2,y2) is
45 *reflex if:
46 * (x2-x1, y2-y1) cross (x3-x1, y3-y1) <0.
47 *A vertex is an interior cusp if it is a cusp and a reflex.
48 *A vertex is an exterior cusp if it is a cusp but not a reflex.
49 *
50 */
51
52#ifndef _PARTITIONY_H
53#define _PARTITIONY_H
54
55#include "directedLine.h"
56
57/*whether an edge is below a vertex*/
59
60/*whether an edge is above a vertex*/
62
63/*not-cusp,
64 *inerior cusp
65 *exterior cusp
66 */
68
69/*used in trapezoidalization*/
70typedef struct sweepRange{
72 Int leftType; /*either a vertex (leftType=0) or an edge (leftType =1) */
74 Int rightType; /*either a vertex (rightType=0) or an edge (rightType =1) */
76
78 directedLine* right, Int rightType);
79
82
83/*given a set of simple polygons where the interior
84 *is decided by left-hand principle,
85 *return a range (sight) for each vertex. This is called
86 *Trapezoidalization.
87 */
88void sweepY(Int nVertices, directedLine **sortedVerteces, sweepRange** ret_ranges);
89
90
91directedLine* partitionY(directedLine *polygons, sampledLine **retSampledLines);
92
93void findDiagonals(Int total_num_edges, directedLine** sortedVertices, sweepRange** ranges, Int& num_diagonals, directedLine** diagonal_vertices);
94
95directedLine** DBGfindDiagonals(directedLine *polygons, Int& num_diagonals);
96
97#endif
int Int
Definition: definitions.h:37
const GLdouble * v
Definition: gl.h:2040
GLdouble GLdouble right
Definition: glext.h:10859
GLenum GLint * range
Definition: glext.h:7539
GLint left
Definition: glext.h:7726
#define e
Definition: ke_i.h:82
void findDiagonals(Int total_num_edges, directedLine **sortedVertices, sweepRange **ranges, Int &num_diagonals, directedLine **diagonal_vertices)
Definition: partitionY.cc:333
sweepRange * sweepRangeMake(directedLine *left, Int leftType, directedLine *right, Int rightType)
Definition: partitionY.cc:150
Int cuspType(directedLine *v)
Definition: partitionY.cc:142
Int isBelow(directedLine *v, directedLine *e)
Definition: partitionY.cc:73
Int sweepRangeEqual(sweepRange *sr1, sweepRange *sr2)
Definition: partitionY.cc:167
Int isAbove(directedLine *v, directedLine *e)
Definition: partitionY.cc:89
directedLine * partitionY(directedLine *polygons, sampledLine **retSampledLines)
Definition: partitionY.cc:447
void sweepRangeDelete(sweepRange *range)
Definition: partitionY.cc:162
void sweepY(Int nVertices, directedLine **sortedVerteces, sweepRange **ret_ranges)
Definition: partitionY.cc:722
directedLine ** DBGfindDiagonals(directedLine *polygons, Int &num_diagonals)
Definition: partitionY.cc:426
Int leftType
Definition: partitionY.h:72
Int rightType
Definition: partitionY.h:74
directedLine * right
Definition: partitionY.h:73
directedLine * left
Definition: partitionY.h:71