Commit 9f50c06e authored by benjamin@webkit.org's avatar benjamin@webkit.org

Remove the WebKit copy of GLU and the file using it

https://bugs.webkit.org/show_bug.cgi?id=114249

Patch by Benjamin Poulain <bpoulain@apple.com> on 2013-04-09
Reviewed by Darin Adler.

Source/ThirdParty: 

* glu/.gitignore: Removed.
* glu/LICENSE.txt: Removed.
* glu/README.webkit: Removed.
* glu/glu.gyp: Removed.
* glu/gluos.h: Removed.
* glu/internal_glu.h: Removed.
* glu/libtess/GNUmakefile: Removed.
* glu/libtess/Imakefile: Removed.
* glu/libtess/README: Removed.
* glu/libtess/alg-outline: Removed.
* glu/libtess/dict-list.h: Removed.
* glu/libtess/dict.c: Removed.
* glu/libtess/dict.h: Removed.
* glu/libtess/geom.c: Removed.
* glu/libtess/geom.h: Removed.
* glu/libtess/memalloc.c: Removed.
* glu/libtess/memalloc.h: Removed.
* glu/libtess/mesh.c: Removed.
* glu/libtess/mesh.h: Removed.
* glu/libtess/normal.c: Removed.
* glu/libtess/normal.h: Removed.
* glu/libtess/priorityq-heap.c: Removed.
* glu/libtess/priorityq-heap.h: Removed.
* glu/libtess/priorityq-sort.h: Removed.
* glu/libtess/priorityq.c: Removed.
* glu/libtess/priorityq.h: Removed.
* glu/libtess/render.c: Removed.
* glu/libtess/render.h: Removed.
* glu/libtess/sweep.c: Removed.
* glu/libtess/sweep.h: Removed.
* glu/libtess/tess.c: Removed.
* glu/libtess/tess.h: Removed.
* glu/libtess/tessmono.c: Removed.
* glu/libtess/tessmono.h: Removed.

Source/WebCore: 

* platform/graphics/gpu/LoopBlinnPathProcessor.cpp: Removed.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148032 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b704b429
2013-04-09 Benjamin Poulain <bpoulain@apple.com>
Remove the WebKit copy of GLU and the file using it
https://bugs.webkit.org/show_bug.cgi?id=114249
Reviewed by Darin Adler.
* glu/.gitignore: Removed.
* glu/LICENSE.txt: Removed.
* glu/README.webkit: Removed.
* glu/glu.gyp: Removed.
* glu/gluos.h: Removed.
* glu/internal_glu.h: Removed.
* glu/libtess/GNUmakefile: Removed.
* glu/libtess/Imakefile: Removed.
* glu/libtess/README: Removed.
* glu/libtess/alg-outline: Removed.
* glu/libtess/dict-list.h: Removed.
* glu/libtess/dict.c: Removed.
* glu/libtess/dict.h: Removed.
* glu/libtess/geom.c: Removed.
* glu/libtess/geom.h: Removed.
* glu/libtess/memalloc.c: Removed.
* glu/libtess/memalloc.h: Removed.
* glu/libtess/mesh.c: Removed.
* glu/libtess/mesh.h: Removed.
* glu/libtess/normal.c: Removed.
* glu/libtess/normal.h: Removed.
* glu/libtess/priorityq-heap.c: Removed.
* glu/libtess/priorityq-heap.h: Removed.
* glu/libtess/priorityq-sort.h: Removed.
* glu/libtess/priorityq.c: Removed.
* glu/libtess/priorityq.h: Removed.
* glu/libtess/render.c: Removed.
* glu/libtess/render.h: Removed.
* glu/libtess/sweep.c: Removed.
* glu/libtess/sweep.h: Removed.
* glu/libtess/tess.c: Removed.
* glu/libtess/tess.h: Removed.
* glu/libtess/tessmono.c: Removed.
* glu/libtess/tessmono.h: Removed.
2013-04-08 Benjamin Poulain <benjamin@webkit.org>
Remove gyp from ThirdParty
......
*.Makefile
*.mk
*.sln
*.vcproj
*.vcxproj*
glu.xcodeproj
SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
Copyright (C) [dates of first publication] Silicon Graphics, Inc. All
Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice including the dates of first publication
and either this permission notice or a reference to HYPERLINK
"http://oss.sgi.com/projects/FreeB/"http://oss.sgi.com/projects/FreeB/
shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL SILICON GRAPHICS, INC. BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Silicon Graphics,
Inc. shall not be used in advertising or otherwise to promote the
sale, use or other dealings in this Software without prior written
authorization from Silicon Graphics, Inc.
This is a nearly verbatim copy of the GLU tessellator source code from
SGI's OpenGL Sample Implementation at
http://oss.sgi.com/projects/ogl-sample/ . Per
http://oss.sgi.com/projects/FreeB/ , the code is covered under the SGI
Free Software License B, version 2.0, a copy of which is in
LICENSE.txt in this directory.
The following changes were made in order to incorporate this code:
- The addition of a simplified gluos.h to eliminate operating system
dependencies. All entry points to the tesselator were prefixed
with internal_ via #defines, to avoid symbol collisions with any
host OS version of GLU.
- The removal of inclusion of GL/glu.h and replacement with an
include of internal_glu.h.
- In tess.c, the obsolete entry points gluBeginPolygon,
gluNextContour and gluEndPolygon in tess.c were #if 0'd out.
Default branches were added to the switch statements in GotoState.
- In memalloc.h, the include of malloc.h was changed to an include
of stdlib.h.
- In normal.c, an unused variable "w" was removed from
__gl_projectPolygon. #if guards were placed around the definition
of the unused Normalize function.
- In priorityq-heap.c, an #include of <limits.h> was added.
- In sweep.c, IsWindingInside() was given a return value to silence a
warning-as-error in release builds.
- In sweep.c, DoneEdgeDict()'s fixedEdges was wrapped in #indef NDEBUG, to
silence a warning-as-error in release builds.
- In priorityq.c, render.c, and others: the construct "if(1)...else" was
replaced with "do{...}while(1)" to silence a warning-as-error in Mac builds.
{
'targets': [{
'target_name': 'libtess',
'type': 'static_library',
'include_dirs': [
'.',
],
'sources': [
'gluos.h',
'internal_glu.h',
'libtess/dict-list.h',
'libtess/dict.c',
'libtess/dict.h',
'libtess/geom.c',
'libtess/geom.h',
'libtess/memalloc.c',
'libtess/memalloc.h',
'libtess/mesh.c',
'libtess/mesh.h',
'libtess/normal.c',
'libtess/normal.h',
'libtess/priorityq-heap.h',
'libtess/priorityq-sort.h',
'libtess/priorityq.c',
'libtess/priorityq.h',
'libtess/render.c',
'libtess/render.h',
'libtess/sweep.c',
'libtess/sweep.h',
'libtess/tess.c',
'libtess/tess.h',
'libtess/tessmono.c',
'libtess/tessmono.h',
],
}],
}
/*
* Copyright 2010, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef GLUOS_H_
#define GLUOS_H_
// This header provides the minimal definitions needed to compile the
// GLU tessellator sources.
#define GLAPIENTRY
typedef unsigned char GLboolean;
typedef double GLdouble;
typedef unsigned int GLenum;
typedef float GLfloat;
typedef void GLvoid;
#define gluNewTess internal_gluNewTess
#define gluDeleteTess internal_gluDeleteTess
#define gluTessProperty internal_gluTessProperty
#define gluGetTessProperty internal_gluGetTessProperty
#define gluTessNormal internal_gluTessNormal
#define gluTessCallback internal_gluTessCallback
#define gluTessVertex internal_gluTessVertex
#define gluTessBeginPolygon internal_gluTessBeginPolygon
#define gluTessBeginContour internal_gluTessBeginContour
#define gluTessEndContour internal_gluTessEndContour
#define gluTessEndPolygon internal_gluTessEndPolygon
#undef MIN
#undef MAX
#endif // GLUOS_H_
/*
* Copyright 2010, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// This header is a skeleton substitute for GL/glu.h which contains
// only the definitions, constants and function declarations necessary
// to compile the GLU tessellator.
#ifndef INTERNAL_GLU_H_
#define INTERNAL_GLU_H_
#include "gluos.h"
/* Primitives */
#define GL_LINE_LOOP 0x0002
#define GL_TRIANGLES 0x0004
#define GL_TRIANGLE_STRIP 0x0005
#define GL_TRIANGLE_FAN 0x0006
/* ErrorCode */
#define GLU_INVALID_ENUM 100900
#define GLU_INVALID_VALUE 100901
#define GLU_OUT_OF_MEMORY 100902
/* TessCallback */
#define GLU_TESS_BEGIN 100100
#define GLU_BEGIN 100100
#define GLU_TESS_VERTEX 100101
#define GLU_VERTEX 100101
#define GLU_TESS_END 100102
#define GLU_END 100102
#define GLU_TESS_ERROR 100103
#define GLU_TESS_EDGE_FLAG 100104
#define GLU_EDGE_FLAG 100104
#define GLU_TESS_COMBINE 100105
#define GLU_TESS_BEGIN_DATA 100106
#define GLU_TESS_VERTEX_DATA 100107
#define GLU_TESS_END_DATA 100108
#define GLU_TESS_ERROR_DATA 100109
#define GLU_TESS_EDGE_FLAG_DATA 100110
#define GLU_TESS_COMBINE_DATA 100111
/* TessContour */
#define GLU_CW 100120
#define GLU_CCW 100121
#define GLU_INTERIOR 100122
#define GLU_EXTERIOR 100123
#define GLU_UNKNOWN 100124
/* TessProperty */
#define GLU_TESS_WINDING_RULE 100140
#define GLU_TESS_BOUNDARY_ONLY 100141
#define GLU_TESS_TOLERANCE 100142
/* TessError */
#define GLU_TESS_ERROR1 100151
#define GLU_TESS_ERROR2 100152
#define GLU_TESS_ERROR3 100153
#define GLU_TESS_ERROR4 100154
#define GLU_TESS_ERROR5 100155
#define GLU_TESS_ERROR6 100156
#define GLU_TESS_ERROR7 100157
#define GLU_TESS_ERROR8 100158
#define GLU_TESS_MISSING_BEGIN_POLYGON 100151
#define GLU_TESS_MISSING_BEGIN_CONTOUR 100152
#define GLU_TESS_MISSING_END_POLYGON 100153
#define GLU_TESS_MISSING_END_CONTOUR 100154
#define GLU_TESS_COORD_TOO_LARGE 100155
#define GLU_TESS_NEED_COMBINE_CALLBACK 100156
/* TessWinding */
#define GLU_TESS_WINDING_ODD 100130
#define GLU_TESS_WINDING_NONZERO 100131
#define GLU_TESS_WINDING_POSITIVE 100132
#define GLU_TESS_WINDING_NEGATIVE 100133
#define GLU_TESS_WINDING_ABS_GEQ_TWO 100134
#define GLU_TESS_MAX_COORD 1.0e150
typedef struct GLUtesselator GLUtesselator;
#ifdef __cplusplus
extern "C" {
#endif
extern GLUtesselator * GLAPIENTRY internal_gluNewTess(void);
extern void GLAPIENTRY internal_gluDeleteTess(GLUtesselator *tess);
extern void GLAPIENTRY internal_gluTessProperty(GLUtesselator *tess,
GLenum which,
GLdouble value);
extern void GLAPIENTRY internal_gluGetTessProperty(GLUtesselator *tess,
GLenum which,
GLdouble *value);
extern void GLAPIENTRY internal_gluTessNormal(GLUtesselator *tess,
GLdouble x,
GLdouble y,
GLdouble z);
extern void GLAPIENTRY internal_gluTessCallback(GLUtesselator *tess,
GLenum which,
void (GLAPIENTRY *fn)());
extern void GLAPIENTRY internal_gluTessVertex(GLUtesselator *tess,
GLdouble coords[3],
void *data);
extern void GLAPIENTRY internal_gluTessBeginPolygon(GLUtesselator *tess,
void *data);
extern void GLAPIENTRY internal_gluTessBeginContour(GLUtesselator *tess);
extern void GLAPIENTRY internal_gluTessEndContour(GLUtesselator *tess);
extern void GLAPIENTRY internal_gluTessEndPolygon(GLUtesselator *tess);
#ifdef __cplusplus
}
#endif
#endif // INTERNAL_GLU_H_
#!gmake
#
# License Applicability. Except to the extent portions of this file are
# made subject to an alternative license as permitted in the SGI Free
# Software License B, Version 1.1 (the "License"), the contents of this
# file are subject only to the provisions of the License. You may not use
# this file except in compliance with the License. You may obtain a copy
# of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
# Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
#
# http://oss.sgi.com/projects/FreeB
#
# Note that, as provided in the License, the Software is distributed on an
# "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
# DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
# CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
# PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
#
# Original Code. The Original Code is: OpenGL Sample Implementation,
# Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
# Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
# Copyright in any portions created by third parties is as indicated
# elsewhere herein. All Rights Reserved.
#
# Additional Notice Provisions: The application programming interfaces
# established by SGI in conjunction with the Original Code are The
# OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
# April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
# 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
# Window System(R) (Version 1.3), released October 19, 1998. This software
# was created using the OpenGL(R) version 1.2.1 Sample Implementation
# published by SGI, but has not been independently verified as being
# compliant with the OpenGL(R) version 1.2.1 Specification.
#
# $Date$ $Revision$
# $Header: //depot/main/gfx/lib/glu/libtess/GNUmakefile#9 $
OBJECT_STYLE = N32
include $(ROOT)/usr/include/make/commondefs
TARGET = libtess.a
TARGETS = $(TARGET)
LCINCS = -I../include
# Compilation flags:
#
# -DNDEBUG is for the production code; it removes all assertion checks
# (note that <assert.h> looks at this symbol).
#
# -DNO_MALLOPT uses regular malloc instead of the mallopt() version.
# ***** Unless you use this flag, you must use "-lmalloc" to link
# ***** your application!
#
# -DMEMORY_DEBUG turns on the M_DEBUG option of mallopt; this can
# increase the running time a LOT.
#
# -DGLU_TESS_API_FLOAT compiles a single-precision version of the library.
#
# -float prevents automatic promotion to double precision; this will produce
# faster code when compiled with -DGLU_TESS_API_FLOAT.
#
# -DNO_BRANCH_CONDITIONS uses & and | instead of && and || on a couple
# of heavily-used tests (VertEq and VertLeq); some compilers can generate
# better code with these (use special instructions to avoid branching).
#
# -DFOR_TRITE_TEST_PROGRAM is *only* for use with the test program called
# "trite". It uses some variables which are defined by the test program,
# so you won't be able to link it with anything else.
HFILES = \
dict.h \
dict-list.h \
geom.h \
memalloc.h \
mesh.h \
normal.h \
priorityq-heap.h \
priorityq-heap.c \
priorityq-sort.h \
priorityq.h \
render.h \
sweep.h \
tess.h \
tessmono.h \
$(NULL)
CFILES = \
dict.c \
geom.c \
memalloc.c \
mesh.c \
normal.c \
priorityq.c \
render.c \
sweep.c \
tess.c \
tessmono.c \
$(NULL)
default libs libs_install install: $(TARGET)
headers headers_install apps:
$(TARGET): $(OBJECTS)
$(AR) crl $@ $(OBJECTS);
include $(COMMONRULES)
XCOMM License Applicability. Except to the extent portions of this file are
XCOMM made subject to an alternative license as permitted in the SGI Free
XCOMM Software License B, Version 1.1 (the "License"), the contents of this
XCOMM file are subject only to the provisions of the License. You may not use
XCOMM this file except in compliance with the License. You may obtain a copy
XCOMM of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
XCOMM Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
XCOMM
XCOMM http://oss.sgi.com/projects/FreeB
XCOMM
XCOMM Note that, as provided in the License, the Software is distributed on an
XCOMM "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
XCOMM DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
XCOMM CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
XCOMM PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
XCOMM
XCOMM Original Code. The Original Code is: OpenGL Sample Implementation,
XCOMM Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
XCOMM Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
XCOMM Copyright in any portions created by third parties is as indicated
XCOMM elsewhere herein. All Rights Reserved.
XCOMM
XCOMM Additional Notice Provisions: The application programming interfaces
XCOMM established by SGI in conjunction with the Original Code are The
XCOMM OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
XCOMM April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
XCOMM 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
XCOMM Window System(R) (Version 1.3), released October 19, 1998. This software
XCOMM was created using the OpenGL(R) version 1.2.1 Sample Implementation
XCOMM published by SGI, but has not been independently verified as being
XCOMM compliant with the OpenGL(R) version 1.2.1 Specification.
XCOMM
#include <Library.tmpl>
OBJS = \
dict.o \
geom.o \
memalloc.o \
mesh.o \
normal.o \
priorityq.o \
render.o \
sweep.o \
tess.o \
tessmono.o
INCLUDES = \
-I../include \
-I$(TOP)/include \
-I$(TOP)/include/GL
DEFINES = \
-DNDEBUG
NormalLibraryObjectRule()
NormalLibraryTarget(tess, $(OBJS))
DependTarget()
CleanTarget()
This diff is collapsed.
/*
** $Header: /cvs/projects/ogl-sample/main/gfx/lib/glu/libtess/alg-outline,v 1.1 2000/04/26 05:53:59 ljp Exp $
*/
This is only a very brief overview. There is quite a bit of
additional documentation in the source code itself.
Goals of robust tesselation
---------------------------
The tesselation algorithm is fundamentally a 2D algorithm. We
initially project all data into a plane; our goal is to robustly
tesselate the projected data. The same topological tesselation is
then applied to the input data.
Topologically, the output should always be a tesselation. If the
input is even slightly non-planar, then some triangles will
necessarily be back-facing when viewed from some angles, but the goal
is to minimize this effect.
The algorithm needs some capability of cleaning up the input data as
well as the numerical errors in its own calculations. One way to do
this is to specify a tolerance as defined above, and clean up the
input and output during the line sweep process. At the very least,
the algorithm must handle coincident vertices, vertices incident to an
edge, and coincident edges.
Phases of the algorithm
-----------------------
1. Find the polygon normal N.
2. Project the vertex data onto a plane. It does not need to be
perpendicular to the normal, eg. we can project onto the plane
perpendicular to the coordinate axis whose dot product with N
is largest.
3. Using a line-sweep algorithm, partition the plane into x-monotone
regions. Any vertical line intersects an x-monotone region in
at most one interval.
4. Triangulate the x-monotone regions.
5. Group the triangles into strips and fans.
Finding the normal vector
-------------------------
A common way to find a polygon normal is to compute the signed area
when the polygon is projected along the three coordinate axes. We
can't do this, since contours can have zero area without being
degenerate (eg. a bowtie).
We fit a plane to the vertex data, ignoring how they are connected
into contours. Ideally this would be a least-squares fit; however for
our purpose the accuracy of the normal is not important. Instead we
find three vertices which are widely separated, and compute the normal
to the triangle they form. The vertices are chosen so that the
triangle has an area at least 1/sqrt(3) times the largest area of any
triangle formed using the input vertices.
The contours do affect the orientation of the normal; after computing
the normal, we check that the sum of the signed contour areas is
non-negative, and reverse the normal if necessary.
Projecting the vertices
-----------------------
We project the vertices onto a plane perpendicular to one of the three
coordinate axes. This helps numerical accuracy by removing a
transformation step between the original input data and the data
processed by the algorithm. The projection also compresses the input
data; the 2D distance between vertices after projection may be smaller
than the original 2D distance. However by choosing the coordinate
axis whose dot product with the normal is greatest, the compression
factor is at most 1/sqrt(3).
Even though the *accuracy* of the normal is not that important (since
we are projecting perpendicular to a coordinate axis anyway), the
*robustness* of the computation is important. For example, if there
are many vertices which lie almost along a line, and one vertex V
which is well-separated from the line, then our normal computation
should involve V otherwise the results will be garbage.
The advantage of projecting perpendicular to the polygon normal is
that computed intersection points will be as close as possible to
their ideal locations. To get this behavior, define TRUE_PROJECT.
The Line Sweep
--------------
There are three data structures: the mesh, the event queue, and the
edge dictionary.
The mesh is a "quad-edge" data structure which records the topology of
the current decomposition; for details see the include file "mesh.h".
The event queue simply holds all vertices (both original and computed
ones), organized so that we can quickly extract the vertex with the
minimum x-coord (and among those, the one with the minimum y-coord).
The edge dictionary describes the current intersection of the sweep
line with the regions of the polygon. This is just an ordering of the