From 3a2e3ab4f75a38e11e28207fe0a486c9e5e9eb4d Mon Sep 17 00:00:00 2001 From: Barak Itkin Date: Sat, 4 Aug 2012 23:26:47 +0300 Subject: [PATCH] Add some standard project files (README, COPYING, INSTALL, etc.) --- COPYING | 40 ++++++++++++++++++++++++++++ INSTALL | 56 +++++++++++++++++++++++++++++++++++++++ LICENSE-Poly2Tri-C.txt | 30 +++++++++++++++++++++ LICENSE-Poly2Tri.txt | 31 ++++++++++++++++++++++ README | 59 ++++++++++++++++++++++++++++++++++++++++++ autogen.sh | 50 ++++++++++++++++++++++++++++++----- 6 files changed, 260 insertions(+), 6 deletions(-) create mode 100644 COPYING create mode 100644 INSTALL create mode 100644 LICENSE-Poly2Tri-C.txt create mode 100644 LICENSE-Poly2Tri.txt create mode 100644 README diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..11f143f --- /dev/null +++ b/COPYING @@ -0,0 +1,40 @@ +The Poly2Tri-C is a three-part library, where all parts are licensed +under the same license - The BSD 3-Clause License (also known as "New +BSD License" or "Modified BSD License"): + + 1. Constrained Delaunay Triangulation - Based on the code of Poly2Tri + (Poly2Tri is licensed under the same license) + 2. Delaunay Refinement - New code implemented in this library + 3. Mesh Rendering - New code implemented in this library + +The first part of the library is a port of the Poly2Tri library from C++ +to C (with GLib). This port can be found inside the poly2tri-c/p2t +directory of this source code distribution. + + Poly2Tri - A 2D constrained Delaunay triangulation library + Homepage: http://code.google.com/p/poly2tri/ + Code License File: LICENSE-Poly2Tri.txt + +The second part of the library is an implementaiton of a Delaunay +Refinement algorithm named "The Terminator" which appears in a paper +written by Jonathan Richard Shewchuk. +The implementation of the algorithm in C was done by Barak Itkin, and it +can be found inside the poly2tri-c/refine directory of this source code +distribution. + + Algorithm Author: + Jonathan Richard Shewchuk + http://www.cs.berkeley.edu/~jrs/ + + Algorithm Paper: + Delaunay Refinement Algorithms for Triangular Mesh Generation + http://www.cs.berkeley.edu/~jrs/papers/2dj.pdf + + Code License File: LICENSE-Poly2Tri-C.txt + +Finally, the third part of the library contains various techniques to +render mesh objects as raster/vector images. This part is 'original' and +is not based on any other reference. This code can be found inside the +poly2tri-c/render directory of this source code distribution. + + Code License File: LICENSE-Poly2Tri-C.txt diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..06ba79b --- /dev/null +++ b/INSTALL @@ -0,0 +1,56 @@ +======================================================================== +=============== Poly2Tri-C Installation Instructions =================== +======================================================================== + +Prerequisites +~~~~~~~~~~~~~ +In order to compile the library you should have at least the following: + + - A working linux-like environment and tools, with the GNU C Compiler + (gcc). + + - On Linux simply install gcc if it's not already installed, the + rest is probably already shipped with your distribution, + + - On Windows you can install MSYS + MinGW from http://mingw.org, + and this should provide you with all the needed tools + + - The development libraries and headers for GLib. You can get them + from http://www.gtk.org. + +Compiling from a source (tarball) distribution +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Once all prerequisites are satisfied, open a shell window and enter +the folder containing this distribution. You can now build this package +like any other GNU package by executing the following steps: + + ./configure + make + make install + +Compiling from a source tree snapshot (a Git checkout) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The steps are pretty similary, only that now you will also need to be +able to generate the configure script. For that you will need to install +the GNU autotools (autoconf, automake, etc.) and the GNU libtool. + +Once all set up, simply run the ./autogen.sh script with the same +arguments you would pass to the ./configure script. Then proceed like +a regular build to make and make install. + +Customizing the build +~~~~~~~~~~~~~~~~~~~~~ +You can customize the build result by supplying the ./configure script +with one or more of the following arguments: + + --enable-debug + Enables generation of debugging information inside the built + binaries. Useful if you wish to debug programs using the library or + the library itself + + --enable-cdt-validation + Forces the library to validate the triangulations it refines to + check that they remain Constrained Delaunay. This adds a massive + overhead and is not to be used by anyone other than people + experimenting with the internal library algorithms! + diff --git a/LICENSE-Poly2Tri-C.txt b/LICENSE-Poly2Tri-C.txt new file mode 100644 index 0000000..097ab24 --- /dev/null +++ b/LICENSE-Poly2Tri-C.txt @@ -0,0 +1,30 @@ +Poly2Tri-C Copyright (c) 2011-2012, Barak Itkin +http://code.google.com/p/poly2tri-c/ + +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 Poly2Tri-C 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. + diff --git a/LICENSE-Poly2Tri.txt b/LICENSE-Poly2Tri.txt new file mode 100644 index 0000000..79fa687 --- /dev/null +++ b/LICENSE-Poly2Tri.txt @@ -0,0 +1,31 @@ + +Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors +http://code.google.com/p/poly2tri/ + +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 Poly2Tri 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. + diff --git a/README b/README new file mode 100644 index 0000000..2905877 --- /dev/null +++ b/README @@ -0,0 +1,59 @@ +======================================================================== +==== Poly2Tri-C: A library for generating, refining and rendering ==== +==== 2-Dimensional Constrained Delaunay Triangulations ==== +======================================================================== + +Quick Start +~~~~~~~~~~~ +In order to compile the library, you need the GLib development files. +Then simply run ./configure, make and make install. More detailed +instructions can be found in the INSTALL file. + +Direct Usage +~~~~~~~~~~~~ +In order to specify the outline points, create a file with the following +format: + +P pt1_x pt1_y +P pt2_x pt2_y +P pt3_x pt3_y +... + +To specify a hole, start the line with H instead of P. All the points +from that line and onward will belong to a hole. Each line begining with +H will create a new hole. To specify a steiner point, start the line +with S. + +A simple invocation would look like this: + + p2tc -i mypoints.pts -o mymesh -s -m [-r N] + +Explanation: + + -i Specifies the input file + -o Specifies the base name for output files + -s Would create an SVG output of the fine mesh as mymesh.svg + -m Would create a PPM (raster) output of the fine mesh as mymesh.ppm + -r N Specifies that at most N points shold be inserted to the mesh in + the refinement step. Invocation without this argument lets the + algorithm run until it converges. + +API Usage +~~~~~~~~~ +The source code for the p2tc program is shipped inside the bin/ +directory. It should get you started very fast. + +Limitations +~~~~~~~~~~~ +Like all software, this library has some limitations: + + - There nustn't be any repetitions of points (it also means that the + first point shouldn't be repeated at the end of the file) + - The outline mustn't be self-intersecting + - All holes must lie inside the main outline and must not intersect in + pairs + - Nearly no input validation is done in order to speed up the + computation. This means you may get strange crashes on incorrect + usage. The most common such crashes are when specifying an input + outline or hole with either the last point repeating the first, or + with less than 3 input points. diff --git a/autogen.sh b/autogen.sh index 065a363..7da217f 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,7 +1,45 @@ -test -n "$srcdir" || srcdir=$(dirname "$0") +#!/bin/sh + +# This is an updated version of the autogen script from BABL +# See http://gegl.org/babl/ for the source code and more information + +# This script does all the magic calls to automake/autoconf and +# tools that are needed to configure a Git checkout. As described in +# the file README, you need a couple of extra tools to run this script +# successfully. +# +# If you are compiling from a released code distribution and not +# directly from the source tree, you don't need these tools or this +# script. Instead, just call ./configure directly. + +# Check for the directory containing the source files - try either the +# 'srcdir' environment variable, the full path to the current directory, +# or finally just settle for the relative path '.' +test -n "$srcdir" || srcdir=`dirname "$0"` test -n "$srcdir" || srcdir=. -( - cd "$srcdir" && - AUTOPOINT='intltoolize --automake --copy' autoreconf -fiv -Wall -) || exit -test -n "$NOCONFIGURE" || "$srcdir/configure" --enable-maintainer-mode "$@" + +# Save the directory in which we started the execution, so that to +# return to it at the end +ORIGDIR=`pwd` + +# Now enter the source directory +cd $srcdir + +# Try to find an autoreconf tool. If none found, show an error message +AUTORECONF=`which autoreconf` +if test -z $AUTORECONF; then + echo "*** No autoreconf found, please intall it ***" + exit 1 +fi + +# Now invoke autoreconf which will invoke all the gnu auto tools in the +# right order. It works on the current directory and that is why we had +# to enter the source directory +$AUTORECONF --force --install --verbose + +# Go back to the original directory +cd $ORIGDIR + +# Now, unless the NOCONFIGURE environment variable is set, run the +# configure script with the parameters passed to this script +test -n "$NOCONFIGURE" || "$srcdir/configure" "$@" -- 2.50.1