~ubuntu-branches/ubuntu/quantal/mesa-glw/quantal

« back to all changes in this revision

Viewing changes to src/glu/sgi/libnurbs/nurbtess/partitionY.h

  • Committer: Bazaar Package Importer
  • Author(s): Morten Kjeldgaard
  • Date: 2008-05-06 16:19:15 UTC
  • Revision ID: james.westby@ubuntu.com-20080506161915-uynz7nftmfixu6bq
Tags: upstream-7.0.3
ImportĀ upstreamĀ versionĀ 7.0.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
** License Applicability. Except to the extent portions of this file are
 
3
** made subject to an alternative license as permitted in the SGI Free
 
4
** Software License B, Version 1.1 (the "License"), the contents of this
 
5
** file are subject only to the provisions of the License. You may not use
 
6
** this file except in compliance with the License. You may obtain a copy
 
7
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
 
8
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
 
9
** 
 
10
** http://oss.sgi.com/projects/FreeB
 
11
** 
 
12
** Note that, as provided in the License, the Software is distributed on an
 
13
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
 
14
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
 
15
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
 
16
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
 
17
** 
 
18
** Original Code. The Original Code is: OpenGL Sample Implementation,
 
19
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
 
20
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
 
21
** Copyright in any portions created by third parties is as indicated
 
22
** elsewhere herein. All Rights Reserved.
 
23
** 
 
24
** Additional Notice Provisions: The application programming interfaces
 
25
** established by SGI in conjunction with the Original Code are The
 
26
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
 
27
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
 
28
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
 
29
** Window System(R) (Version 1.3), released October 19, 1998. This software
 
30
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
 
31
** published by SGI, but has not been independently verified as being
 
32
** compliant with the OpenGL(R) version 1.2.1 Specification.
 
33
**
 
34
** $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
 
35
*/
 
36
/*
 
37
 *partitionY.h:
 
38
 *partition a polygon into a Y-monotone polygon:
 
39
 * A polygon is Y-monotone if the boundary can be split into two polygon chains
 
40
 *A and B such that each chain is Y-monotonic that is the intersection of any
 
41
 *horizontal line intersects each chain has at most one connected componenets
 
42
 * (empty, single point or a single line).
 
43
 * 
 
44
 * A vertex is a cusp if both its ajacent vertices are either at or above v, 
 
45
 *or both at or below v. In addition, at least one of the ajacent verteces is
 
46
 *strictly below or above v. 
 
47
 * A vertex is a relex vertex if the internals angle is strictly greater than 
 
48
 *180. In other words, if the the signed area is negative:
 
49
 *(x1, y1), (x2, y2), (x3, y3) are the three vertices along a polygon, the 
 
50
 *order is such that left hand side is inside the polygon. Then (x2,y2) is
 
51
 *reflex if: 
 
52
 *  (x2-x1, y2-y1) cross (x3-x1, y3-y1) <0.
 
53
 *A vertex is an interior cusp if it is a cusp and a reflex.
 
54
 *A vertex is an exterior cusp if it is a cusp but not a reflex.
 
55
 *
 
56
 * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/partitionY.h,v 1.1 2001/03/17 00:25:41 brianp Exp $
 
57
 */
 
58
 
 
59
#ifndef _PARTITIONY_H
 
60
#define _PARTITIONY_H
 
61
 
 
62
#include "directedLine.h"
 
63
 
 
64
/*whether an edge is below a vertex*/
 
65
Int isBelow(directedLine *v, directedLine *e);
 
66
 
 
67
/*whether an edge is above a vertex*/
 
68
Int isAbove(directedLine *v, directedLine *e);
 
69
 
 
70
/*not-cusp,
 
71
 *inerior cusp
 
72
 *exterior cusp
 
73
 */
 
74
Int cuspType(directedLine *v);
 
75
 
 
76
/*used in trapezoidalization*/
 
77
typedef struct sweepRange{
 
78
  directedLine *left;
 
79
  Int leftType; /*either a vertex (leftType=0) or an edge (leftType =1) */
 
80
  directedLine *right;
 
81
  Int rightType; /*either a vertex (rightType=0) or an edge (rightType =1) */  
 
82
} sweepRange;
 
83
 
 
84
sweepRange* sweepRangeMake(directedLine* left, Int leftType,
 
85
                           directedLine* right, Int rightType);
 
86
 
 
87
void sweepRangeDelete(sweepRange* range);
 
88
Int sweepRangeEqual(sweepRange* sr1, sweepRange* sr2);
 
89
 
 
90
/*given a set of simple polygons where the interior 
 
91
 *is decided by left-hand principle,
 
92
 *return a range (sight) for each vertex. This is called
 
93
 *Trapezoidalization.
 
94
 */
 
95
void sweepY(Int nVertices, directedLine **sortedVerteces, sweepRange** ret_ranges);
 
96
 
 
97
 
 
98
directedLine* partitionY(directedLine *polygons, sampledLine **retSampledLines);
 
99
 
 
100
void findDiagonals(Int total_num_edges, directedLine** sortedVertices, sweepRange** ranges, Int& num_diagonals, directedLine** diagonal_vertices);
 
101
 
 
102
directedLine** DBGfindDiagonals(directedLine *polygons, Int& num_diagonals);
 
103
 
 
104
#endif