├── .gitignore ├── AUTHORS ├── COPYING ├── Makefile.am ├── NEWS ├── README ├── README.md ├── RELEASE ├── THANKS ├── TODO ├── acinclude.m4 ├── autogen.sh ├── configure.in ├── debian ├── Makefile.am ├── changelog.sh ├── compat ├── control ├── copyright ├── libgts-snapshot-dev.install ├── libgts-snapshot-doc.docs ├── libgts-snapshot.install ├── libgts-snapshot.symbols └── rules ├── doc ├── Makefile.am ├── gts-docs.sgml ├── gts-sections.txt ├── isocube.fig └── manpages │ ├── Makefile.am │ ├── delaunay.1 │ ├── gts-config.1 │ ├── gts2dxf.1 │ ├── gts2oogl.1 │ ├── gts2stl.1 │ ├── gtscheck.1 │ ├── gtscompare.1 │ ├── gtstemplate.1 │ ├── happrox.1 │ ├── stl2gts.1 │ └── transform.1 ├── examples ├── Makefile.am ├── cartesian.c ├── cleanup.c ├── coarsen.c ├── delaunay.c ├── gtstoc.c ├── happrox.c ├── iso.c ├── merge.c ├── oocs.c ├── optimize.c ├── partition.c ├── refine.c ├── revolution.c ├── set.c ├── setobj.c ├── smooth.c ├── sphere.c ├── split.c ├── stripe.c ├── transform.c ├── traverse.c └── volume.c ├── gts.pc.in ├── rpm └── gts.spec ├── src ├── Makefile.am ├── NOTES ├── bbtree.c ├── boolean.c ├── cdt.c ├── cexcept.h ├── config.h.win32 ├── container.c ├── curvature.c ├── edge.c ├── eheap.c ├── exception.c ├── face.c ├── fifo.c ├── graph.c ├── gts-config.in ├── gts-private.h ├── gts.h ├── gts.m4 ├── heap.c ├── hsurface.c ├── iso.c ├── isotetra.c ├── kdtree.c ├── leak.sh ├── makefile.msc ├── matrix.c ├── misc.c ├── named.c ├── object.c ├── oocs.c ├── partition.c ├── pgraph.c ├── point.c ├── predicates.c ├── predicates.h ├── predicates_init.c ├── psurface.c ├── refine.c ├── rounding.h ├── segment.c ├── split.c ├── stripe.c ├── surface.c ├── template.c ├── triangle.c ├── tribox3.c ├── valgrind.supp ├── vertex.c └── vopt.c ├── test ├── Makefile.am ├── boolean │ ├── Makefile.am │ ├── boole.c │ ├── cases │ │ ├── tt.cas │ │ └── tt.py │ ├── cubes.c │ ├── set.c │ ├── surfaces │ │ ├── 1.gts │ │ ├── 2.gts │ │ ├── a10.gts │ │ ├── a23.gts │ │ ├── a24.gts │ │ ├── a25.gts │ │ ├── a8.gts │ │ ├── a9.gts │ │ ├── b10.gts │ │ ├── b23.gts │ │ ├── b24.gts │ │ ├── b25.gts │ │ ├── b8.gts │ │ ├── b9.gts │ │ ├── cube │ │ ├── cube1 │ │ ├── cube10 │ │ ├── cube2 │ │ ├── cube4 │ │ ├── cube5 │ │ ├── cube6 │ │ ├── cube7 │ │ ├── cube8 │ │ ├── cube9 │ │ ├── cutter │ │ ├── gts-crash.gts │ │ ├── gts-crash1.gts │ │ ├── horse4.gts │ │ ├── horse5.gts │ │ ├── horse6.gts │ │ ├── loc1 │ │ ├── loc2 │ │ ├── p1 │ │ ├── p2 │ │ ├── sphere.gts │ │ ├── sponge │ │ ├── t1 │ │ ├── t10 │ │ ├── t11 │ │ ├── t12 │ │ ├── t13 │ │ ├── t14 │ │ ├── t15 │ │ ├── t16 │ │ ├── t17 │ │ ├── t18 │ │ ├── t19 │ │ ├── t2 │ │ ├── t20 │ │ ├── t21 │ │ ├── t22 │ │ ├── t23 │ │ ├── t24 │ │ ├── t25 │ │ ├── t26 │ │ ├── t27 │ │ ├── t28 │ │ ├── t29 │ │ ├── t3 │ │ ├── t30 │ │ ├── t31 │ │ ├── t32 │ │ ├── t4 │ │ ├── t5 │ │ ├── t6 │ │ ├── t7 │ │ └── t9 │ ├── test.sh.in │ └── tests ├── clipping │ ├── Makefile.am │ ├── c1 │ ├── c10 │ ├── c2 │ ├── c3 │ ├── c4 │ ├── c5 │ ├── c6 │ ├── c7 │ ├── c8 │ ├── c9 │ ├── clipping.c │ ├── clipping.sh │ ├── clipping_c1_c2.sh │ ├── clipping_c1_c3.sh │ ├── clipping_c1_c4.sh │ ├── clipping_c1_c5.sh │ ├── clipping_c1_c6.sh │ ├── clipping_c1_c7.sh │ ├── clipping_c1_c8.sh │ ├── clipping_c1_c9.sh │ ├── clipping_l1_l2.sh │ ├── clipping_l1_l3.sh │ ├── clipping_l1_l4.sh │ ├── clipping_l1_l5.sh │ ├── l1 │ ├── l2 │ ├── l3 │ ├── l4 │ └── l5 ├── coarsen │ ├── Makefile.am │ ├── c1.c │ ├── c2.c │ ├── c3.c │ ├── cartesian.c │ ├── double_prism.c │ ├── flat.sh │ └── flat1.sh └── delaunay │ ├── Makefile.am │ ├── c1.c │ ├── cartesian.c │ ├── cartesian.sh │ ├── cartesian_speed.sh │ ├── random.c │ ├── random_speed.sh │ ├── squarehole.gts │ ├── too_close.gts │ ├── too_close.sh │ ├── two_segments.gts │ └── two_segments.sh └── tools ├── Makefile.am ├── gts2dxf.c ├── gts2obj.c ├── gts2oogl.c ├── gts2stl.c ├── gtscheck.c ├── gtscompare.c ├── gtstemplate ├── makefile.msc └── stl2gts.c /.gitignore: -------------------------------------------------------------------------------- 1 | # http://www.gnu.org/software/automake 2 | 3 | Makefile.in 4 | 5 | # http://www.gnu.org/software/autoconf 6 | 7 | /autom4te.cache 8 | /aclocal.m4 9 | /compile 10 | /configure 11 | /depcomp 12 | /install-sh 13 | /missing 14 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Original Authors 2 | ---------------- 3 | Stéphane Popinet 4 | 5 | Contributors 6 | ------------ 7 | Marcelo E. Magallon, Ruben Molina: Debian packages. 8 | Jonathan R. Shewchuk: robust geometric predicates. 9 | Ray Jones: discrete differential operators. 10 | Gert Wollny: marching tetrahedra. 11 | Jerome Benoit: surface tesselation. 12 | Wagner Toledo Correa: triangle strips. 13 | Marcelo E. Magallon: Debian packages. 14 | Wayne C Gramlich, Michael Loehr: 4x4 GtsMatrix implementation. 15 | Tim Fenn: "dual" marching tetrahedra. 16 | Tomas Akenine-Moller: fast triangle-box intersection test. 17 | Ivan Adam Vari: RPM packages. 18 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to produce Makefile.in 2 | 3 | SUBDIRS = src tools examples doc test debian 4 | 5 | OSC_DIR=$(HOME)/local/src/osc/home:popinet/$(PACKAGE)-snapshot 6 | 7 | pkgconfigdir = $(libdir)/pkgconfig 8 | pkgconfig_DATA = gts.pc 9 | 10 | ChangeLog: 11 | darcs changes > ChangeLog 12 | 13 | debian-snapshot: config.h 14 | darcs changes > ChangeLog 15 | sh debian/changelog.sh 16 | dpkg-buildpackage -rfakeroot -b 17 | rm -f debian/repo/* 18 | mv -f ../*.changes ../*.deb debian/repo 19 | cd debian/repo && dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz 20 | 21 | launchpad-snapshot: config.h dist 22 | tar xzf $(PACKAGE)-?.?.?.tar.gz 23 | cd $(PACKAGE)-?.?.? && ./configure && darcs changes > ChangeLog && sh debian/changelog.sh && dpkg-buildpackage -rfakeroot -k07AB22DC -S -sa 24 | rm -f $(PACKAGE)-?.?.?.tar.gz 25 | rm -r -f $(PACKAGE)-?.?.? 26 | 27 | buildservice-snapshot: config.h dist 28 | tar xzf $(PACKAGE)-?.?.?.tar.gz 29 | rm -f $(PACKAGE)-?.?.?.tar.gz 30 | mv -f $(PACKAGE)-?.?.? $(PACKAGE)-snapshot 31 | cd $(PACKAGE)-snapshot && ./configure && darcs changes > ChangeLog && sh debian/changelog.sh && chmod +x debian/rules && make distclean 32 | tar czvf $(PACKAGE)-snapshot.tar.gz $(PACKAGE)-snapshot 33 | dpkg-source -b $(PACKAGE)-snapshot 34 | rm -r -f $(PACKAGE)-snapshot 35 | cd $(OSC_DIR) && osc update && rm -f $(OSC_DIR)/* 36 | cp -f rpm/$(PACKAGE).spec $(OSC_DIR) 37 | mv -f $(PACKAGE)-snapshot.tar.gz $(PACKAGE)-snapshot_*.tar.gz $(PACKAGE)-snapshot_*.dsc $(OSC_DIR) 38 | cd $(OSC_DIR) && osc addremove && osc commit -m "snapshot release" 39 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | General Information 2 | =================== 3 | 4 | This is the GTS library. GTS stands for the GNU Triangulated 5 | Surface Library. It includes a number of useful functions to deal with 6 | triangulated surfaces including, but not limited to, multi-resolution 7 | models, Delaunay and Constrained Delaunay triangulations, set operations on 8 | surfaces (intersection, union etc ...), bounding-boxes trees for efficient 9 | collision and intersection detection, triangle strips generation for fast 10 | rendering. 11 | 12 | The official web site is: 13 | http://gts.sourceforge.net 14 | 15 | Copying 16 | ======= 17 | 18 | The GTS library is distributed under the terms of the Library General 19 | Public License which is compliant with the guidelines of the Open 20 | Source and Free Software Fundations. See the file COPYING for details. 21 | 22 | The robust geometric predicates code (src/predicates.c) was written 23 | and placed in the public domain by Jonathan R. Shewchuk. The original 24 | version of the code can be found at 25 | 26 | http://www.cs.cmu.edu/~quake/robust.html 27 | 28 | Installation 29 | ============ 30 | 31 | GTS uses the glib library which is part of gtk (http://www.gtk.org). If you 32 | use linux there is a good chance that this library is already on your 33 | system, otherwise, you'll need to install it. 34 | 35 | A WIN32 glib port is available at http://www.gtk.org/download.html, however 36 | it is recommended to use GTS within the Cygwin environment under windows. 37 | 38 | Unix users (including cygwin users): 39 | 40 | If you checked out GTS from sourceforge.net, you will need to have the 41 | gnu autoconf tools installed. Generate the "configure" script with 42 | the following commands: 43 | 44 | aclocal 45 | autoheader 46 | automake -a 47 | autoconf 48 | 49 | After this, or if you are installing from source where the configure 50 | script is already built: 51 | 52 | ./configure 53 | make 54 | make install 55 | 56 | See the file 'INSTALL' for generic configure instructions. 57 | 58 | 59 | Windows users: 60 | If you have Microsoft C try: 61 | 62 | cd src 63 | nmake -f makefile.msc install 64 | 65 | or use Cygwin (http://www.cygwin.com) 66 | 67 | Using GTS 68 | ========= 69 | 70 | From version 0.5.0 you can use the `gts-config' script in order to 71 | obtain the compile flags and link flags necessary to use the GTS 72 | library. 73 | 74 | - To compile add `gts-config --cflags` to your compiler flags. 75 | - To link add `gts-config --libs` to your linker flags. 76 | 77 | When developping code using GTS you probably want to enable control 78 | over casting operations between objects of the GTS object 79 | hierarchy. This can be done easily by defining GTS_CHECK_CASTS either 80 | in the CFLAGS environement variable (CFLAGS=-DGTS_CHECK_CASTS) or on 81 | the command-line of your compiler. 82 | 83 | This will slow down your code but will warn you when you try to 84 | perform illegal casts between GtsObjects. 85 | 86 | You can also to do that using the `--check' option of gts-config, 87 | i.e. by adding `gts-config --cflags --check' to your compiler flags. 88 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | GNU Triangulated Surface Library 2 | ================================ 3 | 4 | **GTS** stands for the GNU Triangulated Surface Library. It is an Open Source Free Software Library intended to provide a set of useful functions to deal with 3D surfaces meshed with interconnected triangles. The source code is distributed under the terms of the [GNU Lesser General Public License (LGPL)](http://www.gnu.org/copyleft/lgpl.html). 5 | 6 | The code is written entirely in C with an object-oriented approach based mostly on the design of [GTK+](http://www.gtk.org/). Careful attention is paid to performance related issues as the initial goal of **gts** is to provide a simple and efficient library to scientists dealing with 3D computational surface meshes. 7 | 8 | A brief summary of its main features: 9 | 10 | * Simple object-oriented structure giving easy access to topological properties. 11 | * 2D dynamic Delaunay and constrained Delaunay triangulations. 12 | * Robust geometric predicates (orientation, in circle) using fast adaptive floating point arithmetic (adapted from [the fine work of Jonathan R. Shewchuk](http://www.cs.cmu.edu/~quake/robust.html)). 13 | * Robust set operations on surfaces (union, intersection, difference). 14 | * Surface refinement and coarsening (multiresolution models). 15 | * Dynamic view-independent continuous level-of-detail. 16 | * Preliminary support for view-dependent level-of-detail. 17 | * Bounding-boxes trees and Kd-trees for efficient point location and collision/intersection detection. 18 | * Graph operations: traversal, graph partitioning. 19 | * Metric operations (area, volume, curvature ...). 20 | * Triangle strips generation for fast rendering. 21 | * Simple try/catch/throw exception-handling interface using [cexcept](http://www.nicemice.net/cexcept/). 22 | -------------------------------------------------------------------------------- /RELEASE: -------------------------------------------------------------------------------- 1 | - cvs update 2 | - make changelog 3 | - update NEWS 4 | - commit ChangeLog and NEWS 5 | - check version number in configure.in 6 | * if changed: 7 | - autoconf 8 | - ./configure 9 | - commit configure.in 10 | - make dist 11 | - cvs tag release_... 12 | - http://sourceforge.net/docman/display_doc.php?docid=6445&group_id=1#howtoupload 13 | - ftp://upload.sf.net/incoming/ 14 | - runsocks ncftp upload.sf.net 15 | - https://sourceforge.net/project/admin/editpackages.php?group_id=1343 16 | - update ../www/macros.m4 `m4_gts_version' 17 | ../www/menu.html "Download Version m4_gts_version" 18 | /bin/cp doc/html/* ../www/publish/reference/ 19 | update News section 20 | cd ../www 21 | make 22 | make sync 23 | - mail gts-general, gts-devel, gts-announce 24 | -------------------------------------------------------------------------------- /THANKS: -------------------------------------------------------------------------------- 1 | GTS would not have been as good :) without the contributions of the following 2 | people (in random order): 3 | 4 | Mike Loehr 5 | Bertrand Petit 6 | Jose Miguel Espadero 7 | Jordi Rovira i Bonet 8 | Sergey Y. Kazakov 9 | Florian Hars 10 | Peter Lindstrom 11 | Martin Herren 12 | Navneet Dalal 13 | Thomas Binder 14 | Helmut Cantzler 15 | Johannes Beigel 16 | Darie Aron 17 | Gary Van Sickle 18 | Ray Jones 19 | Olivier Parisy 20 | Mashhuda Glencross 21 | John (EBo) David 22 | Jerome Benoit 23 | Curtis Olson 24 | Kai Huettemann 25 | Magnus Sirvio 26 | Gene Ressler 27 | Omar Cornut 28 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | This is a non-exhaustive list of things to do. 2 | 3 | - cleanup dual isosurface stuff by "Tim F" 4 | 5 | - paper doc 6 | 7 | - cleanup of GHashTable hack in cdt.c. 8 | 9 | - Specialized hash tables for surface->triangles? 10 | 11 | - Error status when reading GTS file. (done) 12 | 13 | - Homogeneous coordinates? 14 | 15 | - Boolean operations: check problems for some degenerate cases. 16 | 17 | - More generic interface for gts_surface_inter_new(). 18 | 19 | - Tutorial for the creation of new GtsObject classes. 20 | 21 | - Implicit dependencies for hierarchical surfaces. 22 | 23 | - More generic interface for isosurface computation (user-control of 24 | vertex generation). 25 | 26 | - GtsContainer class? (half-done) 27 | 28 | - Graph partitioning 29 | * optimisation BKL -> BKL(1,*) (Karypis & Kumar) 30 | * k-way partitioning 31 | * bug for memplus.graph, add20.graph 32 | 33 | - Doc: private fields of structures. 34 | 35 | - Include Volodymyr Babin's gts-iso-toy code. 36 | 37 | - Apply Norman Vine cygwin patch 38 | 39 | - Apply Patch for gts_triangles_angle 40 | 41 | - change gts_file_close() to gts_file_destroy() (patch Ray Jones). 42 | -------------------------------------------------------------------------------- /debian/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = changelog.sh compat control copyright \ 2 | libgts-snapshot-dev.install \ 3 | libgts-snapshot-doc.docs \ 4 | libgts-snapshot.install \ 5 | libgts-snapshot.symbols \ 6 | rules 7 | -------------------------------------------------------------------------------- /debian/changelog.sh: -------------------------------------------------------------------------------- 1 | GTS_VERSION=`grep GTS_MAJOR_VERSION config.h | awk '{print $3;}'`.`grep GTS_MINOR_VERSION config.h | awk '{print $3;}'`.`grep GTS_MICRO_VERSION config.h | awk '{print $3;}'` 2 | 3 | version=`date +%y%m%d` 4 | date=`date +"%a, %e %b %Y %T %z"` 5 | cat < debian/changelog 6 | gts-snapshot ($GTS_VERSION-$version) jaunty; urgency=low 7 | 8 | * gts-snapshot release (based on Ruben Molina's official debian) 9 | 10 | -- Stephane Popinet $date 11 | EOF 12 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 5 2 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: gts-snapshot 2 | Section: math 3 | Priority: optional 4 | Maintainer: Stephane Popinet 5 | Build-Depends: cdbs, debhelper (>= 5), autotools-dev, libglib2.0-dev, libnetpbm10-dev, gtk-doc-tools (>= 1.3-4) 6 | Homepage: http://gts.sourceforge.net/ 7 | 8 | Package: libgts-snapshot-dev 9 | Section: libdevel 10 | Architecture: any 11 | Depends: ${shlibs:Depends}, ${misc:Depends}, libglib2.0-dev, libgts-snapshot (= ${binary:Version}) 12 | Conflicts: libgts-dev, libgts-bin 13 | Suggests: libgts-snapshot-doc 14 | Description: GTS Library (development snapshot) 15 | GTS includes a number of useful functions to deal with triangulated 16 | surfaces including, but not limited to, multi-resolution models, 17 | Delaunay and Constrained Delaunay triangulations, set operations on 18 | surfaces (intersection, union etc ...), bounding-boxes trees for 19 | efficient collision and intersection detection, triangle strips and 20 | binary heaps. 21 | 22 | Package: libgts-snapshot 23 | Section: libs 24 | Architecture: any 25 | Depends: ${shlibs:Depends}, ${misc:Depends} 26 | Conflicts: libgts-0.7-1, libgts-0.7-5, libgts-bin 27 | Description: GTS Library (development snapshot) -- runtime environment 28 | GTS includes a number of useful functions to deal with triangulated 29 | surfaces. Refer to the libgts-dev package description for more 30 | details. 31 | . 32 | This package provides runtime support for GTS 33 | 34 | Package: libgts-snapshot-doc 35 | Section: doc 36 | Architecture: all 37 | Conflicts: libgts-doc 38 | Depends: ${shlibs:Depends}, ${misc:Depends} 39 | Description: GTS Library documentation (development snapshot) 40 | GTS includes a number of useful functions to deal with triangulated 41 | surfaces. Refer to the libgts-dev package description for more 42 | details. 43 | . 44 | This package contains the GTS Reference, in HTML format. 45 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | Copyright: GNU Library General Public License, Version 2. 2 | 3 | On Debian systems, the complete text of the LGPL is located in 4 | /usr/share/common-licenses/LGPL-2 5 | -------------------------------------------------------------------------------- /debian/libgts-snapshot-dev.install: -------------------------------------------------------------------------------- 1 | debian/tmp/usr/bin/gts-config 2 | debian/tmp/usr/include 3 | debian/tmp/usr/lib/*.so 4 | debian/tmp/usr/lib/*.a 5 | debian/tmp/usr/lib/*.la 6 | debian/tmp/usr/share/aclocal 7 | debian/tmp/usr/share/man/man1/gts-config.1 8 | -------------------------------------------------------------------------------- /debian/libgts-snapshot-doc.docs: -------------------------------------------------------------------------------- 1 | doc/html 2 | -------------------------------------------------------------------------------- /debian/libgts-snapshot.install: -------------------------------------------------------------------------------- 1 | debian/tmp/usr/bin/gts2oogl 2 | debian/tmp/usr/bin/gtscheck 3 | debian/tmp/usr/bin/gtscompare 4 | debian/tmp/usr/bin/gtstemplate 5 | debian/tmp/usr/bin/stl2gts 6 | debian/tmp/usr/bin/transform 7 | debian/tmp/usr/bin/delaunay 8 | debian/tmp/usr/bin/happrox 9 | debian/tmp/usr/bin/gts2dxf 10 | debian/tmp/usr/bin/gts2stl 11 | debian/tmp/usr/lib/*.so.* 12 | debian/tmp/usr/lib/pkgconfig/*.pc 13 | debian/tmp/usr/share/man/man1/gts2oogl.1 14 | debian/tmp/usr/share/man/man1/gtscheck.1 15 | debian/tmp/usr/share/man/man1/gtscompare.1 16 | debian/tmp/usr/share/man/man1/gtstemplate.1 17 | debian/tmp/usr/share/man/man1/stl2gts.1 18 | debian/tmp/usr/share/man/man1/transform.1 19 | debian/tmp/usr/share/man/man1/delaunay.1 20 | debian/tmp/usr/share/man/man1/happrox.1 21 | debian/tmp/usr/share/man/man1/gts2dxf.1 22 | debian/tmp/usr/share/man/man1/gts2stl.1 23 | -------------------------------------------------------------------------------- /debian/libgts-snapshot.symbols: -------------------------------------------------------------------------------- 1 | # dummy file just here to force dh_makeshlibs to call dpkg-gensymbols 2 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | include /usr/share/cdbs/1/rules/debhelper.mk 4 | include /usr/share/cdbs/1/class/autotools.mk 5 | 6 | GTS_VERSION = $(shell grep -o "[0-9]*\.[0-9]*\.[0-9]*" $(CURDIR)/debian/changelog) 7 | DEB_DH_MAKESHLIBS_ARGS_libgts-snapshot = -- -v$(GTS_VERSION) -c0 8 | 9 | clean:: 10 | rm -f src/predicates_init 11 | -------------------------------------------------------------------------------- /doc/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to produce Makefile.in 2 | 3 | SUBDIRS = manpages 4 | 5 | # We require automake 1.6 at least. 6 | AUTOMAKE_OPTIONS = 1.6 7 | 8 | # This is a blank Makefile.am for using gtk-doc. 9 | # Copy this to your project's API docs directory and modify the variables to 10 | # suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples 11 | # of using the various options. 12 | 13 | # The name of the module, e.g. 'glib'. 14 | DOC_MODULE=gts 15 | 16 | # Uncomment for versioned docs and specify the version of the module, e.g. '2'. 17 | #DOC_MODULE_VERSION=2 18 | 19 | # The top-level SGML file. You can change this if you want to. 20 | DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml 21 | 22 | # The directory containing the source code. Relative to $(srcdir). 23 | # gtk-doc will search all .c & .h files beneath here for inline comments 24 | # documenting the functions and macros. 25 | # e.g. DOC_SOURCE_DIR=../../../gtk 26 | DOC_SOURCE_DIR=../src 27 | 28 | # Extra options to pass to gtkdoc-scangobj. Not normally needed. 29 | SCANGOBJ_OPTIONS= 30 | 31 | # Extra options to supply to gtkdoc-scan. 32 | # e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED" 33 | SCAN_OPTIONS= 34 | 35 | # Extra options to supply to gtkdoc-mkdb. 36 | # e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml 37 | MKDB_OPTIONS=--sgml-mode --output-format=xml 38 | 39 | # Extra options to supply to gtkdoc-mktmpl 40 | # e.g. MKTMPL_OPTIONS=--only-section-tmpl 41 | MKTMPL_OPTIONS= 42 | 43 | # Extra options to supply to gtkdoc-mkhtml 44 | MKHTML_OPTIONS= 45 | 46 | # Extra options to supply to gtkdoc-fixref. Not normally needed. 47 | # e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html 48 | FIXXREF_OPTIONS= 49 | 50 | # Used for dependencies. The docs will be rebuilt if any of these change. 51 | # e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h 52 | # e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c 53 | HFILE_GLOB=$(top_srcdir)/src/gts.h 54 | CFILE_GLOB=$(top_srcdir)/src/*.c 55 | 56 | # Extra header to include when scanning, which are not under DOC_SOURCE_DIR 57 | # e.g. EXTRA_HFILES=$(top_srcdir}/contrib/extra.h 58 | EXTRA_HFILES= 59 | 60 | # Header files to ignore when scanning. Use base file name, no paths 61 | # e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h 62 | IGNORE_HFILES=cexcept.h gtsconfig.h gts-private.h predicates.h rounding.h 63 | 64 | # Images to copy into HTML directory. 65 | # e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png 66 | HTML_IMAGES= 67 | 68 | # Extra SGML files that are included by $(DOC_MAIN_SGML_FILE). 69 | # e.g. content_files=running.sgml building.sgml changes-2.0.sgml 70 | content_files= 71 | 72 | # SGML files where gtk-doc abbrevations (#GtkWidget) are expanded 73 | # These files must be listed here *and* in content_files 74 | # e.g. expand_content_files=running.sgml 75 | expand_content_files= 76 | 77 | # CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library. 78 | # Only needed if you are using gtkdoc-scangobj to dynamically query widget 79 | # signals and properties. 80 | # e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) 81 | # e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) 82 | GTKDOC_CFLAGS= 83 | GTKDOC_LIBS= 84 | 85 | # This includes the standard gtk-doc make rules, copied by gtkdocize. 86 | if ENABLE_GTK_DOC 87 | include $(top_srcdir)/gtk-doc.make 88 | endif 89 | 90 | # Other files to distribute 91 | # e.g. EXTRA_DIST += version.xml.in 92 | #EXTRA_DIST += 93 | 94 | # Files not to distribute 95 | # for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types 96 | # for --rebuild-sections in $(SCAN_OPTIONS) e.g. $(DOC_MODULE)-sections.txt 97 | #DISTCLEANFILES += 98 | 99 | # Comment this out if you want your docs-status tested during 'make check' 100 | if ENABLE_GTK_DOC 101 | #TESTS_ENVIRONMENT = cd $(srcsrc) && 102 | #TESTS = $(GTKDOC_CHECK) 103 | endif 104 | 105 | #-include $(top_srcdir)/git.mk 106 | -------------------------------------------------------------------------------- /doc/gts-docs.sgml: -------------------------------------------------------------------------------- 1 | 2 | 6 | ]> 7 | 8 | 9 | GTS Library Reference Manual 10 | 11 | for gts 0.7.7. 12 | The latest version of this documentation can be found on-line at 13 | API Reference. 14 | 15 | 16 | 17 | 18 | Basic Macros, Functions and Data Structures 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | Geometrical Object Hierarchy 28 | 29 | GTS uses a simple object system implemented in C which allows all 30 | the basic paradigms of object-oriented programming: inheritance of 31 | class members and virtual functions overloading in particular. 32 | 33 | 34 | The class hierarchy is implemented via a hierarchy of nested C 35 | structs and type casting. In order to avoid "wild" type casts 36 | between objects belonging to incompatible classes, type casting is 37 | done through macros which check if the conversion is valid. This 38 | type checking is however relatively expensive and can be disabled 39 | on production code by omitting the GTS_CHECK_CASTS define at 40 | compile time. 41 | 42 | 43 | The basic geometrical objects of GTS do not have any support for 44 | attributes such as color, texture coordinates, material properties 45 | etc... which may be of interest when using GTS for graphical 46 | applications. This choice was made on purpose in order to keep GTS 47 | as general as possible. Using object inheritance it should however 48 | be easy to extend the base classes to fit your personal needs. 49 | 50 | 51 | When destroying geometrical objects you must keep in mind their 52 | geometrical relationships. Destroying a vertex also destroys all 53 | the edges using this particular vertex, destroying an edge 54 | destroys the triangles. Vertices, edges or faces not used by any 55 | segment, triangle or surface respectively are considered to be 56 | "floating" objects. When initially created all vertices, edges or 57 | faces are floating. Destroying a segment, triangle or surface will 58 | cause the destruction of any new floating vertex, edge or face. 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | Geometrical Data Structures 73 | 74 | 75 | 76 | 77 | Surface Operations 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | Progressive and Hierarchical Surfaces 87 | 88 | 89 | 90 | 91 | 92 | 93 | Graph and Operations on Graphs 94 | 95 | 96 | 97 | 98 | 99 | 100 | Exception Handling 101 | 102 | 103 | 104 | 105 | Object Hierarchy 106 | 107 | 108 | 109 | API Index 110 | 111 | 112 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /doc/isocube.fig: -------------------------------------------------------------------------------- 1 | #FIG 3.2 Produced by xfig version 3.2.5-alpha5 2 | Landscape 3 | Center 4 | Metric 5 | A4 6 | 100.00 7 | Single 8 | -2 9 | 1200 2 10 | 6 2475 1530 10695 7695 11 | 2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 12 | 2707 1796 6685 1796 6685 5773 2707 5773 2707 1796 13 | 2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 14 | 4364 3452 8341 3452 8341 7429 4364 7429 4364 3452 15 | 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 16 | 2707 1796 4364 3452 17 | 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 18 | 6685 1796 8341 3452 19 | 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 20 | 4364 7429 8341 7429 21 | 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 22 | 2707 5773 4364 7429 23 | 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 24 | 6685 5773 8341 7429 25 | 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 26 | 2 1 1.00 88.39 132.58 27 | 9336 5077 9336 4115 28 | 2 1 0 1 0 7 50 -1 -1 0.000 0 0 7 1 0 2 29 | 2 1 1.00 88.39 132.58 30 | 9336 5110 10331 5110 31 | 2 1 0 1 0 7 50 -1 -1 0.000 0 0 7 1 0 2 32 | 2 1 1.00 88.39 132.58 33 | 9336 5110 9999 5773 34 | 4 0 0 50 -1 0 18 0.0000 4 144 122 9469 4314 z\001 35 | 4 0 0 50 -1 0 18 0.0000 4 144 155 9768 5939 x\001 36 | 4 0 0 50 -1 0 18 0.0000 4 210 133 10298 5374 y\001 37 | 4 0 0 50 -1 0 18 0.0000 4 199 144 2508 4115 8\001 38 | 4 0 0 50 -1 0 18 0.0000 4 199 288 6751 4115 11\001 39 | 4 0 0 50 -1 0 18 0.0000 4 199 288 8441 5408 10\001 40 | 4 0 0 50 -1 0 18 0.0000 4 199 144 4166 5441 9\001 41 | 4 0 0 50 -1 0 18 0.0000 4 199 144 5027 6004 4\001 42 | 4 0 0 50 -1 0 18 0.0000 4 199 144 5027 2093 5\001 43 | 4 0 0 50 -1 0 18 0.0000 4 199 144 3668 2658 1\001 44 | 4 0 0 50 -1 0 18 0.0000 4 199 144 7645 2590 2\001 45 | 4 0 0 50 -1 0 18 0.0000 4 199 144 6153 3419 6\001 46 | 4 0 0 50 -1 0 18 0.0000 4 199 144 6153 7331 7\001 47 | 4 0 0 50 -1 0 18 0.0000 4 199 144 7181 6602 3\001 48 | 4 0 0 50 -1 0 18 0.0000 4 199 144 3204 6635 0\001 49 | 4 0 0 50 -1 0 18 0.0000 4 265 552 9768 6203 right\001 50 | 4 0 0 50 -1 0 18 0.0000 4 199 574 9469 4580 front\001 51 | 4 0 0 50 -1 0 18 0.0000 4 243 375 10298 5640 top\001 52 | 4 0 4 50 -1 3 18 0.0000 4 199 144 2575 1729 1\001 53 | 4 0 4 50 -1 3 18 0.0000 4 199 144 2475 5972 0\001 54 | 4 0 4 50 -1 3 18 0.0000 4 199 144 6751 1762 3\001 55 | 4 0 4 50 -1 3 18 0.0000 4 199 144 6784 5740 2\001 56 | 4 0 4 50 -1 3 18 0.0000 4 199 144 8441 3618 7\001 57 | 4 0 4 50 -1 3 18 0.0000 4 199 144 8441 7363 6\001 58 | 4 0 4 50 -1 3 18 0.0000 4 199 144 4166 7695 4\001 59 | 4 0 4 50 -1 3 18 0.0000 4 199 144 4166 3685 5\001 60 | -6 61 | -------------------------------------------------------------------------------- /doc/manpages/Makefile.am: -------------------------------------------------------------------------------- 1 | dist_man_MANS = \ 2 | delaunay.1 \ 3 | gts2dxf.1 \ 4 | gts2oogl.1 \ 5 | gts2stl.1 \ 6 | gtscheck.1 \ 7 | gtscompare.1 \ 8 | gts-config.1 \ 9 | gtstemplate.1 \ 10 | happrox.1 \ 11 | stl2gts.1 \ 12 | transform.1 13 | -------------------------------------------------------------------------------- /doc/manpages/delaunay.1: -------------------------------------------------------------------------------- 1 | .TH delaunay 1 "June 2, 2008" "" "GNU Triangulated Surface utils" 2 | 3 | .SH NAME 4 | delaunay \- constructs the constrained Delaunay triangulation of the input 5 | 6 | .SH SYNOPSIS 7 | .B delaunay 8 | .RI [\| OPTIONS \|]\ <\ file.gts 9 | 10 | .SH DESCRIPTION 11 | This manual page documents briefly the 12 | .B delaunay 13 | command. This command constructs the 14 | constrained Delaunay triangulation of the input 15 | 16 | .SH OPTIONS 17 | This program follow the usual GNU command line syntax, with long 18 | options starting with two dashes (`-'). 19 | A summary of options is included below. 20 | .TP 21 | .BR \-b ,\ \-\-hull 22 | Do not keep convex hull. 23 | .TP 24 | .BR \-e ,\ \-\-noconst 25 | Do not add constrained edges. 26 | .TP 27 | .BR \-S ,\ \-\-split 28 | Split constraints (experimental). 29 | .TP 30 | .BR \-H ,\ \-\-holes 31 | Remove holes from the triangulation. 32 | .TP 33 | .BR \-d ,\ \-\-duplicates 34 | Remove duplicate vertices. 35 | .TP 36 | .BR \-r ,\ \-\-randomize 37 | Shuffle input vertex list. 38 | .TP 39 | .BR \-c ,\ \-\-check 40 | Check Delaunay property. 41 | .TP 42 | .BI \-f\ FNAME\fR,\ \-\-files= FNAME 43 | Generate evolution files. 44 | .TP 45 | .BR \-o ,\ \-\-conform 46 | Generate conforming triangulation. 47 | .TP 48 | .BI \-s\ N\fR,\ \-\-steiner= N 49 | Maximum number of Steiner points for conforming triangulation (default is no limit). 50 | .TP 51 | .BI \-q\ Q\fR,\ \-\-quality= Q 52 | Set the minimum acceptable face quality. 53 | .TP 54 | .BI \-a\ A\fR,\ \-\-area= A 55 | Set the maximum acceptable face area. 56 | .TP 57 | .BR \-v ,\ \-\-verbose 58 | Print statistics about the triangulation. 59 | .TP 60 | .BR \-h ,\ \-\-help 61 | Display the help and exit. 62 | 63 | .SH AUTHOR 64 | delaunay was written by Stephane Popinet . 65 | .PP 66 | This manual page was written by Ruben Molina , 67 | for the Debian project (but may be used by others). 68 | -------------------------------------------------------------------------------- /doc/manpages/gts-config.1: -------------------------------------------------------------------------------- 1 | .TH gts-config 1 "June 2, 2008" "" "GNU Triangulated Surface utils" 2 | 3 | .SH NAME 4 | gts-config \- defines values for programs using gts. 5 | 6 | .SH SYNOPSIS 7 | .B gts-config 8 | .RI [\| OPTIONS \|]\ [\| LIBRARIES \|] 9 | .SH DESCRIPTION 10 | This manual page documents briefly the 11 | .B gts-config 12 | command. 13 | 14 | .SH OPTIONS 15 | These programs follow the usual GNU command line syntax, with long 16 | options starting with two dashes (`-'). 17 | A summary of options is included below. 18 | .TP 19 | .BI \-\-prefix\fR[\|= DIR \fR\|] 20 | .TP 21 | .BI \-\-exec-prefix\fR[\|= DIR \fR\|] 22 | .TP 23 | .B \-\-version 24 | .TP 25 | .B \-\-libs 26 | .TP 27 | .B \-\-cflags 28 | .TP 29 | .B \-\-check 30 | 31 | .SH LIBRARIES 32 | .TP 33 | .B gts 34 | .TP 35 | .B gmodule 36 | .TP 37 | .B gthread 38 | 39 | .SH AUTHOR 40 | gts-config was written by Stephane Popinet . 41 | .PP 42 | This manual page was written by Ruben Molina , 43 | for the Debian project (but may be used by others). 44 | -------------------------------------------------------------------------------- /doc/manpages/gts2dxf.1: -------------------------------------------------------------------------------- 1 | .TH gts2dxf 1 "June 2, 2008" "" "GNU Triangulated Surface utils" 2 | 3 | .SH NAME 4 | gts2dxf \- converts a GTS file to DXF format. 5 | 6 | .SH SYNOPSIS 7 | .B gts2dxf 8 | .RI <\ input.gts\ >\ output.dxf 9 | 10 | .SH DESCRIPTION 11 | This manual page documents briefly the 12 | .B gts2dxf 13 | command. 14 | 15 | .SH AUTHOR 16 | gts2dxf was written by Stephane Popinet . 17 | .PP 18 | This manual page was written by Ruben Molina , 19 | for the Debian project (but may be used by others). 20 | -------------------------------------------------------------------------------- /doc/manpages/gts2oogl.1: -------------------------------------------------------------------------------- 1 | .TH gts2oogl 1 "June 2, 2008" "" "GNU Triangulated Surface utils" 2 | 3 | .SH NAME 4 | gts2oogl \- converts a GTS file to OOGL file format (Geomview). 5 | 6 | .SH SYNOPSIS 7 | .B gts2oogl 8 | .RI [\| OPTIONS \|]\ <\ input.srf\ >\ output.oogl 9 | 10 | .SH DESCRIPTION 11 | This manual page documents briefly the 12 | .B gts2oogl 13 | command. 14 | 15 | .SH OPTIONS 16 | This program follow the usual GNU command line syntax, with long 17 | options starting with two dashes (`-'). 18 | A summary of options is included below. 19 | .TP 20 | .BR \-G ,\ \-\-gnuplot 21 | Writes isolines in gnuplot format. 22 | .TP 23 | .B \-\-component 24 | Color faces according to the component they belong too. 25 | .TP 26 | .B \-\-quality 27 | Color faces according to their quality. 28 | .TP 29 | .B \-\-area 30 | Color faces according to their area. 31 | .TP 32 | .B \-\-incomp 33 | Color incompatible faces. 34 | .TP 35 | .BI \-f\ VAL\fR,\ \-\-fold= VAL 36 | Color faces which make an angle smaller than 37 | .I VAL 38 | degrees with any of their neighbors. 39 | .TP 40 | .BR \-t ,\ \-\-faces 41 | Output individual faces. 42 | .TP 43 | .B \-\-epv 44 | Color vertices according to number of edges per vertex. 45 | .TP 46 | .BI \-H\ C\fR,\ \-\-height= C 47 | Color vertices according to their 48 | .I C 49 | coordinate. 50 | .TP 51 | .BR \-g ,\ \-\-gaussian 52 | Color vertices according to Gaussian curvature. 53 | .TP 54 | .BR \-C ,\ \-\-curvature 55 | Color vertices according to mean curvature. 56 | .TP 57 | .B \-\-boundary 58 | Output boundary edges. 59 | .TP 60 | .BI \-e\ A\fR,\ \-\-feature= A 61 | Output `feature' edges defined by angle \fIA\fR. 62 | .TP 63 | .B \-\-non-manifold 64 | Output non-manifold edges. 65 | .TP 66 | .B \-\-duplicate 67 | Output duplicate edges. 68 | .TP 69 | .BI \-i\ N\fR,\ \-\-isolines= N 70 | Draw 71 | .I N 72 | isolines (levels of constant altitude). 73 | .TP 74 | .BI \-I\ L\fR,\ \-\-isolines= L 75 | Draw isoline at level \fIL\fR. 76 | .TP 77 | .BI \-\-cmap= FILE 78 | Load 79 | .I FILE 80 | as colormap. 81 | .TP 82 | .BI \-m\ VAL\fR,\ \-\-min= VAL 83 | Use 84 | .I VAL 85 | as minimum scaling value. 86 | .TP 87 | .BI \-M\ VAL\fR,\ \-\-max= VAL 88 | Use 89 | .I VAL 90 | as maximum scaling value. 91 | .TP 92 | .BR \-r ,\ \-\-reverse 93 | Reverse colormap. 94 | .TP 95 | .BR \-n ,\ \-\-nosurface 96 | Do not output surface. 97 | .TP 98 | .BI \-F\ C\fR,\ \-\-flatten= C 99 | Set 100 | .I C 101 | coordinate to average value. 102 | .TP 103 | .BR \-v ,\ \-\-verbose 104 | Display surface statistics. 105 | .TP 106 | .BR \-h ,\ \-\-help 107 | Display the help and exit. 108 | 109 | .SH AUTHOR 110 | gts2oogl was written by Stephane Pipinet . 111 | .PP 112 | This manual page was written by Ruben Molina , 113 | for the Debian project (but may be used by others). 114 | -------------------------------------------------------------------------------- /doc/manpages/gts2stl.1: -------------------------------------------------------------------------------- 1 | .TH gts2stl 1 "June 2, 2008" "" "GNU Triangulated Surface utils" 2 | 3 | .SH NAME 4 | gts2stl \- converts a GTS file to STL format 5 | 6 | .SH SYNOPSIS 7 | .B gts2stl 8 | .RI [\| OPTIONS \|]\ <\ input.gts\ >\ output.stl 9 | 10 | .SH DESCRIPTION 11 | This manual page documents briefly the 12 | .B gts2stl 13 | command. 14 | 15 | .SH OPTIONS 16 | This program follow the usual GNU command line syntax, with long 17 | options starting with two dashes (`-'). 18 | A summary of options is included below. 19 | .TP 20 | .BR \-r ,\ \-\-revert 21 | Revert face normals. 22 | .TP 23 | .BR \-v ,\ \-\-verbose 24 | Display surface statistics. 25 | .TP 26 | .BR \-h ,\ \-\-help 27 | Display the help and exit. 28 | 29 | .SH AUTHOR 30 | gts2stl was written by Stephane Popinet . 31 | .PP 32 | This manual page was written by Ruben Molina , 33 | for the Debian project (but may be used by others). 34 | -------------------------------------------------------------------------------- /doc/manpages/gtscheck.1: -------------------------------------------------------------------------------- 1 | .TH gtscheck 1 "June 2, 2008" "" "GNU Triangulated Surface utils" 2 | 3 | .SH NAME 4 | gtscheck \- checks that a surface defines a closed, orientable non self-intersecting manifold. 5 | 6 | .SH SYNOPSIS 7 | .B gtscheck 8 | .RI [\| OPTION \|]\ <\ FILE 9 | .SH DESCRIPTION 10 | This manual page documents briefly the 11 | .B gtscheck 12 | command. 13 | 14 | .SH OPTIONS 15 | These programs follow the usual GNU command line syntax, with long 16 | options starting with two dashes (`-'). 17 | A summary of options is included below. 18 | .TP 19 | .BR \-v ,\ \-\-verbose 20 | Print statistics about the surface. 21 | .TP 22 | .BR \-h ,\ \-\-help 23 | Display the help and exit. 24 | 25 | .SH EXIT STATUS 26 | The return status reflects the error encountered: 27 | .B 0 28 | none 29 | .B 1 30 | the input file is not a valid GTS file 31 | .B 2 32 | the surface is not an orientable manifold 33 | .B 3 34 | the surface is an orientable manifold but is self-intersecting 35 | 36 | .SH AUTHOR 37 | gtscheck was written by Stephane Popinet . 38 | .PP 39 | This manual page was written by Ruben Molina , 40 | for the Debian project (but may be used by others). 41 | -------------------------------------------------------------------------------- /doc/manpages/gtscompare.1: -------------------------------------------------------------------------------- 1 | .TH gtscompare 1 "June 2, 2008" "" "GNU Triangulated Surface utils" 2 | 3 | .SH NAME 4 | gtscompare \- compare two GTS files. 5 | 6 | .SH SYNOPSIS 7 | .B gtscompare 8 | .RI [\| OPTIONS \|] 9 | .I FILE1 FILE2 DELTA 10 | 11 | .SH DESCRIPTION 12 | This manual page documents briefly the 13 | .B gtscompare 14 | command. 15 | 16 | .I DELTA 17 | is the sampling length expressed as a fraction of the bounding box diagonal of the second surface. 18 | 19 | .SH OPTIONS 20 | This program follow the usual GNU command line syntax, with long 21 | options starting with two dashes (`-'). 22 | A summary of options is included below. 23 | .TP 24 | .BR \-s ,\ \-\-symmetric 25 | Symmetric statistics. 26 | .TP 27 | .BR \-i ,\ \-\-image 28 | Output visualisation mesh. 29 | .TP 30 | .BI \-c\ FILE\fR,\ \-\-cmap= FILE 31 | Load 32 | .I FILE 33 | as colormap. 34 | .TP 35 | .BI \-m\ VAL\fR,\ \-\-min= VAL 36 | Use 37 | .I VAL 38 | as minimum scaling value. 39 | .TP 40 | .BI \-M\ VAL\fR,\ \-\-max= VAL 41 | Use 42 | .I VAL 43 | as maximum scaling value. 44 | .TP 45 | .BR \-r ,\ \-\-reverse 46 | Reverse colormap. 47 | .TP 48 | .BR \-l ,\ \-\-log 49 | Use log scale. 50 | .TP 51 | .BR \-h ,\ \-\-help 52 | Display the help and exit. 53 | 54 | .SH AUTHOR 55 | gtscompare was written by Stephane Popinet . 56 | .PP 57 | This manual page was written by Ruben Molina , 58 | for the Debian project (but may be used by others). 59 | -------------------------------------------------------------------------------- /doc/manpages/gtstemplate.1: -------------------------------------------------------------------------------- 1 | .TH gtstemplate 1 "June 2, 2008" "" "GNU Triangulated Surface utils" 2 | 3 | .SH NAME 4 | gtstemplate \- generates of a template used to create new object classes. 5 | 6 | .SH SYNOPSIS 7 | .B gtstemplate 8 | .RI [\| OPTIONS \|]\ [\| LIBRARIES \|] 9 | 10 | .SH DESCRIPTION 11 | This manual page documents briefly the 12 | .B gtstemplate 13 | command. 14 | 15 | .SH OPTIONS 16 | These programs follow the usual GNU command line syntax, with long 17 | options starting with two dashes (`-'). 18 | A summary of options is included below. 19 | .TP 20 | .B \-\-no-extra-data 21 | .TP 22 | .B \-\-no-extra-method 23 | .TP 24 | .BI \-\-overload= METHOD 25 | 26 | .SH AUTHOR 27 | gtstemplate was written by Stephane Popinet . 28 | .PP 29 | This manual page was written by Ruben Molina , 30 | for the Debian project (but may be used by others). 31 | -------------------------------------------------------------------------------- /doc/manpages/happrox.1: -------------------------------------------------------------------------------- 1 | .TH happrox 1 "June 2, 2008" "" "GNU Triangulated Surface utils" 2 | 3 | .SH NAME 4 | happrox \- returns a simplified triangulation of a set of points using algorithm III of Garland and Heckbert (1995). 5 | 6 | .SH SYNOPSIS 7 | .B happrox 8 | .RI [\| OPTIONS \|]\ <\ [\| input.pgm | input \|]\ >\ output.gts 9 | 10 | .SH DESCRIPTION 11 | This manual page documents briefly the 12 | .B happrox 13 | command. 14 | 15 | .SH OPTIONS 16 | This program follow the usual GNU command line syntax, with long 17 | options starting with two dashes (`-'). 18 | A summary of options is included below. 19 | .TP 20 | .BI \-n\ N\fR,\ \-\-number= N 21 | Stop the refinement process if the number of vertices is larger than \fIN\fR. 22 | .TP 23 | .BI \-c\ C\fR,\ \-\-cost= C 24 | Stop the refinement process if the cost of insertion of a vertex is smaller than \fIC\fR. 25 | .TP 26 | .BR \-f ,\ \-\-flat 27 | Input is a flat file with three x,y,z columns (default is PGM file). 28 | .TP 29 | .BI \-r\ Z\fR,\ \-\-relative= Z 30 | Use relative height cost for all heights larger than \fIZ\fR. 31 | .TP 32 | .BR \-k ,\ \-\-keep 33 | Keep enclosing triangle. 34 | .TP 35 | .BR \-C ,\ \-\-closed 36 | Close the surface. 37 | .TP 38 | .BR \-l ,\ \-\-log 39 | Log evolution of cost. 40 | .TP 41 | .BR \-v ,\ \-\-verbose 42 | Display surface statistics. 43 | .TP 44 | .BR \-h ,\ \-\-help 45 | Display the help and exit. 46 | 47 | .SH AUTHOR 48 | happrox was written by Stephane Popinet . 49 | .PP 50 | This manual page was written by Ruben Molina , 51 | for the Debian project (but may be used by others). 52 | -------------------------------------------------------------------------------- /doc/manpages/stl2gts.1: -------------------------------------------------------------------------------- 1 | .TH stl2gts 1 "June 2, 2008" "" "GNU Triangulated Surface utils" 2 | 3 | .SH NAME 4 | stl2gts \- convert an STL file to GTS format. 5 | 6 | .SH SYNOPSIS 7 | .B stl2gts 8 | .RI [\| OPTIONS \|]\ <\ input.stl\ >\ output.gts 9 | 10 | .SH DESCRIPTION 11 | This manual page documents briefly the 12 | .B stl2gts 13 | command. 14 | 15 | .SH OPTIONS 16 | These programs follow the usual GNU command line syntax, with long 17 | options starting with two dashes (`-'). 18 | A summary of options is included below. 19 | .TP 20 | .BR \-r ,\ \-\-revert 21 | Revert face normals. 22 | .TP 23 | .BR \-n ,\ \-\-nomerge 24 | Do not merge vertices. 25 | .TP 26 | .BR \-v ,\ \-\-verbose 27 | Display surface statistics. 28 | .TP 29 | .BR \-h ,\ \-\-help 30 | Display the help and exit. 31 | 32 | .SH AUTHOR 33 | stl2gts was written by Stephane Popinet . 34 | .PP 35 | This manual page was written by Ruben Molina , 36 | for the Debian project (but may be used by others). 37 | -------------------------------------------------------------------------------- /doc/manpages/transform.1: -------------------------------------------------------------------------------- 1 | .TH transform 1 "June 2, 2008" "" "GNU Triangulated Surface utils" 2 | 3 | .SH NAME 4 | transform \- apply geometric transformations to the input. 5 | 6 | .SH SYNOPSIS 7 | .B transform 8 | .RI [\| OPTIONS \|]\ <\ file.gts 9 | 10 | .SH DESCRIPTION 11 | This manual page documents briefly the 12 | .B transform 13 | command. 14 | 15 | .SH OPTIONS 16 | This program follow the usual GNU command line syntax, with long 17 | options starting with two dashes (`-'). 18 | A summary of options is included below. 19 | .TP 20 | .BI \-r\ ANGLE\fR,\ \-\-rx= ANGLE 21 | Rotate around x-axis 22 | .RI ( ANGLE 23 | in degrees). 24 | .TP 25 | .BI \-m\ ANGLE\fR,\ \-\-ry= ANGLE 26 | Rotate around y-axis. 27 | .TP 28 | .BI \-m\ ANGLE\fR,\ \-\-rz= ANGLE 29 | Rotate around z-axis. 30 | .TP 31 | .BI \-s\ FACTOR\fR,\ \-\-scale= FACTOR 32 | Scale by 33 | .IR FACTOR . 34 | .TP 35 | .BI \-R\ FACTOR\fR,\ \-\-sx= FACTOR 36 | Scale x-axis by 37 | .IR FACTOR . 38 | .TP 39 | .BI \-M\ FACTOR\fR,\ \-\-sy= FACTOR 40 | Scale y-axis by 41 | .IR FACTOR . 42 | .TP 43 | .BI \-N\ FACTOR\fR,\ \-\-sz= FACTOR 44 | Scale z-axis by 45 | .IR FACTOR . 46 | .TP 47 | .BI \-t\ V\fR,\ \-\-tx= V 48 | Translate of 49 | .I V 50 | along x-axis. 51 | .TP 52 | .BI \-u\ V\fR,\ \-\-ty= V 53 | Translate of 54 | .I V 55 | along y-axis. 56 | .TP 57 | .BI \-w\ V\fR,\ \-\-tz= V 58 | Translate of 59 | .I V 60 | along z-axis. 61 | .TP 62 | .BR \-i ,\ \-\-revert 63 | Turn surface inside out. 64 | .TP 65 | .BR \-o ,\ \-\-normalize 66 | Fit the resulting surface in a cube of size 1 centered at the origin. 67 | .TP 68 | .BR \-v ,\ \-\-verbose 69 | Print statistics about the surface. 70 | .TP 71 | .BR \-h ,\ \-\-help 72 | Display the help and exit. 73 | 74 | .SH AUTHOR 75 | transform was written by Stephane Popinet . 76 | .PP 77 | This manual page was written by Ruben Molina , 78 | for the Debian project (but may be used by others). 79 | -------------------------------------------------------------------------------- /examples/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to produce Makefile.in 2 | 3 | INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src -I$(includedir)\ 4 | -DG_LOG_DOMAIN=\"Gts-examples\" 5 | LDADD = $(top_builddir)/src/libgts.la -lm 6 | DEPS = $(top_builddir)/src/libgts.la 7 | 8 | EXTRA_PROGRAMS = happrox 9 | 10 | happrox_LDADD = $(LDADD) -lnetpbm 11 | 12 | if HAS_NETPBM 13 | NETPBM_EXTRA = happrox 14 | endif 15 | 16 | bin_PROGRAMS = \ 17 | transform \ 18 | delaunay \ 19 | $(NETPBM_EXTRA) 20 | 21 | noinst_PROGRAMS = \ 22 | set \ 23 | setobj \ 24 | volume \ 25 | cleanup \ 26 | coarsen \ 27 | refine \ 28 | iso \ 29 | gtstoc \ 30 | oocs \ 31 | partition \ 32 | traverse \ 33 | cartesian \ 34 | split \ 35 | smooth \ 36 | sphere \ 37 | stripe \ 38 | optimize \ 39 | merge 40 | -------------------------------------------------------------------------------- /examples/cleanup.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsaavedr/gts/f566256dcc760c5a9da0182d895e990ee49c460c/examples/cleanup.c -------------------------------------------------------------------------------- /examples/gtstoc.c: -------------------------------------------------------------------------------- 1 | /* GTS - Library for the manipulation of triangulated surfaces 2 | * Copyright (C) 1999 Stéphane Popinet 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Library General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Library General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Library General Public 15 | * License along with this library; if not, write to the 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 | * Boston, MA 02111-1307, USA. 18 | */ 19 | 20 | #include 21 | #include "gts.h" 22 | 23 | static void write_vertex (GtsVertex * v, guint * nv) 24 | { 25 | printf (" GtsVertex * v%u = gts_vertex_new (gts_vertex_class (), %g, %g, %g);\n", 26 | *nv, GTS_POINT (v)->x, GTS_POINT (v)->y, GTS_POINT (v)->z); 27 | GTS_OBJECT (v)->reserved = GUINT_TO_POINTER ((*nv)++); 28 | } 29 | 30 | static void write_edge (GtsSegment * s, guint * ne) 31 | { 32 | printf (" GtsEdge * e%u = gts_edge_new (gts_edge_class (), v%u, v%u);\n", 33 | *ne, 34 | GPOINTER_TO_UINT (GTS_OBJECT (s->v1)->reserved), 35 | GPOINTER_TO_UINT (GTS_OBJECT (s->v2)->reserved)); 36 | GTS_OBJECT (s)->reserved = GUINT_TO_POINTER ((*ne)++); 37 | } 38 | 39 | static void write_face (GtsTriangle * t, guint * nf) 40 | { 41 | printf (" GtsFace * f%u = gts_face_new (gts_face_class (),\n" 42 | " e%u, e%u, e%u);\n", 43 | (*nf)++, 44 | GPOINTER_TO_UINT (GTS_OBJECT (t->e1)->reserved), 45 | GPOINTER_TO_UINT (GTS_OBJECT (t->e2)->reserved), 46 | GPOINTER_TO_UINT (GTS_OBJECT (t->e3)->reserved)); 47 | } 48 | 49 | int main (int argc, char * argv[]) 50 | { 51 | GtsSurface * s; 52 | guint i; 53 | GtsFile * fp; 54 | guint nv = 1, ne = 1, nf = 1; 55 | 56 | if (!setlocale (LC_ALL, "POSIX")) 57 | g_warning ("cannot set locale to POSIX"); 58 | 59 | s = gts_surface_new (gts_surface_class (), 60 | gts_face_class (), 61 | gts_edge_class (), 62 | gts_vertex_class ()); 63 | fp = gts_file_new (stdin); 64 | if (gts_surface_read (s, fp)) { 65 | fputs ("gtstoc: file on standard input is not a valid GTS file\n", 66 | stderr); 67 | fprintf (stderr, "stdin:%d:%d: %s\n", fp->line, fp->pos, fp->error); 68 | return 1; /* failure */ 69 | } 70 | 71 | printf (" GtsSurface * surface = gts_surface_new (gts_surface_class (),\n" 72 | " gts_face_class (),\n" 73 | " gts_edge_class (),\n" 74 | " gts_vertex_class ());\n\n"); 75 | gts_surface_foreach_vertex (s, (GtsFunc) write_vertex, &nv); 76 | printf ("\n"); 77 | gts_surface_foreach_edge (s, (GtsFunc) write_edge, &ne); 78 | printf ("\n"); 79 | gts_surface_foreach_face (s, (GtsFunc) write_face, &nf); 80 | printf (" \n"); 81 | for (i = 1; i < nf; i++) 82 | printf (" gts_surface_add_face (surface, f%u);\n", i); 83 | 84 | return 0; 85 | } 86 | -------------------------------------------------------------------------------- /examples/merge.c: -------------------------------------------------------------------------------- 1 | /* GTS - Library for the manipulation of triangulated surfaces 2 | * Copyright (C) 1999 Stéphane Popinet 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Library General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Library General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Library General Public 15 | * License along with this library; if not, write to the 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 | * Boston, MA 02111-1307, USA. 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | #include "config.h" 24 | #ifdef HAVE_GETOPT_H 25 | # include 26 | #endif /* HAVE_GETOPT_H */ 27 | #ifdef HAVE_UNISTD_H 28 | # include 29 | #endif /* HAVE_UNISTD_H */ 30 | #include "gts.h" 31 | 32 | int main (int argc, char * argv[]) 33 | { 34 | GtsSurface * s; 35 | gboolean verbose = FALSE; 36 | int c = 0; 37 | 38 | if (!setlocale (LC_ALL, "POSIX")) 39 | g_warning ("cannot set locale to POSIX"); 40 | 41 | /* parse options using getopt */ 42 | while (c != EOF) { 43 | #ifdef HAVE_GETOPT_LONG 44 | static struct option long_options[] = { 45 | {"help", no_argument, NULL, 'h'}, 46 | {"verbose", no_argument, NULL, 'v'}, 47 | { NULL } 48 | }; 49 | int option_index = 0; 50 | switch ((c = getopt_long (argc, argv, "hv", 51 | long_options, &option_index))) { 52 | #else /* not HAVE_GETOPT_LONG */ 53 | switch ((c = getopt (argc, argv, "hv"))) { 54 | #endif /* not HAVE_GETOPT_LONG */ 55 | case 'v': /* verbose */ 56 | verbose = TRUE; 57 | break; 58 | case 'h': /* help */ 59 | fprintf (stderr, 60 | "Usage: merge [OPTION] file1.gts file2.gts ...\n" 61 | "Merges files and outputs the resulting GTS surface.\n" 62 | "\n" 63 | " -v --verbose print statistics about the surface\n" 64 | " -h --help display this help and exit\n" 65 | "\n" 66 | "Reports bugs to %s\n", 67 | GTS_MAINTAINER); 68 | return 0; /* success */ 69 | break; 70 | case '?': /* wrong options */ 71 | fprintf (stderr, "Try `merge --help' for more information.\n"); 72 | return 1; /* failure */ 73 | } 74 | } 75 | 76 | s = GTS_SURFACE (gts_object_new (GTS_OBJECT_CLASS (gts_surface_class ()))); 77 | 78 | while (optind < argc) { 79 | FILE * f = fopen (argv[optind], "r"); 80 | GtsFile * fp; 81 | GtsSurface * s1; 82 | 83 | if (f == NULL) { 84 | fprintf (stderr, "merge: can not open file `%s'\n", argv[optind]); 85 | return 1; 86 | } 87 | fp = gts_file_new (f); 88 | s1 = GTS_SURFACE (gts_object_new (GTS_OBJECT_CLASS (gts_surface_class ()))); 89 | if (gts_surface_read (s1, fp)) { 90 | fprintf (stderr, "merge: `%s' is not a valid GTS surface file\n", 91 | argv[optind]); 92 | fprintf (stderr, "%s:%d:%d: %s\n", argv[optind], fp->line, fp->pos, fp->error); 93 | return 1; 94 | } 95 | gts_surface_merge (s, s1); 96 | gts_object_destroy (GTS_OBJECT (s1)); 97 | gts_file_destroy (fp); 98 | fclose (f); 99 | optind++; 100 | } 101 | 102 | if (verbose) 103 | gts_surface_print_stats (s, stderr); 104 | 105 | gts_surface_write (s, stdout); 106 | 107 | return 0; 108 | } 109 | -------------------------------------------------------------------------------- /examples/oocs.c: -------------------------------------------------------------------------------- 1 | /* GTS - Library for the manipulation of triangulated surfaces 2 | * Copyright (C) 1999 Stéphane Popinet 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Library General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Library General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Library General Public 15 | * License along with this library; if not, write to the 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 | * Boston, MA 02111-1307, USA. 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | #include "gts.h" 24 | 25 | int main (int argc, char * argv[]) 26 | { 27 | GtsSurface * s; 28 | GtsBBox * bbox; 29 | gdouble delta; 30 | GtsPoint * p1, * p2, * p3; 31 | guint nt; 32 | GtsRange cluster_stats; 33 | GtsClusterGrid * cluster_grid; 34 | 35 | if (!setlocale (LC_ALL, "POSIX")) 36 | g_warning ("cannot set locale to POSIX"); 37 | 38 | if (argc != 2) { 39 | fprintf (stderr, "usage: oocs DELTA < infile > outfile\n"); 40 | return 1; 41 | } 42 | 43 | s = gts_surface_new (gts_surface_class (), 44 | gts_face_class (), 45 | gts_edge_class (), 46 | gts_vertex_class ()); 47 | 48 | bbox = gts_bbox_new (gts_bbox_class (), s, 0., 0., 0., 0., 0., 0.); 49 | scanf ("%u", &nt); 50 | scanf ("%lf %lf %lf", &bbox->x1, &bbox->y1, &bbox->z1); 51 | scanf ("%lf %lf %lf", &bbox->x2, &bbox->y2, &bbox->z2); 52 | delta = strtod (argv[1], NULL)*sqrt (gts_bbox_diagonal2 (bbox)); 53 | 54 | cluster_grid = gts_cluster_grid_new (gts_cluster_grid_class (), 55 | gts_cluster_class (), 56 | s, bbox, delta); 57 | 58 | p1 = gts_point_new (gts_point_class (), 0., 0., 0.); 59 | p2 = gts_point_new (gts_point_class (), 0., 0., 0.); 60 | p3 = gts_point_new (gts_point_class (), 0., 0., 0.); 61 | 62 | while (scanf ("%lf %lf %lf", &p1->x, &p1->y, &p1->z) == 3 && 63 | scanf ("%lf %lf %lf", &p2->x, &p2->y, &p2->z) == 3 && 64 | scanf ("%lf %lf %lf", &p3->x, &p3->y, &p3->z) == 3) 65 | gts_cluster_grid_add_triangle (cluster_grid, p1, p2, p3, NULL); 66 | cluster_stats = gts_cluster_grid_update (cluster_grid); 67 | 68 | gts_object_destroy (GTS_OBJECT (p1)); 69 | gts_object_destroy (GTS_OBJECT (p2)); 70 | gts_object_destroy (GTS_OBJECT (p3)); 71 | gts_object_destroy (GTS_OBJECT (cluster_grid)); 72 | 73 | fprintf (stderr, "Initial number of triangles: %u\n", nt); 74 | fprintf (stderr, "%d clusters of size: min: %g avg: %.1f|%.1f max: %g\n", 75 | cluster_stats.n, 76 | cluster_stats.min, 77 | cluster_stats.mean, cluster_stats.stddev, 78 | cluster_stats.max); 79 | gts_surface_print_stats (s, stderr); 80 | gts_surface_write (s, stdout); 81 | 82 | return 0; 83 | } 84 | -------------------------------------------------------------------------------- /examples/revolution.c: -------------------------------------------------------------------------------- 1 | /* GTS - Library for the manipulation of triangulated surfaces 2 | * Copyright (C) 1999 Stéphane Popinet 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Library General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Library General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Library General Public 15 | * License along with this library; if not, write to the 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 | * Boston, MA 02111-1307, USA. 18 | */ 19 | 20 | #include 21 | #include 22 | #include "config.h" 23 | #ifdef HAVE_GETOPT_H 24 | # include 25 | #endif /* HAVE_GETOPT_H */ 26 | #ifdef HAVE_UNISTD_H 27 | # include 28 | #endif /* HAVE_UNISTD_H */ 29 | #include "gts.h" 30 | 31 | int main (int argc, char * argv[]) 32 | { 33 | GtsSurface * s; 34 | GSList * vertices = NULL, * edges = NULL, * i; 35 | GtsVertex * v = NULL; 36 | gdouble x, y; 37 | gboolean verbose = FALSE; 38 | int c = 0; 39 | 40 | if (!setlocale (LC_ALL, "POSIX")) 41 | g_warning ("cannot set locale to POSIX"); 42 | 43 | s = gts_surface_new (gts_surface_class (), 44 | gts_face_class (), 45 | gts_edge_class (), 46 | gts_vertex_class ()); 47 | 48 | /* parse options using getopt */ 49 | while (c != EOF) { 50 | #ifdef HAVE_GETOPT_LONG 51 | static struct option long_options[] = { 52 | {"help", no_argument, NULL, 'h'}, 53 | {"verbose", no_argument, NULL, 'v'}, 54 | { NULL } 55 | }; 56 | int option_index = 0; 57 | switch ((c = getopt_long (argc, argv, "hv", 58 | long_options, &option_index))) { 59 | #else /* not HAVE_GETOPT_LONG */ 60 | switch ((c = getopt (argc, argv, "hv"))) { 61 | #endif /* not HAVE_GETOPT_LONG */ 62 | case 'v': /* verbose */ 63 | verbose = TRUE; 64 | break; 65 | case 'h': /* help */ 66 | fprintf (stderr, 67 | "Usage: revolution [OPTION] < FILE\n" 68 | "Reads profile in FILE and generates a GTS surface of revolution.\n" 69 | "\n" 70 | " -v --verbose print statistics about the surface\n" 71 | " -h --help display this help and exit\n" 72 | "\n" 73 | "Report bugs to %s\n", 74 | GTS_MAINTAINER); 75 | return 0; /* success */ 76 | break; 77 | case '?': /* wrong options */ 78 | fprintf (stderr, "Try `cleanup --help' for more information.\n"); 79 | return 1; /* failure */ 80 | } 81 | } 82 | 83 | while (scanf ("%lf %lf", &x, &y) == 2) 84 | vertices = g_slist_prepend (vertices, gts_vertex_new (gts_vertex_class (), x, y, 0.)); 85 | i = vertices; 86 | while (i) { 87 | if (v) 88 | edges = g_slist_prepend (edges, gts_edge_new (gts_edge_class (), v, i->data)); 89 | v = i->data; 90 | i = i->next; 91 | } 92 | g_slist_free (vertices); 93 | 94 | 95 | 96 | 97 | 98 | 99 | m = gts_surface_new (gts_surface_class (), 100 | gts_face_class (), 101 | gts_edge_class (), 102 | gts_vertex_class ()); 103 | fp = gts_file_new (stdin); 104 | if (gts_surface_read (m, fp)) { 105 | fputs ("cleanup: file on standard input is not a valid GTS file\n", 106 | stderr); 107 | fprintf (stderr, "stdin:%d:%d: %s\n", fp->line, fp->pos, fp->error); 108 | return 1; /* failure */ 109 | } 110 | gts_surface_merge (s, m); 111 | gts_object_destroy (GTS_OBJECT (m)); 112 | 113 | /* if verbose on print stats */ 114 | if (verbose) 115 | gts_surface_print_stats (s, stderr); 116 | 117 | /* merge vertices which are close enough */ 118 | /* build list of vertices */ 119 | gts_surface_foreach_vertex (s, boundary ? (GtsFunc) build_list2 : (GtsFunc) build_list1, 120 | &vertices); 121 | /* merge vertices: we MUST update the variable vertices because this function 122 | modifies the list (i.e. removes the merged vertices). */ 123 | vertices = gts_vertices_merge (vertices, threshold); 124 | 125 | /* free the list */ 126 | g_list_free (vertices); 127 | 128 | /* eliminate degenerate and duplicate edges */ 129 | edge_cleanup (s); 130 | /* eliminate duplicate triangles */ 131 | triangle_cleanup (s); 132 | 133 | if (sever) 134 | gts_surface_foreach_vertex (s, (GtsFunc) vertex_cleanup, NULL); 135 | 136 | /* if verbose on print stats */ 137 | if (verbose) { 138 | GtsBBox * bb = gts_bbox_surface (gts_bbox_class (), s); 139 | gts_surface_print_stats (s, stderr); 140 | fprintf (stderr, "# Bounding box: [%g,%g,%g] [%g,%g,%g]\n", 141 | bb->x1, bb->y1, bb->z1, 142 | bb->x2, bb->y2, bb->z2); 143 | } 144 | 145 | /* write surface */ 146 | gts_surface_write (s, stdout); 147 | 148 | return 0; /* success */ 149 | } 150 | -------------------------------------------------------------------------------- /examples/sphere.c: -------------------------------------------------------------------------------- 1 | /* GTS - Library for the manipulation of triangulated surfaces 2 | * Copyright (C) 1999 Stéphane Popinet 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Library General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Library General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Library General Public 15 | * License along with this library; if not, write to the 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 | * Boston, MA 02111-1307, USA. 18 | */ 19 | 20 | #include 21 | #include 22 | #include "config.h" 23 | #ifdef HAVE_GETOPT_H 24 | # include 25 | #endif /* HAVE_GETOPT_H */ 26 | #ifdef HAVE_UNISTD_H 27 | # include 28 | #endif /* HAVE_UNISTD_H */ 29 | #include "gts.h" 30 | 31 | /* sphere - generate a triangulated unit sphere by recursive subdivision. 32 | First approximation is an isocahedron; each level of refinement 33 | increases the number of triangles by a factor of 4. 34 | */ 35 | int main (int argc, char * argv[]) 36 | { 37 | GtsSurface * s; 38 | gboolean verbose = FALSE; 39 | guint level=4; 40 | int c = 0; 41 | 42 | if (!setlocale (LC_ALL, "POSIX")) 43 | g_warning ("cannot set locale to POSIX"); 44 | 45 | /* parse options using getopt */ 46 | while (c != EOF) { 47 | #ifdef HAVE_GETOPT_LONG 48 | static struct option long_options[] = { 49 | {"help", no_argument, NULL, 'h'}, 50 | {"verbose", no_argument, NULL, 'v'}, 51 | { NULL } 52 | }; 53 | int option_index = 0; 54 | switch ((c = getopt_long (argc, argv, "hv", 55 | long_options, &option_index))) { 56 | #else /* not HAVE_GETOPT_LONG */ 57 | switch ((c = getopt (argc, argv, "hv"))) { 58 | #endif /* not HAVE_GETOPT_LONG */ 59 | case 'v': /* verbose */ 60 | verbose = TRUE; 61 | break; 62 | case 'h': /* help */ 63 | fprintf (stderr, 64 | "Usage: sphere [OPTION] [level]\n" 65 | "Generate a triangulated unit sphere by recursive subdivision.\n" 66 | "First approximation is an isocahedron; each level of refinement\n" 67 | "increases the number of triangles by a factor of 4.\n" 68 | "level must be a positive integer setting the recursion level\n" 69 | "(geodesation order), default is 4.\n" 70 | "\n" 71 | "Documentation: http://mathworld.wolfram.com/GeodesicDome.html\n" 72 | "\n" 73 | " -v --verbose print statistics about the surface\n" 74 | " -h --help display this help and exit\n" 75 | "\n" 76 | "Reports bugs to %s\n", 77 | GTS_MAINTAINER); 78 | return 0; /* success */ 79 | break; 80 | case '?': /* wrong options */ 81 | fprintf (stderr, "Try `sphere --help' for more information.\n"); 82 | return 1; /* failure */ 83 | } 84 | } 85 | 86 | /* read level */ 87 | if (optind < argc) 88 | level = strtol (argv[optind], NULL, 0); 89 | 90 | /* generate triangulated sphere */ 91 | s = gts_surface_new (gts_surface_class (), 92 | gts_face_class (), 93 | gts_edge_class (), 94 | gts_vertex_class ()); 95 | gts_surface_generate_sphere (s, level); 96 | 97 | /* if verbose on print stats */ 98 | if (verbose) 99 | gts_surface_print_stats (s, stderr); 100 | 101 | /* write generating surface to standard output */ 102 | gts_surface_write (s, stdout); 103 | 104 | return 0; /* success */ 105 | } 106 | -------------------------------------------------------------------------------- /examples/split.c: -------------------------------------------------------------------------------- 1 | /* GTS - Library for the manipulation of triangulated surfaces 2 | * Copyright (C) 1999 Stéphane Popinet 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Library General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Library General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Library General Public 15 | * License along with this library; if not, write to the 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 | * Boston, MA 02111-1307, USA. 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | #include "config.h" 24 | #ifdef HAVE_GETOPT_H 25 | # include 26 | #endif /* HAVE_GETOPT_H */ 27 | #ifdef HAVE_UNISTD_H 28 | # include 29 | #endif /* HAVE_UNISTD_H */ 30 | #include "gts.h" 31 | 32 | /* split - splits a surface into connected and manifold components */ 33 | int main (int argc, char * argv[]) 34 | { 35 | GtsSurface * s = NULL; 36 | int c = 0; 37 | GtsFile * fp; 38 | gboolean verbose = FALSE; 39 | gchar fname[] = "component"; 40 | guint ncomp = 0; 41 | GSList * i; 42 | 43 | if (!setlocale (LC_ALL, "POSIX")) 44 | g_warning ("cannot set locale to POSIX"); 45 | 46 | /* parse options using getopt */ 47 | while (c != EOF) { 48 | #ifdef HAVE_GETOPT_LONG 49 | static struct option long_options[] = { 50 | {"help", no_argument, NULL, 'h'}, 51 | {"verbose", no_argument, NULL, 'v'}, 52 | { NULL } 53 | }; 54 | int option_index = 0; 55 | switch ((c = getopt_long (argc, argv, "hv", 56 | long_options, &option_index))) { 57 | #else /* not HAVE_GETOPT_LONG */ 58 | switch ((c = getopt (argc, argv, "hv"))) { 59 | #endif /* not HAVE_GETOPT_LONG */ 60 | case 'v': /* verbose */ 61 | verbose = TRUE; 62 | break; 63 | case 'h': /* help */ 64 | fprintf (stderr, 65 | "Usage: split [OPTION] [FNAME] < FILE\n" 66 | "Splits the GTS surface into connected and manifold components.\n" 67 | "FNAME is the base name of the components created (default is `component').\n" 68 | "\n" 69 | " -v --verbose print statistics about the surface\n" 70 | " -h --help display this help and exit\n" 71 | "\n" 72 | "Reports bugs to %s\n", 73 | GTS_MAINTAINER); 74 | return 0; /* success */ 75 | break; 76 | case '?': /* wrong options */ 77 | fprintf (stderr, "Try `split --help' for more information.\n"); 78 | return 1; /* failure */ 79 | } 80 | } 81 | 82 | if (optind < argc) 83 | strcpy (fname, argv[optind]); 84 | 85 | /* read surface in */ 86 | s = gts_surface_new (gts_surface_class (), 87 | gts_face_class (), 88 | gts_edge_class (), 89 | gts_vertex_class ()); 90 | fp = gts_file_new (stdin); 91 | if (gts_surface_read (s, fp)) { 92 | fputs ("split: file on standard input is not a valid GTS file\n", 93 | stderr); 94 | fprintf (stderr, "stdin:%d:%d: %s\n", fp->line, fp->pos, fp->error); 95 | return 1; /* failure */ 96 | } 97 | 98 | /* if verbose on print stats */ 99 | if (verbose) 100 | gts_surface_print_stats (s, stderr); 101 | 102 | i = gts_surface_split (s); 103 | while (i) { 104 | gchar name[80]; 105 | FILE * fp; 106 | 107 | sprintf (name, "%s.%d.gts", fname, ncomp++); 108 | fp = fopen (name, "wt"); 109 | if (fp == NULL) { 110 | fprintf (stderr, "split: cannot open file `%s'.\n", name); 111 | exit (1); 112 | } 113 | gts_surface_write (i->data, fp); 114 | fclose (fp); 115 | 116 | if (verbose) { 117 | fprintf (stderr, "# Component %d\n", ncomp - 1); 118 | gts_surface_print_stats (i->data, stderr); 119 | } 120 | 121 | i = i->next; 122 | } 123 | 124 | return 0; /* success */ 125 | } 126 | -------------------------------------------------------------------------------- /examples/stripe.c: -------------------------------------------------------------------------------- 1 | /* GTS - Library for the manipulation of triangulated surfaces 2 | * Copyright (C) 1999 Stéphane Popinet 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Library General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Library General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Library General Public 15 | * License along with this library; if not, write to the 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 | * Boston, MA 02111-1307, USA. 18 | */ 19 | 20 | #include 21 | #include 22 | #include "config.h" 23 | #ifdef HAVE_GETOPT_H 24 | # include 25 | #endif /* HAVE_GETOPT_H */ 26 | #ifdef HAVE_UNISTD_H 27 | # include 28 | #endif /* HAVE_UNISTD_H */ 29 | #include "gts.h" 30 | 31 | /* stripe - Turns the input surface into triangle strips and outputs a 32 | Geomview representation of the result. */ 33 | int main (int argc, char * argv[]) 34 | { 35 | GtsSurface * s; 36 | GSList * strips = NULL, * i; 37 | gboolean verbose = FALSE; 38 | int c = 0; 39 | GtsFile * fp; 40 | 41 | if (!setlocale (LC_ALL, "POSIX")) 42 | g_warning ("cannot set locale to POSIX"); 43 | 44 | /* parse options using getopt */ 45 | while (c != EOF) { 46 | #ifdef HAVE_GETOPT_LONG 47 | static struct option long_options[] = { 48 | {"help", no_argument, NULL, 'h'}, 49 | {"verbose", no_argument, NULL, 'v'}, 50 | { NULL } 51 | }; 52 | int option_index = 0; 53 | switch ((c = getopt_long (argc, argv, "hv", 54 | long_options, &option_index))) { 55 | #else /* not HAVE_GETOPT_LONG */ 56 | switch ((c = getopt (argc, argv, "hv"))) { 57 | #endif /* not HAVE_GETOPT_LONG */ 58 | case 'v': /* verbose */ 59 | verbose = TRUE; 60 | break; 61 | case 'h': /* help */ 62 | fprintf (stderr, 63 | "Usage: stripe [OPTION] < FILE\n" 64 | "Turns the input surface into triangle strips and outputs a\n" 65 | "Geomview representation of the result.\n" 66 | "\n" 67 | " -v --verbose print statistics about the surface and strips\n" 68 | " -h --help display this help and exit\n" 69 | "\n" 70 | "Report bugs to %s\n", 71 | GTS_MAINTAINER); 72 | return 0; /* success */ 73 | break; 74 | case '?': /* wrong options */ 75 | fprintf (stderr, "Try `stripe --help' for more information.\n"); 76 | return 1; /* failure */ 77 | } 78 | } 79 | 80 | /* read surface in */ 81 | s = gts_surface_new (gts_surface_class (), 82 | gts_face_class (), 83 | gts_edge_class (), 84 | gts_vertex_class ()); 85 | fp = gts_file_new (stdin); 86 | if (gts_surface_read (s, fp)) { 87 | fputs ("stripe: file on standard input is not a valid GTS file\n", 88 | stderr); 89 | fprintf (stderr, "stdin:%d:%d: %s\n", fp->line, fp->pos, fp->error); 90 | return 1; /* failure */ 91 | } 92 | gts_file_destroy (fp); 93 | 94 | if (verbose) 95 | gts_surface_print_stats (s, stderr); 96 | 97 | strips = gts_surface_strip (s); 98 | 99 | /* if verbose on print stats */ 100 | if (verbose) { 101 | GtsRange l; 102 | 103 | gts_range_init (&l); 104 | i = strips; 105 | while (i) { 106 | gts_range_add_value (&l, g_slist_length (i->data)); 107 | i = i->next; 108 | } 109 | gts_range_update (&l); 110 | fprintf (stderr, "# Strips: %d\n# length : ", l.n); 111 | gts_range_print (&l, stderr); 112 | fputc ('\n', stderr); 113 | } 114 | 115 | puts ("LIST {\n"); 116 | i = strips; 117 | while (i) { 118 | GList * j = i->data; 119 | GtsTriangle * oldt = NULL; 120 | GtsColor c; 121 | 122 | c.r = rand ()/(gdouble) RAND_MAX; 123 | c.g = rand ()/(gdouble) RAND_MAX; 124 | c.b = rand ()/(gdouble) RAND_MAX; 125 | while (j) { 126 | GtsTriangle * t = j->data; 127 | GtsPoint 128 | * p1 = GTS_POINT (GTS_SEGMENT (t->e1)->v1), 129 | * p2 = GTS_POINT (GTS_SEGMENT (t->e1)->v2), 130 | * p3 = GTS_POINT (gts_triangle_vertex (t)); 131 | 132 | printf ("OFF 3 1 3\n%g %g %g\n%g %g %g\n%g %g %g\n3 0 1 2 %g %g %g\n", 133 | p1->x, p1->y, p1->z, 134 | p2->x, p2->y, p2->z, 135 | p3->x, p3->y, p3->z, 136 | c.r, c.g, c.b); 137 | if (oldt) { 138 | GtsSegment * cs = GTS_SEGMENT (gts_triangles_common_edge (t, oldt)); 139 | GtsPoint 140 | * op1 = GTS_POINT (GTS_SEGMENT (oldt->e1)->v1), 141 | * op2 = GTS_POINT (GTS_SEGMENT (oldt->e1)->v2), 142 | * op3 = GTS_POINT (gts_triangle_vertex (oldt)); 143 | 144 | printf ("VECT 1 3 0 3 0 %g %g %g %g %g %g %g %g %g\n", 145 | (op1->x + op2->x + op3->x)/3., 146 | (op1->y + op2->y + op3->y)/3., 147 | (op1->z + op2->z + op3->z)/3., 148 | (GTS_POINT (cs->v1)->x + GTS_POINT (cs->v2)->x)/2., 149 | (GTS_POINT (cs->v1)->y + GTS_POINT (cs->v2)->y)/2., 150 | (GTS_POINT (cs->v1)->z + GTS_POINT (cs->v2)->z)/2., 151 | (p1->x + p2->x + p3->x)/3., 152 | (p1->y + p2->y + p3->y)/3., 153 | (p1->z + p2->z + p3->z)/3.); 154 | } 155 | oldt = t; 156 | j = j->next; 157 | } 158 | i = i->next; 159 | } 160 | puts ("}\n"); 161 | 162 | return 0; /* success */ 163 | } 164 | -------------------------------------------------------------------------------- /examples/volume.c: -------------------------------------------------------------------------------- 1 | /* GTS - Library for the manipulation of triangulated surfaces 2 | * Copyright (C) 1999 Stéphane Popinet 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Library General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Library General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Library General Public 15 | * License along with this library; if not, write to the 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 | * Boston, MA 02111-1307, USA. 18 | */ 19 | 20 | #include 21 | #include 22 | #include "config.h" 23 | #ifdef HAVE_GETOPT_H 24 | # include 25 | #endif /* HAVE_GETOPT_H */ 26 | #ifdef HAVE_UNISTD_H 27 | # include 28 | #endif /* HAVE_UNISTD_H */ 29 | #include "gts.h" 30 | 31 | /* volume - compute the volume of a given surface if it is a closed and 32 | orientable manifold */ 33 | int main (int argc, char * argv[]) 34 | { 35 | GtsSurface * s; 36 | gboolean verbose = FALSE; 37 | gboolean cm = FALSE; 38 | int c = 0; 39 | GtsFile * fp; 40 | 41 | if (!setlocale (LC_ALL, "POSIX")) 42 | g_warning ("cannot set locale to POSIX"); 43 | 44 | /* parse options using getopt */ 45 | while (c != EOF) { 46 | #ifdef HAVE_GETOPT_LONG 47 | static struct option long_options[] = { 48 | {"cm", no_argument, NULL, 'c'}, 49 | {"help", no_argument, NULL, 'h'}, 50 | {"verbose", no_argument, NULL, 'v'}, 51 | { NULL } 52 | }; 53 | int option_index = 0; 54 | switch ((c = getopt_long (argc, argv, "hvc", 55 | long_options, &option_index))) { 56 | #else /* not HAVE_GETOPT_LONG */ 57 | switch ((c = getopt (argc, argv, "hvc"))) { 58 | #endif /* not HAVE_GETOPT_LONG */ 59 | case 'c': /* cm */ 60 | cm = TRUE; 61 | break; 62 | case 'v': /* verbose */ 63 | verbose = TRUE; 64 | break; 65 | case 'h': /* help */ 66 | fprintf (stderr, 67 | "Usage: volume [OPTION] < file.gts\n" 68 | "Compute the volume of the domain bounded by the surface defined by file.gts.\n" 69 | "Print the volume and exit successfully if the surface is a closed orientable\n" 70 | "manifold. Exit unsuccessfully otherwise.\n" 71 | "\n" 72 | " -v --verbose print statistics about the surface\n" 73 | " -c --cm output center of mass and volume\n" 74 | " -h --help display this help and exit\n" 75 | "\n" 76 | "Reports bugs to %s\n", 77 | GTS_MAINTAINER); 78 | return 0; /* success */ 79 | break; 80 | case '?': /* wrong options */ 81 | fprintf (stderr, "Try `volume --help' for more information.\n"); 82 | return 1; /* failure */ 83 | } 84 | } 85 | 86 | /* read surface in */ 87 | s = gts_surface_new (gts_surface_class (), 88 | gts_face_class (), 89 | gts_edge_class (), 90 | gts_vertex_class ()); 91 | fp = gts_file_new (stdin); 92 | if (gts_surface_read (s, fp)) { 93 | fputs ("volume: the file on standard input is not a valid GTS file\n", 94 | stderr); 95 | fprintf (stderr, "stdin:%d:%d: %s\n", fp->line, fp->pos, fp->error); 96 | return 1; /* failure */ 97 | } 98 | 99 | /* if verbose on print stats */ 100 | if (verbose) { 101 | gts_surface_print_stats (s, stdout); 102 | printf ("# Total area: %g\n", gts_surface_area (s)); 103 | } 104 | 105 | /* test if surface is a closed and orientable manifold. 106 | we don't need to test if s is a manifold since both tests below 107 | implies that. */ 108 | if (!gts_surface_is_closed (s) || !gts_surface_is_orientable (s)) 109 | return 1; /* failure */ 110 | 111 | /* print volume */ 112 | printf ("%g\n", gts_surface_volume (s)); 113 | 114 | if (cm) { 115 | GtsVector cm; 116 | 117 | /* print center of mass */ 118 | gts_surface_center_of_mass (s, cm); 119 | printf ("(%g,%g,%g)\n", cm[0], cm[1], cm[2]); 120 | } 121 | 122 | return 0; /* success */ 123 | } 124 | -------------------------------------------------------------------------------- /gts.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: GTS 7 | Description: GNU Triangulated Surface Library 8 | Version: @VERSION@ 9 | Requires: glib-2.0,gthread-2.0,gmodule-2.0 10 | Libs: -L${libdir} @LIBS@ -lgts -lm 11 | Cflags: -I${includedir} 12 | -------------------------------------------------------------------------------- /rpm/gts.spec: -------------------------------------------------------------------------------- 1 | %define alphatag %(date +%Y%m%d) 2 | %define current %(pkg-config gts --modversion --silence-errors) 3 | 4 | Summary: GNU Triangulated Surface Library (development snapshot) 5 | Name: gts-snapshot 6 | %if "%{current}" == "" 7 | Version: 0.7.6 8 | %else 9 | Version: %{current} 10 | %endif 11 | Release: 8.%{alphatag}cvs%{?dist} 12 | License: GPLv2 13 | %if 0%{?suse_version} 14 | Group: Productivity/Scientific/Other 15 | %else 16 | Group: Applications/Engineering 17 | %endif 18 | URL: http://gts.sourceforge.net 19 | Packager: Matthieu Castellazzi 20 | Source0: gts-snapshot.tar.gz 21 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 22 | 23 | %if 0%{?suse_version} 24 | Requires: libnetpbm 25 | BuildRequires: gtkdoc >= 1.3-4, sgml-skel, netpbm 26 | %if 0%{?suse_version} >= 1110 27 | BuildRequires: libnetpbm-devel 28 | %endif 29 | %else 30 | Requires: netpbm 31 | BuildRequires: gtk-doc >= 1.3-4, netpbm-devel 32 | %endif 33 | 34 | # For both distros 35 | Requires: glib2 36 | BuildRequires: glib2-devel 37 | 38 | %package devel 39 | Summary: Development files for gts 40 | %if 0%{?suse_version} 41 | Group: Productivity/Scientific/Other 42 | %else 43 | Group: Applications/Engineering 44 | %endif 45 | Requires: glib2-devel 46 | Requires: %{name} = %{version}-%{release} 47 | 48 | %package doc 49 | Summary: Documentation for GTS (development snapshot) 50 | %if 0%{?suse_version} 51 | Group: Productivity/Scientific/Other 52 | %else 53 | Group: Applications/Engineering 54 | %endif 55 | Requires: lynx 56 | 57 | %description 58 | GTS includes a number of useful functions to deal with triangulated 59 | surfaces including, but not limited to, multi-resolution models, 60 | Delaunay and Constrained Delaunay triangulations, set operations on 61 | surfaces (intersection, union etc ...), bounding-boxes trees for 62 | efficient collision and intersection detection, triangle strips and 63 | binary heaps. 64 | 65 | %description devel 66 | This package contains the gts header files and libs. 67 | 68 | %description doc 69 | This package contains the GTS Reference, in HTML format. 70 | 71 | 72 | %prep 73 | %setup -q -n gts-snapshot 74 | 75 | %build 76 | RPM_OPT_FLAGS="$RPM_OPT_FLAGS -fPIC -DPIC" 77 | if [ -x ./configure ]; then 78 | CFLAGS="$RPM_OPT_FLAGS" ./configure \ 79 | --prefix=%{_prefix} \ 80 | --disable-dependency-tracking \ 81 | --libdir=%{_prefix}/%_lib \ 82 | --mandir=%{_mandir} \ 83 | --disable-static 84 | else 85 | CFLAGS="$RPM_OPT_FLAGS" sh autogen.sh \ 86 | --prefix=%{_prefix} \ 87 | --disable-dependency-tracking \ 88 | --libdir=%{_prefix}/%_lib \ 89 | --mandir=%{_mandir} \ 90 | --disable-static 91 | fi 92 | 93 | %{__make} 94 | %{__make} -C doc scan templates sgml html 95 | 96 | 97 | %install 98 | rm -rf $RPM_BUILD_ROOT 99 | mkdir $RPM_BUILD_ROOT 100 | make install DESTDIR=$RPM_BUILD_ROOT 101 | 102 | # Fedora compatible changes, won't hurt SuSE 103 | mv -f $RPM_BUILD_ROOT%{_bindir}/delaunay $RPM_BUILD_ROOT%{_bindir}/gtsdelaunay 104 | mv -f $RPM_BUILD_ROOT%{_bindir}/happrox $RPM_BUILD_ROOT%{_bindir}/gtshapprox 105 | mv -f $RPM_BUILD_ROOT%{_bindir}/transform $RPM_BUILD_ROOT%{_bindir}/gtstransform 106 | 107 | # Comply shared library policy 108 | find $RPM_BUILD_ROOT -name *.la -exec rm -f {} \; 109 | 110 | # Comply static build policy 111 | find $RPM_BUILD_ROOT -name *.a -exec rm -f {} \; 112 | 113 | 114 | %clean 115 | rm -rf $RPM_BUILD_ROOT 116 | 117 | 118 | %post -p /sbin/ldconfig 119 | 120 | 121 | %postun -p /sbin/ldconfig 122 | 123 | 124 | %files 125 | %defattr(-,root,root) 126 | %doc COPYING NEWS README TODO 127 | %{_bindir}/gtsdelaunay 128 | %{_bindir}/gts2dxf 129 | %{_bindir}/gts2oogl 130 | %{_bindir}/gts2stl 131 | %{_bindir}/gtscheck 132 | %{_bindir}/gtscompare 133 | %{_bindir}/gtstemplate 134 | %{_bindir}/gtshapprox 135 | %{_bindir}/stl2gts 136 | %{_bindir}/gtstransform 137 | %{_libdir}/*.so.* 138 | %{_mandir}/man1/*.1.* 139 | 140 | %files devel 141 | %defattr(-,root,root) 142 | %doc COPYING 143 | %{_bindir}/gts-config 144 | %{_includedir}/*.h 145 | %{_libdir}/*.so 146 | %{_libdir}/pkgconfig/*.pc 147 | %{_datadir}/aclocal/*.m4 148 | 149 | %files doc 150 | %defattr(-,root,root) 151 | %doc COPYING doc/html/*.html 152 | 153 | %changelog 154 | * Tue Nov 03 2009 Matthieu Castellazzi - 8 155 | - first attempt to use buildservice for gerris 156 | - add sgml-skel and libnetpbm dependencies for the build 157 | - add --silence-errors options to define %current 158 | 159 | * Wed Jul 16 2008 Ivan Adam Vari - 7 160 | - Some minor changes found in debian packages 161 | 162 | * Thu Jul 3 2008 Ivan Adam Vari - 6 163 | - Fixed typo in %files section (attr) 164 | - Fixed typo for FC build requirement gtk-doc 165 | 166 | * Thu May 15 2008 Ivan Adam Vari - 5 167 | - Added fedora 8 support for x86 (32bit only) 168 | - Added doc package 169 | - Removed libtool config files to comply with shared 170 | library policy 171 | - Removed static build bits to comply with shared 172 | library policy 173 | - Fixed dependencies 174 | 175 | * Mon Jan 7 2008 Ivan Adam Vari - 4 176 | - Removed %{?_smp_mflags} from make due to intermittent 177 | build errors on some SMP systems 178 | 179 | * Wed Dec 19 2007 Ivan Adam Vari - 3 180 | - Fixed creating RPM_BUILD_ROOT issue on some systems 181 | - Fixed package (install) dependencies 182 | 183 | * Fri Sep 28 2007 Ivan Adam Vari - 2 184 | - Added SLEx/SuSE compatibility 185 | - Added 64bit compatibility 186 | - Removed --disable-static flag 187 | 188 | * Tue May 1 2007 Ivan Adam Vari - 1 189 | - Initial rpm release based on Fedora/Redhat Linux 190 | -------------------------------------------------------------------------------- /src/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to produce Makefile.in 2 | 3 | INCLUDES = -I$(top_srcdir) -I$(includedir) -DG_LOG_DOMAIN=\"Gts\" 4 | 5 | bin_SCRIPTS=gts-config 6 | 7 | BUILT_SOURCES= \ 8 | gts-config \ 9 | predicates_init.h 10 | 11 | gts-config: gts-config.in 12 | 13 | lib_LTLIBRARIES = libgts.la 14 | 15 | libgts_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)\ 16 | -release $(LT_RELEASE) -export-dynamic -lm 17 | 18 | libgts_la_DEPENDENCIES = \ 19 | predicates_init.h 20 | 21 | libgts_la_SOURCES = \ 22 | predicates_init.h \ 23 | object.c \ 24 | exception.c \ 25 | point.c \ 26 | vertex.c \ 27 | segment.c \ 28 | edge.c \ 29 | triangle.c \ 30 | face.c \ 31 | kdtree.c \ 32 | bbtree.c \ 33 | misc.c \ 34 | gts.h \ 35 | gts-private.h \ 36 | cexcept.h \ 37 | predicates.c \ 38 | predicates.h \ 39 | rounding.h \ 40 | heap.c \ 41 | eheap.c \ 42 | fifo.c \ 43 | matrix.c \ 44 | surface.c \ 45 | stripe.c \ 46 | vopt.c \ 47 | refine.c \ 48 | iso.c \ 49 | isotetra.c \ 50 | split.c \ 51 | psurface.c \ 52 | hsurface.c \ 53 | cdt.c \ 54 | boolean.c \ 55 | named.c \ 56 | oocs.c \ 57 | container.c \ 58 | graph.c \ 59 | pgraph.c \ 60 | partition.c \ 61 | curvature.c \ 62 | tribox3.c 63 | 64 | include_HEADERS = \ 65 | gts.h gtsconfig.h cexcept.h 66 | 67 | predicates.o: predicates.c predicates_init.h predicates.h 68 | $(COMPILE) -c $(srcdir)/predicates.c 69 | 70 | predicates_init: predicates_init.c rounding.h 71 | $(COMPILE) $(srcdir)/predicates_init.c -o $(srcdir)/predicates_init 72 | 73 | predicates_init.h: predicates_init 74 | ./predicates_init > $(srcdir)/predicates_init.h 75 | 76 | CLEANFILES = $(BUILT_SOURCES) 77 | 78 | gts.def: libgts.la .libs/libgts.a 79 | nm -g .libs/libgts.a | awk 'BEGIN{print "EXPORTS"}{if ($$2 == "T" || $$2 == "D" || $$2 == "B") print " " $$3}' > gts.def 80 | 81 | EXTRA_DIST = \ 82 | predicates_init.c \ 83 | gts.m4 \ 84 | makefile.msc \ 85 | config.h.win32 \ 86 | gts.def \ 87 | NOTES 88 | 89 | dist-hook: gts.def 90 | cd $(distdir); rm -f $(BUILT_SOURCES) 91 | 92 | m4datadir = $(datadir)/aclocal 93 | m4data_DATA = gts.m4 94 | -------------------------------------------------------------------------------- /src/NOTES: -------------------------------------------------------------------------------- 1 | - hsurface may create surfaces with duplicates edges and triangles (because of 2 | collapses of "empty triangles"). 3 | - psurface however will not. 4 | -------------------------------------------------------------------------------- /src/config.h.win32: -------------------------------------------------------------------------------- 1 | /* config.h.win32: Handcrafted for Microsoft C */ 2 | 3 | /* Define if you need to in order for stat and other things to work. */ 4 | /* #undef _POSIX_SOURCE */ 5 | 6 | /* Define if you have the ANSI C header files. */ 7 | #define STDC_HEADERS 1 8 | 9 | #define GTS_MAJOR_VERSION 0 10 | #define GTS_MINOR_VERSION 6 11 | #define GTS_MICRO_VERSION 0 12 | #define GTS_INTERFACE_AGE 0 13 | #define GTS_BINARY_AGE 0 14 | 15 | /* Define if you have the header file. */ 16 | /* #undef HAVE_FLOATINGPOINT_H */ 17 | 18 | /* Define if you have the header file. */ 19 | /* #undef HAVE_FPU_CONTROL_H */ 20 | 21 | /* Define if this is Win32, possibly using the Cygwin emulation layer. */ 22 | #define WIN32 1 23 | 24 | /* Define if this is Win32 without Cygwin. */ 25 | #define NATIVE_WIN32 1 26 | 27 | #ifndef M_PI 28 | # define M_PI 3.14159265359 29 | #endif /* not M_PI */ 30 | -------------------------------------------------------------------------------- /src/exception.c: -------------------------------------------------------------------------------- 1 | /* GTS - Library for the manipulation of triangulated surfaces 2 | * Copyright (C) 2010 Luis Saavedra 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Library General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Library General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Library General Public 15 | * License along with this library; if not, write to the 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 | * Boston, MA 02111-1307, USA. 18 | */ 19 | 20 | /** 21 | * SECTION: exception 22 | * @short_description: Simple try/catch/throw exception-handling 23 | * interface 24 | * @title: Exception Handling 25 | * @section_id: 26 | * @see_also: 27 | * @stability: Inestable 28 | * @include: 29 | * @Image: 30 | * 31 | */ 32 | 33 | #include "gts.h" 34 | 35 | struct exception_context the_exception_context[1]; 36 | 37 | static void exception_destroy (GtsObject * object) 38 | { 39 | GtsException * e = GTS_EXCEPTION (object); 40 | 41 | g_free (e->message); e->message = NULL; 42 | 43 | (* GTS_OBJECT_CLASS (gts_exception_class ())->parent_class->destroy) (object); 44 | } 45 | 46 | static void exception_class_init (GtsExceptionClass * klass) 47 | { 48 | GTS_OBJECT_CLASS (klass)->destroy = exception_destroy; 49 | } 50 | 51 | static void exception_init (GtsException * e) 52 | { 53 | e->message = NULL; 54 | } 55 | 56 | /** 57 | * gts_exception_class: 58 | * 59 | * Returns: the #GtsExceptionClass. 60 | */ 61 | GtsExceptionClass * gts_exception_class (void) 62 | { 63 | static GtsExceptionClass * klass = NULL; 64 | 65 | if (klass == NULL) { 66 | GtsObjectClassInfo exception_info = { 67 | "GtsException", 68 | sizeof (GtsException), 69 | sizeof (GtsExceptionClass), 70 | (GtsObjectClassInitFunc) exception_class_init, 71 | (GtsObjectInitFunc) exception_init, 72 | (GtsArgSetFunc) NULL, 73 | (GtsArgGetFunc) NULL 74 | }; 75 | klass = gts_object_class_new (gts_object_class (), 76 | &exception_info); 77 | } 78 | 79 | return klass; 80 | } 81 | 82 | /** 83 | * gts_exception_new_full: 84 | * @klass: a #GtsExceptionClass. 85 | * @error: a #GtsExceptionError. 86 | * @format: a standard printf() format string for the 87 | * explanation of the error. 88 | * @...: the arguments to insert in the explanation of 89 | * the error. 90 | * 91 | * Returns: a new #GtsException. 92 | */ 93 | GtsException * gts_exception_new_full (GtsExceptionClass * klass, 94 | GtsExceptionError error, 95 | gchar const * format, ...) 96 | { 97 | GtsException * e; 98 | 99 | e = GTS_EXCEPTION (gts_object_new (GTS_OBJECT_CLASS (klass))); 100 | e->error = error; 101 | 102 | va_list argp; 103 | 104 | va_start (argp, format); 105 | gint length = g_vsnprintf (NULL, 0, format, argp); 106 | va_end (argp); 107 | 108 | e->message = g_malloc_n (length+1, sizeof(gchar)); 109 | 110 | va_start (argp, format); 111 | g_vsnprintf (e->message, length+1, format, argp); 112 | va_end (argp); 113 | 114 | return e; 115 | } 116 | 117 | /** 118 | * gts_exception_set_message: 119 | * @e: a #GtsException. 120 | * @format: a standard printf() format string for the 121 | * explanation of the error. 122 | * @...: the arguments to set in the explanation of 123 | * the error. 124 | * 125 | * Returns: the new number of bytes in the explanation of error. 126 | */ 127 | gint gts_exception_set_message (GtsException * e, gchar const * format, ...) 128 | { 129 | va_list argp; 130 | 131 | va_start (argp, format); 132 | gint length = g_vsnprintf (NULL, 0, format, argp); 133 | va_end (argp); 134 | 135 | gchar * new_message = g_malloc_n (length+1, sizeof(gchar)); 136 | 137 | va_start (argp, format); 138 | g_vsnprintf (new_message, length+1, format, argp); 139 | va_end (argp); 140 | 141 | g_free (e->message); 142 | e->message = new_message; 143 | 144 | return length; 145 | } 146 | -------------------------------------------------------------------------------- /src/fifo.c: -------------------------------------------------------------------------------- 1 | /* GTS - Library for the manipulation of triangulated surfaces 2 | * Copyright (C) 1999 Stéphane Popinet 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Library General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Library General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Library General Public 15 | * License along with this library; if not, write to the 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 | * Boston, MA 02111-1307, USA. 18 | */ 19 | 20 | #include "gts.h" 21 | 22 | struct _GtsFifo { 23 | GList * head; 24 | GList * tail; 25 | }; 26 | 27 | /** 28 | * gts_fifo_new: 29 | * 30 | * Returns: a new #GtsFifo. 31 | */ 32 | GtsFifo * gts_fifo_new () 33 | { 34 | GtsFifo * fifo = g_malloc (sizeof (GtsFifo)); 35 | 36 | fifo->head = fifo->tail = NULL; 37 | return fifo; 38 | } 39 | 40 | /** 41 | * gts_fifo_write: 42 | * @fifo: a #GtsFifo. 43 | * @fp: a file pointer. 44 | * 45 | * Writes the content of @fifo in @fp. 46 | */ 47 | void gts_fifo_write (GtsFifo * fifo, FILE * fp) 48 | { 49 | GList * i; 50 | 51 | g_return_if_fail (fifo != NULL); 52 | g_return_if_fail (fp != NULL); 53 | 54 | fprintf (fp, "["); 55 | i = fifo->head; 56 | while (i) { 57 | fprintf (fp, "%p ", i->data); 58 | i = i->next; 59 | } 60 | fprintf (fp, "]"); 61 | } 62 | 63 | /** 64 | * gts_fifo_push: 65 | * @fifo: a #GtsFifo. 66 | * @data: data to add to @fifo. 67 | * 68 | * Push @data into @fifo. 69 | */ 70 | void gts_fifo_push (GtsFifo * fifo, gpointer data) 71 | { 72 | g_return_if_fail (fifo != NULL); 73 | 74 | fifo->head = g_list_prepend (fifo->head, data); 75 | if (fifo->tail == NULL) 76 | fifo->tail = fifo->head; 77 | } 78 | 79 | /** 80 | * gts_fifo_pop: 81 | * @fifo: a #GtsFifo. 82 | * 83 | * Removes the first element from @fifo. 84 | * 85 | * Returns: the first element in @fifo or %NULL if @fifo is empty. 86 | */ 87 | gpointer gts_fifo_pop (GtsFifo * fifo) 88 | { 89 | gpointer data; 90 | GList * tail; 91 | 92 | g_return_val_if_fail (fifo != NULL, NULL); 93 | 94 | if (fifo->tail == NULL) 95 | return NULL; 96 | tail = fifo->tail->prev; 97 | data = fifo->tail->data; 98 | fifo->head = g_list_remove_link (fifo->head, fifo->tail); 99 | g_list_free_1 (fifo->tail); 100 | fifo->tail = tail; 101 | return data; 102 | } 103 | 104 | /** 105 | * gts_fifo_top: 106 | * @fifo: a #GtsFifo. 107 | * 108 | * Returns: the first element in @fifo or %NULL if @fifo is empty. 109 | */ 110 | gpointer gts_fifo_top (GtsFifo * fifo) 111 | { 112 | g_return_val_if_fail (fifo != NULL, NULL); 113 | 114 | if (fifo->tail == NULL) 115 | return NULL; 116 | return fifo->tail->data; 117 | } 118 | 119 | /** 120 | * gts_fifo_size: 121 | * @fifo: a #GtsFifo. 122 | * 123 | * Returns: the number of elements in @fifo. 124 | */ 125 | guint gts_fifo_size (GtsFifo * fifo) 126 | { 127 | g_return_val_if_fail (fifo != NULL, 0); 128 | 129 | return g_list_length (fifo->head); 130 | } 131 | 132 | /** 133 | * gts_fifo_destroy: 134 | * @fifo: a #GtsFifo. 135 | * 136 | * Frees all the memory allocated for @fifo. 137 | */ 138 | void gts_fifo_destroy (GtsFifo * fifo) 139 | { 140 | g_return_if_fail (fifo != NULL); 141 | g_list_free (fifo->head); 142 | g_free (fifo); 143 | } 144 | 145 | /** 146 | * gts_fifo_is_empty: 147 | * @fifo: a #GtsFifo. 148 | * 149 | * Returns: %TRUE if @fifo is empty, %FALSE otherwise. 150 | */ 151 | gboolean gts_fifo_is_empty (GtsFifo * fifo) 152 | { 153 | g_return_val_if_fail (fifo != NULL, TRUE); 154 | 155 | return (fifo->head == NULL); 156 | } 157 | 158 | /** 159 | * gts_fifo_foreach: 160 | * @fifo: a #GtsFifo. 161 | * @func: a #GtsFunc. 162 | * @data: user data to be passed to @func. 163 | * 164 | * Calls @func in order for each item in @fifo, passing @data. 165 | */ 166 | void gts_fifo_foreach (GtsFifo * fifo, GtsFunc func, gpointer data) 167 | { 168 | GList * i; 169 | 170 | g_return_if_fail (fifo != NULL); 171 | g_return_if_fail (func != NULL); 172 | 173 | i = fifo->tail; 174 | while (i) { 175 | (* func) (i->data, data); 176 | i = i->prev; 177 | } 178 | } 179 | 180 | /** 181 | * gts_fifo_reverse: 182 | * @fifo: a #GtsFifo. 183 | * 184 | * Reverses the order of elements in @fifo. 185 | */ 186 | void gts_fifo_reverse (GtsFifo * fifo) 187 | { 188 | g_return_if_fail (fifo != NULL); 189 | 190 | fifo->tail = fifo->head; 191 | fifo->head = g_list_reverse (fifo->head); 192 | } 193 | -------------------------------------------------------------------------------- /src/gts-config.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | glib_libs="@glib_libs@" 4 | glib_cflags="@glib_cflags@" 5 | glib_thread_libs="@glib_thread_libs@" 6 | glib_thread_cflags="@glib_thread_cflags@" 7 | glib_module_libs="@glib_module_libs@" 8 | glib_module_cflags="@glib_module_cflags@" 9 | 10 | prefix=@prefix@ 11 | exec_prefix=@exec_prefix@ 12 | exec_prefix_set=no 13 | 14 | usage() 15 | { 16 | cat <&2 49 | fi 50 | 51 | while test $# -gt 0; do 52 | case "$1" in 53 | -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; 54 | *) optarg= ;; 55 | esac 56 | 57 | case $1 in 58 | --prefix=*) 59 | prefix=$optarg 60 | if test $exec_prefix_set = no ; then 61 | exec_prefix=$optarg 62 | fi 63 | ;; 64 | --prefix) 65 | echo_prefix=yes 66 | ;; 67 | --exec-prefix=*) 68 | exec_prefix=$optarg 69 | exec_prefix_set=yes 70 | ;; 71 | --exec-prefix) 72 | echo_exec_prefix=yes 73 | ;; 74 | --version) 75 | echo @GTS_VERSION@ 76 | exit 0 77 | ;; 78 | --cflags) 79 | echo_cflags=yes 80 | ;; 81 | --libs) 82 | echo_libs=yes 83 | ;; 84 | --check) 85 | echo_check=yes 86 | ;; 87 | gts) 88 | lib_gts=yes 89 | ;; 90 | gmodule) 91 | lib_gmodule=yes 92 | ;; 93 | gthread) 94 | lib_gthread=yes 95 | ;; 96 | *) 97 | usage 1 1>&2 98 | ;; 99 | esac 100 | shift 101 | done 102 | 103 | if test "$echo_prefix" = "yes"; then 104 | echo $prefix 105 | fi 106 | if test "$echo_exec_prefix" = "yes"; then 107 | echo $exec_prefix 108 | fi 109 | if test "$echo_cflags" = "yes"; then 110 | if test "$lib_gmodule" = "yes"; then 111 | glib_cflags="$glib_cflags $glib_module_cflags" 112 | fi 113 | if test "$lib_gthread" = "yes"; then 114 | glib_cflags="$glib_cflags $glib_thread_cflags" 115 | fi 116 | glib_cflags="$glib_cflags -I${prefix}/include" 117 | glib_cflags=`uniquify "$glib_cflags"` 118 | if test "$echo_check" = "yes"; then 119 | echo -DGTS_CHECK_CASTS $glib_cflags 120 | else 121 | echo $glib_cflags 122 | fi 123 | fi 124 | if test "$echo_libs" = "yes"; then 125 | if test "$lib_gmodule" = "yes"; then 126 | glib_libs="$glib_libs $glib_module_libs" 127 | fi 128 | if test "$lib_gthread" = "yes"; then 129 | glib_libs="$glib_libs $glib_thread_libs" 130 | fi 131 | glib_libs="-L${exec_prefix}/lib -lgts $glib_libs -lm" 132 | glib_libs=`uniquify "$glib_libs"` 133 | echo $glib_libs 134 | fi 135 | -------------------------------------------------------------------------------- /src/gts-private.h: -------------------------------------------------------------------------------- 1 | /* GTS - Library for the manipulation of triangulated surfaces 2 | * Copyright (C) 1999 Stéphane Popinet 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Library General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Library General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Library General Public 15 | * License along with this library; if not, write to the 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 | * Boston, MA 02111-1307, USA. 18 | */ 19 | 20 | #ifndef __GTS_PRIVATE_H__ 21 | #define __GTS_PRIVATE_H__ 22 | 23 | /* Debugging flags */ 24 | 25 | /* #define DEBUG_FUNCTIONS */ 26 | 27 | #ifdef DEBUG_FUNCTIONS 28 | /* #define DEBUG_LEAKS */ 29 | #define DEBUG_IDENTITY 30 | guint id (gpointer p); 31 | void id_insert (gpointer p); 32 | void id_remove (gpointer p); 33 | void gts_write_triangle (GtsTriangle * t, GtsPoint * o, FILE * fptr); 34 | void gts_write_segment (GtsSegment * s, GtsPoint * o, FILE * fptr); 35 | #endif /* DEBUG_FUNCTIONS */ 36 | 37 | #endif /* __GTS_PRIVATE_H__ */ 38 | -------------------------------------------------------------------------------- /src/kdtree.c: -------------------------------------------------------------------------------- 1 | /* GTS - Library for the manipulation of triangulated surfaces 2 | * Copyright (C) 1999 Stéphane Popinet 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Library General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Library General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Library General Public 15 | * License along with this library; if not, write to the 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 | * Boston, MA 02111-1307, USA. 18 | */ 19 | 20 | /** 21 | * SECTION: kd-Trees 22 | * @short_description: an efficient way of doing point location queries. 23 | * @title: Kd-Trees 24 | * @section_id: 25 | * @see_also: 26 | * @stability: Stable 27 | * @include: 28 | * @Image: 29 | * 30 | * Kd-Trees (in this case 3D-Trees) are a relatively efficient way of 31 | * doing point location queries. 32 | */ 33 | 34 | #include 35 | #include "gts.h" 36 | 37 | 38 | static int compare_x (const void * p1, const void * p2) { 39 | GtsPoint 40 | * pp1 = *((gpointer *) p1), 41 | * pp2 = *((gpointer *) p2); 42 | if (pp1->x > pp2->x) 43 | return 1; 44 | return -1; 45 | } 46 | 47 | static int compare_y (const void * p1, const void * p2) { 48 | GtsPoint 49 | * pp1 = *((gpointer *) p1), 50 | * pp2 = *((gpointer *) p2); 51 | if (pp1->y > pp2->y) 52 | return 1; 53 | return -1; 54 | } 55 | 56 | static int compare_z (const void * p1, const void * p2) { 57 | GtsPoint 58 | * pp1 = *((gpointer *) p1), 59 | * pp2 = *((gpointer *) p2); 60 | if (pp1->z > pp2->z) 61 | return 1; 62 | return -1; 63 | } 64 | 65 | /** 66 | * gts_kdtree_new: 67 | * @points: an array of #GtsPoint. 68 | * @compare: always %NULL. 69 | * 70 | * Note that the order of the points in array @points is modified by this 71 | * function. 72 | * 73 | * Returns: a new 3D tree for @points. 74 | */ 75 | GNode * gts_kdtree_new (GPtrArray * points, 76 | int (*compare) (const void *, const void *)) 77 | { 78 | guint middle; 79 | GPtrArray array; 80 | GNode * node; 81 | GtsPoint * point; 82 | 83 | g_return_val_if_fail (points != NULL, NULL); 84 | g_return_val_if_fail (points->len > 0, NULL); 85 | 86 | /* sort the points */ 87 | if (compare == compare_x) compare = compare_y; 88 | else if (compare == compare_y) compare = compare_z; 89 | else compare = compare_x; 90 | qsort (points->pdata, points->len, sizeof (gpointer), compare); 91 | 92 | middle = (points->len - 1)/2; 93 | point = points->pdata[middle]; 94 | node = g_node_new (point); 95 | 96 | if (points->len > 1) { 97 | array.len = middle; 98 | if (array.len > 0) { 99 | array.pdata = points->pdata; 100 | g_node_prepend (node, gts_kdtree_new (&array, compare)); 101 | } 102 | else 103 | g_node_prepend (node, g_node_new (NULL)); 104 | 105 | array.len = points->len - middle - 1; 106 | if (array.len > 0) { 107 | array.pdata = &(points->pdata[middle + 1]); 108 | g_node_prepend (node, gts_kdtree_new (&array, compare)); 109 | } 110 | else 111 | g_node_prepend (node, g_node_new (NULL)); 112 | } 113 | 114 | return node; 115 | } 116 | 117 | /** 118 | * gts_kdtree_range: 119 | * @tree: a 3D tree. 120 | * @bbox: a #GtsBBox. 121 | * @compare: always %NULL. 122 | * 123 | * Returns: a list of #GtsPoint belonging to @tree which are inside @bbox. 124 | */ 125 | GSList * gts_kdtree_range (GNode * tree_3d, 126 | GtsBBox * bbox, 127 | int (*compare) (const void *, const void *)) 128 | { 129 | GSList * list = NULL; 130 | GtsPoint * p; 131 | gdouble left, right, v; 132 | GNode * node; 133 | 134 | g_return_val_if_fail (tree_3d != NULL, NULL); 135 | g_return_val_if_fail (bbox != NULL, NULL); 136 | 137 | p = tree_3d->data; 138 | if (p == NULL) 139 | return NULL; 140 | 141 | if (gts_bbox_point_is_inside (bbox, p)) 142 | list = g_slist_prepend (list, p); 143 | 144 | if (compare == compare_x) { 145 | left = bbox->y1; right = bbox->y2; v = p->y; 146 | compare = compare_y; 147 | } 148 | else if (compare == compare_y) { 149 | left = bbox->z1; right = bbox->z2; v = p->z; 150 | compare = compare_z; 151 | } 152 | else { 153 | left = bbox->x1; right = bbox->x2; v = p->x; 154 | compare = compare_x; 155 | } 156 | 157 | if ((node = tree_3d->children)) { 158 | if (right >= v) 159 | list = g_slist_concat (list, gts_kdtree_range (node, bbox, compare)); 160 | node = node->next; 161 | if (left <= v) 162 | list = g_slist_concat (list, gts_kdtree_range (node, bbox, compare)); 163 | } 164 | return list; 165 | } 166 | 167 | -------------------------------------------------------------------------------- /src/leak.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | awk 'BEGIN{FS=" |\t|-|>"} 4 | { 5 | if ($1 == "new") 6 | new[$3] = $2; 7 | else if ($1 == "destroy") { 8 | if (new[$3] != $2) 9 | print "ALERT: destroying $2 $3 allocated as new[$3]" > "dev/stderr"; 10 | delete new[$3]; 11 | } 12 | } 13 | END { 14 | for (i in new) 15 | print new[i] " " i; 16 | }' 17 | -------------------------------------------------------------------------------- /src/makefile.msc: -------------------------------------------------------------------------------- 1 | ## Makefile for building the gts dlls with Microsoft C 2 | ## Modified by M J Loehr from GLIB makefile.msc 3 | ## Use: nmake -f makefile.msc install 4 | 5 | # Change this to wherever you want to install the DLLs. This directory 6 | # should be in your PATH. 7 | BIN = C:\bin 8 | 9 | ################################################################ 10 | 11 | # Nothing much configurable below 12 | 13 | # No general LDFLAGS needed 14 | LDFLAGS = /link 15 | INSTALL = copy 16 | CP = copy 17 | RM = del 18 | CC = cl 19 | 20 | GTS_VER = 0.7 21 | 22 | CFLAGS = -I. -DHAVE_CONFIG_H -G5 -GF -Ox -W3 -MD -nologo 23 | 24 | all : \ 25 | config.h \ 26 | gts-$(GTS_VER).dll 27 | 28 | install : all 29 | $(INSTALL) gts-$(GTS_VER).dll $(BIN) 30 | 31 | gts_OBJECTS = \ 32 | object.obj \ 33 | point.obj \ 34 | vertex.obj \ 35 | segment.obj \ 36 | edge.obj \ 37 | triangle.obj \ 38 | face.obj \ 39 | kdtree.obj \ 40 | bbtree.obj \ 41 | misc.obj \ 42 | predicates.obj \ 43 | heap.obj \ 44 | eheap.obj \ 45 | fifo.obj \ 46 | matrix.obj \ 47 | surface.obj \ 48 | stripe.obj \ 49 | vopt.obj \ 50 | refine.obj \ 51 | iso.obj \ 52 | split.obj \ 53 | psurface.obj \ 54 | hsurface.obj \ 55 | cdt.obj \ 56 | boolean.obj \ 57 | named.obj \ 58 | oocs.obj \ 59 | container.obj \ 60 | graph.obj \ 61 | pgraph.obj \ 62 | partition.obj \ 63 | isotetra.obj \ 64 | curvature.obj 65 | 66 | gts-$(GTS_VER).dll : $(gts_OBJECTS) gts.def 67 | $(CC) $(CFLAGS) -LD -Fegts-$(GTS_VER).dll $(gts_OBJECTS) glib-1.3.lib user32.lib advapi32.lib wsock32.lib $(LDFLAGS) /def:gts.def 68 | 69 | config.h: config.h.win32 70 | $(CP) config.h.win32 config.h 71 | 72 | predicates.obj: predicates.c predicates_init.h predicates.h 73 | $(CC) $(CFLAGS) -GD -c -DGTS_COMPILATION -DG_LOG_DOMAIN=\"Gts\" predicates.c 74 | 75 | predicates_init.h: predicates_init 76 | predicates_init > predicates_init.h 77 | 78 | predicates_init: predicates_init.c 79 | $(CC) $(CFLAGS) predicates_init.c -o predicates_init 80 | 81 | .c.obj: 82 | $(CC) $(CFLAGS) -GD -c -DGTS_COMPILATION -DG_LOG_DOMAIN=\"Gts\" $< 83 | 84 | clean: 85 | $(RM) config.h 86 | $(RM) *.obj 87 | $(RM) *.dll 88 | $(RM) *.lib 89 | $(RM) *.err 90 | $(RM) *.map 91 | $(RM) *.sym 92 | $(RM) *.exp 93 | $(RM) *.lk1 94 | $(RM) *.mk1 95 | $(RM) *.pdb 96 | $(RM) *.ilk 97 | -------------------------------------------------------------------------------- /src/named.c: -------------------------------------------------------------------------------- 1 | /* GTS - Library for the manipulation of triangulated surfaces 2 | * Copyright (C) 1999 Stéphane Popinet 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Library General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Library General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Library General Public 15 | * License along with this library; if not, write to the 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 | * Boston, MA 02111-1307, USA. 18 | */ 19 | 20 | #include 21 | #include "gts.h" 22 | 23 | static void nvertex_read (GtsObject ** po, GtsFile * fp) 24 | { 25 | if ((*po)->klass->parent_class->read) 26 | (* (*po)->klass->parent_class->read) (po, fp); 27 | 28 | if (fp->type != '\n' && fp->type != GTS_ERROR) { 29 | strncpy (GTS_NVERTEX (*po)->name, fp->token->str, GTS_NAME_LENGTH); 30 | gts_file_next_token (fp); 31 | } 32 | } 33 | 34 | static void nvertex_write (GtsObject * o, FILE * fptr) 35 | { 36 | GtsNVertex * nv = GTS_NVERTEX (o); 37 | 38 | (* o->klass->parent_class->write) (o, fptr); 39 | if (nv->name[0] != '\0') 40 | fprintf (fptr, " %s", nv->name); 41 | } 42 | 43 | static void nvertex_class_init (GtsNVertexClass * klass) 44 | { 45 | GTS_OBJECT_CLASS (klass)->read = nvertex_read; 46 | GTS_OBJECT_CLASS (klass)->write = nvertex_write; 47 | } 48 | 49 | static void nvertex_init (GtsNVertex * nvertex) 50 | { 51 | nvertex->name[0] = '\0'; 52 | } 53 | 54 | /** 55 | * gts_nvertex_class: 56 | * 57 | * Returns: the #GtsNVertexClass. 58 | */ 59 | GtsNVertexClass * gts_nvertex_class (void) 60 | { 61 | static GtsNVertexClass * klass = NULL; 62 | 63 | if (klass == NULL) { 64 | GtsObjectClassInfo nvertex_info = { 65 | "GtsNVertex", 66 | sizeof (GtsNVertex), 67 | sizeof (GtsNVertexClass), 68 | (GtsObjectClassInitFunc) nvertex_class_init, 69 | (GtsObjectInitFunc) nvertex_init, 70 | (GtsArgSetFunc) NULL, 71 | (GtsArgGetFunc) NULL 72 | }; 73 | klass = gts_object_class_new (GTS_OBJECT_CLASS (gts_vertex_class ()), 74 | &nvertex_info); 75 | } 76 | 77 | return klass; 78 | } 79 | 80 | static void nedge_read (GtsObject ** po, GtsFile * fp) 81 | { 82 | if (fp->type != GTS_STRING) { 83 | gts_file_error (fp, "expecting a string (name)"); 84 | return; 85 | } 86 | strncpy (GTS_NEDGE (*po)->name, fp->token->str, GTS_NAME_LENGTH); 87 | gts_file_next_token (fp); 88 | } 89 | 90 | static void nedge_write (GtsObject * o, FILE * fptr) 91 | { 92 | GtsNEdge * ne = GTS_NEDGE (o); 93 | 94 | if (ne->name[0] != '\0') 95 | fprintf (fptr, " %s", ne->name); 96 | } 97 | 98 | static void nedge_class_init (GtsNEdgeClass * klass) 99 | { 100 | GTS_OBJECT_CLASS (klass)->read = nedge_read; 101 | GTS_OBJECT_CLASS (klass)->write = nedge_write; 102 | } 103 | 104 | static void nedge_init (GtsNEdge * nedge) 105 | { 106 | nedge->name[0] = '\0'; 107 | } 108 | 109 | /** 110 | * gts_nedge_class: 111 | * 112 | * Returns: the #GtsNEdgeClass. 113 | */ 114 | GtsNEdgeClass * gts_nedge_class (void) 115 | { 116 | static GtsNEdgeClass * klass = NULL; 117 | 118 | if (klass == NULL) { 119 | GtsObjectClassInfo nedge_info = { 120 | "GtsNEdge", 121 | sizeof (GtsNEdge), 122 | sizeof (GtsNEdgeClass), 123 | (GtsObjectClassInitFunc) nedge_class_init, 124 | (GtsObjectInitFunc) nedge_init, 125 | (GtsArgSetFunc) NULL, 126 | (GtsArgGetFunc) NULL 127 | }; 128 | klass = gts_object_class_new (GTS_OBJECT_CLASS (gts_edge_class ()), 129 | &nedge_info); 130 | } 131 | 132 | return klass; 133 | } 134 | 135 | static void nface_read (GtsObject ** po, GtsFile * fp) 136 | { 137 | if (fp->type != GTS_STRING) { 138 | gts_file_error (fp, "expecting a string (name)"); 139 | return; 140 | } 141 | strncpy (GTS_NFACE (*po)->name, fp->token->str, GTS_NAME_LENGTH); 142 | gts_file_next_token (fp); 143 | } 144 | 145 | static void nface_write (GtsObject * o, FILE * fptr) 146 | { 147 | GtsNFace * nf = GTS_NFACE (o); 148 | 149 | if (nf->name[0] != '\0') 150 | fprintf (fptr, " %s", GTS_NFACE (o)->name); 151 | } 152 | 153 | static void nface_class_init (GtsNFaceClass * klass) 154 | { 155 | GTS_OBJECT_CLASS (klass)->read = nface_read; 156 | GTS_OBJECT_CLASS (klass)->write = nface_write; 157 | } 158 | 159 | static void nface_init (GtsNFace * nface) 160 | { 161 | nface->name[0] = '\0'; 162 | } 163 | 164 | /** 165 | * gts_nface_class: 166 | * 167 | * Returns: the #GtsNFaceClass. 168 | */ 169 | GtsNFaceClass * gts_nface_class (void) 170 | { 171 | static GtsNFaceClass * klass = NULL; 172 | 173 | if (klass == NULL) { 174 | GtsObjectClassInfo nface_info = { 175 | "GtsNFace", 176 | sizeof (GtsNFace), 177 | sizeof (GtsNFaceClass), 178 | (GtsObjectClassInitFunc) nface_class_init, 179 | (GtsObjectInitFunc) nface_init, 180 | (GtsArgSetFunc) NULL, 181 | (GtsArgGetFunc) NULL 182 | }; 183 | klass = gts_object_class_new (GTS_OBJECT_CLASS (gts_face_class ()), 184 | &nface_info); 185 | } 186 | 187 | return klass; 188 | } 189 | -------------------------------------------------------------------------------- /src/predicates.h: -------------------------------------------------------------------------------- 1 | /* GTS - Library for the manipulation of triangulated surfaces 2 | * Copyright (C) 1999 Stéphane Popinet 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Library General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Library General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Library General Public 15 | * License along with this library; if not, write to the 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 | * Boston, MA 02111-1307, USA. 18 | */ 19 | /* Header file for robust predicates by Jonathan Richard Shewchuk */ 20 | 21 | #ifndef __PREDICATES_H__ 22 | #define __PREDICATES_H__ 23 | 24 | double orient2d (double * pa, 25 | double * pb, 26 | double * pc); 27 | double orient3d (double * pa, 28 | double * pb, 29 | double * pc, 30 | double * pd); 31 | double incircle (double * pa, 32 | double * pb, 33 | double * pc, 34 | double * pd); 35 | double insphere (double * pa, 36 | double * pb, 37 | double * pc, 38 | double * pd, 39 | double * pe); 40 | 41 | #endif /* __PREDICATES_H__ */ 42 | -------------------------------------------------------------------------------- /src/predicates_init.c: -------------------------------------------------------------------------------- 1 | /* GTS - Library for the manipulation of triangulated surfaces 2 | * Copyright (C) 1999 Stéphane Popinet 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Library General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Library General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Library General Public 15 | * License along with this library; if not, write to the 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 | * Boston, MA 02111-1307, USA. 18 | */ 19 | 20 | /* This program creates a header file defining the various constants needed by 21 | * predicates.c. These constant are machine dependent. 22 | * adapted from predicates.c by Jonathan Richard Shewchuk 23 | */ 24 | 25 | #include 26 | 27 | /* FPU control. We MUST have only double precision (not extended precision) */ 28 | #include "rounding.h" 29 | 30 | int main (int argc, char * argv[]) 31 | { 32 | double half = 0.5; 33 | double check = 1.0, lastcheck; 34 | int every_other = 1; 35 | /* epsilon = 2^(-p). Used to estimate roundoff errors. */ 36 | double epsilon = 1.0; 37 | /* splitter = 2^ceiling(p / 2) + 1. Used to split floats in half. */ 38 | double splitter = 1.0; 39 | /* A set of coefficients used to calculate maximum roundoff errors. */ 40 | double resulterrbound; 41 | double ccwerrboundA, ccwerrboundB, ccwerrboundC; 42 | double o3derrboundA, o3derrboundB, o3derrboundC; 43 | double iccerrboundA, iccerrboundB, iccerrboundC; 44 | double isperrboundA, isperrboundB, isperrboundC; 45 | 46 | FPU_ROUND_DOUBLE; 47 | 48 | epsilon = 1.0; 49 | splitter = 1.0; 50 | /* Repeatedly divide `epsilon' by two until it is too small to add to */ 51 | /* one without causing roundoff. (Also check if the sum is equal to */ 52 | /* the previous sum, for machines that round up instead of using exact */ 53 | /* rounding. Not that this library will work on such machines anyway). */ 54 | do { 55 | lastcheck = check; 56 | epsilon *= half; 57 | if (every_other) { 58 | splitter *= 2.0; 59 | } 60 | every_other = !every_other; 61 | check = 1.0 + epsilon; 62 | } while ((check != 1.0) && (check != lastcheck)); 63 | splitter += 1.0; 64 | /* Error bounds for orientation and incircle tests. */ 65 | resulterrbound = (3.0 + 8.0 * epsilon) * epsilon; 66 | ccwerrboundA = (3.0 + 16.0 * epsilon) * epsilon; 67 | ccwerrboundB = (2.0 + 12.0 * epsilon) * epsilon; 68 | ccwerrboundC = (9.0 + 64.0 * epsilon) * epsilon * epsilon; 69 | o3derrboundA = (7.0 + 56.0 * epsilon) * epsilon; 70 | o3derrboundB = (3.0 + 28.0 * epsilon) * epsilon; 71 | o3derrboundC = (26.0 + 288.0 * epsilon) * epsilon * epsilon; 72 | iccerrboundA = (10.0 + 96.0 * epsilon) * epsilon; 73 | iccerrboundB = (4.0 + 48.0 * epsilon) * epsilon; 74 | iccerrboundC = (44.0 + 576.0 * epsilon) * epsilon * epsilon; 75 | isperrboundA = (16.0 + 224.0 * epsilon) * epsilon; 76 | isperrboundB = (5.0 + 72.0 * epsilon) * epsilon; 77 | isperrboundC = (71.0 + 1408.0 * epsilon) * epsilon * epsilon; 78 | 79 | puts ("/* This file was generated automatically by predicates_init\n" 80 | " *\n" 81 | " * This file is free software; you can redistribute it and/or\n" 82 | " * modify it under the terms of the GNU Library General Public\n" 83 | " * License as published by the Free Software Foundation; either\n" 84 | " * version 2 of the License, or (at your option) any later version.\n" 85 | " *\n" 86 | " * This file is distributed in the hope that it will be useful,\n" 87 | " * but WITHOUT ANY WARRANTY; without even the implied warranty of\n" 88 | " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" 89 | " */\n"); 90 | printf ("static double splitter = %f;\n", splitter); 91 | printf ("static double resulterrbound = %.16g;\n", resulterrbound); 92 | printf ("static double ccwerrboundA = %.16g;\n", ccwerrboundA); 93 | printf ("static double ccwerrboundB = %.16g;\n", ccwerrboundB); 94 | printf ("static double ccwerrboundC = %.16g;\n", ccwerrboundC); 95 | printf ("static double o3derrboundA = %.16g;\n", o3derrboundA); 96 | printf ("static double o3derrboundB = %.16g;\n", o3derrboundB); 97 | printf ("static double o3derrboundC = %.16g;\n", o3derrboundC); 98 | printf ("static double iccerrboundA = %.16g;\n", iccerrboundA); 99 | printf ("static double iccerrboundB = %.16g;\n", iccerrboundB); 100 | printf ("static double iccerrboundC = %.16g;\n", iccerrboundC); 101 | printf ("static double isperrboundA = %.16g;\n", isperrboundA); 102 | printf ("static double isperrboundB = %.16g;\n", isperrboundB); 103 | printf ("static double isperrboundC = %.16g;\n", isperrboundC); 104 | 105 | FPU_RESTORE; 106 | 107 | return 0; 108 | } 109 | -------------------------------------------------------------------------------- /src/rounding.h: -------------------------------------------------------------------------------- 1 | /* GTS - Library for the manipulation of triangulated surfaces 2 | * Copyright (C) 1999 Stéphane Popinet 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Library General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Library General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Library General Public 15 | * License along with this library; if not, write to the 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 | * Boston, MA 02111-1307, USA. 18 | */ 19 | 20 | #include "config.h" 21 | 22 | #ifdef HAVE_FPU_CONTROL_H 23 | # include 24 | # ifdef _FPU_EXTENDED 25 | # if !defined(__alpha__) || !defined(__GLIBC__) 26 | # if defined(__arm__) 27 | static fpu_control_t fpu_round_double = _FPU_DEFAULT; 28 | # else 29 | static fpu_control_t fpu_round_double = 30 | (_FPU_DEFAULT & ~ _FPU_EXTENDED)|_FPU_DOUBLE; 31 | # endif 32 | static fpu_control_t fpu_init; 33 | # define FPU_ROUND_DOUBLE { _FPU_GETCW(fpu_init);\ 34 | _FPU_SETCW(fpu_round_double); } 35 | # define FPU_RESTORE {_FPU_SETCW(fpu_init);} 36 | # else /* __alpha__ && __GLIBC__ */ 37 | # define FPU_ROUND_DOUBLE 38 | # define FPU_RESTORE 39 | # endif /* __alpha__ && __GLIBC__ */ 40 | # else /* not FPU_EXTENDED */ 41 | # define FPU_ROUND_DOUBLE 42 | # define FPU_RESTORE 43 | # endif /* not FPU_EXTENDED */ 44 | #else /* not HAVE_FPU_CONTROL_H */ 45 | # ifdef __FreeBSD__ 46 | # include 47 | # define FPU_ROUND_DOUBLE (fpsetprec(FP_PD)) 48 | # define FPU_RESTORE (fpsetprec(FP_PE)) 49 | # else /* not __FreeBSD__ */ 50 | # ifdef WIN32 51 | # ifdef _MSC_VER 52 | # include 53 | static unsigned int fpu_init; 54 | # define FPU_ROUND_DOUBLE (fpu_init = _controlfp (0, 0),\ 55 | _controlfp (_PC_53, MCW_PC)) 56 | # define FPU_RESTORE (_controlfp (fpu_init, 0xfffff)) 57 | # elif __MINGW32__ 58 | # include 59 | static unsigned int fpu_init; 60 | # define FPU_ROUND_DOUBLE (fpu_init = _controlfp (0, 0),\ 61 | _controlfp (_PC_53, _MCW_PC)) 62 | # define FPU_RESTORE (_controlfp (fpu_init, 0xfffff)) 63 | # else /* not _MSC_VER or __MINGW32__ */ 64 | # error "You need MSVC or MinGW for the Win32 version" 65 | # endif /* not _MSC_VER or __MINGW32__ */ 66 | # else /* not WIN32 */ 67 | # ifdef __CYGWIN__ 68 | typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__))); 69 | static fpu_control_t fpu_round_double = 0x027f; 70 | static fpu_control_t fpu_init; 71 | # define _FPU_GETCW(cw) __asm__ ("fnstcw %0" : "=m" (*&cw)) 72 | # define _FPU_SETCW(cw) __asm__ ("fldcw %0" : : "m" (*&cw)) 73 | # define FPU_ROUND_DOUBLE { _FPU_GETCW(fpu_init);\ 74 | _FPU_SETCW(fpu_round_double); } 75 | # define FPU_RESTORE { _FPU_SETCW(fpu_init);} 76 | # else /* not __CYGWIN__ */ 77 | # ifdef CPP_HAS_WARNING 78 | # warning "Unknown CPU: assuming default double precision rounding" 79 | # endif /* CPP_HAS_WARNING */ 80 | # define FPU_ROUND_DOUBLE 81 | # define FPU_RESTORE 82 | # endif /* not __CYGWIN__ */ 83 | # endif /* not WIN32 */ 84 | # endif /* not __FreeBSD__ */ 85 | #endif /* not HAVE_FPU_CONTROL_H */ 86 | -------------------------------------------------------------------------------- /src/split.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsaavedr/gts/f566256dcc760c5a9da0182d895e990ee49c460c/src/split.c -------------------------------------------------------------------------------- /src/template.c: -------------------------------------------------------------------------------- 1 | /* GTS - Library for the manipulation of triangulated surfaces 2 | * Copyright (C) 1999 Stéphane Popinet 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Library General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Library General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Library General Public 15 | * License along with this library; if not, write to the 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 | * Boston, MA 02111-1307, USA. 18 | */ 19 | 20 | /* MyObject: Header */ 21 | 22 | typedef struct _MyObject MyObject; 23 | typedef struct _MyObjectClass MyObjectClass; 24 | 25 | struct _MyObject { 26 | Parent parent; 27 | /* add extra data here */ 28 | }; 29 | 30 | struct _MyObjectClass { 31 | ParentClass parent_class; 32 | /* add extra methods here */ 33 | }; 34 | 35 | #define MY_OBJECT(obj) GTS_OBJECT_CAST (obj,\ 36 | MyObject,\ 37 | my_object_class ()) 38 | #define MY_OBJECT_CLASS(klass) GTS_OBJECT_CLASS_CAST (klass,\ 39 | MyObjectClass,\ 40 | my_object_class()) 41 | #define IS_MY_OBJECT(obj) (gts_object_is_from_class (obj,\ 42 | my_object_class ())) 43 | 44 | MyObjectClass * my_object_class (void); 45 | MyObject * my_object_new (MyObjectClass * klass); 46 | 47 | /* MyObject: Object */ 48 | 49 | static void my_object_destroy (GtsObject * object) 50 | { 51 | /* do object-specific cleanup here */ 52 | 53 | /* do not forget to call destroy method of the parent */ 54 | (* GTS_OBJECT_CLASS (my_object_class ())->parent_class->destroy) (object); 55 | } 56 | 57 | static void my_object_class_init (MyObjectClass * klass) 58 | { 59 | /* define new methods and overload inherited methods here */ 60 | 61 | /* example of overloading of the destroy() function 62 | (not needed if you don't need to do object-specific cleanup) */ 63 | GTS_OBJECT_CLASS (klass)->destroy = my_object_destroy; 64 | } 65 | 66 | static void my_object_init (MyObject * object) 67 | { 68 | /* initialize object here */ 69 | } 70 | 71 | MyObjectClass * my_object_class (void) 72 | { 73 | static MyObjectClass * klass = NULL; 74 | 75 | if (klass == NULL) { 76 | GtsObjectClassInfo my_object_info = { 77 | "MyObject", 78 | sizeof (MyObject), 79 | sizeof (MyObjectClass), 80 | (GtsObjectClassInitFunc) my_object_class_init, 81 | (GtsObjectInitFunc) my_object_init, 82 | (GtsArgSetFunc) NULL, 83 | (GtsArgGetFunc) NULL 84 | }; 85 | klass = gts_object_class_new (GTS_OBJECT_CLASS (parent_class ()), 86 | &my_object_info); 87 | } 88 | 89 | return klass; 90 | } 91 | 92 | MyObject * my_object_new (MyObjectClass * klass) 93 | { 94 | MyObject * object; 95 | 96 | object = MY_OBJECT (gts_object_new (GTS_OBJECT_CLASS (klass))); 97 | 98 | return object; 99 | } 100 | -------------------------------------------------------------------------------- /src/valgrind.supp: -------------------------------------------------------------------------------- 1 | # fast_expansion_sum_zeroelim in predicates.c reads uninitialised array values 2 | # but subsequently discards them (hopefully). 3 | 4 | { 5 | fast_expansion_sum_zeroelim/orient 6 | Memcheck:Value8 7 | fun:fast_expansion_sum_zeroelim 8 | fun:orient*adapt 9 | } 10 | 11 | { 12 | fast_expansion_sum_zeroelim/incircle 13 | Memcheck:Value8 14 | fun:fast_expansion_sum_zeroelim 15 | fun:incircleadapt 16 | } 17 | -------------------------------------------------------------------------------- /test/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to produce Makefile.in 2 | 3 | SUBDIRS = boolean delaunay coarsen 4 | -------------------------------------------------------------------------------- /test/boolean/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to produce Makefile.in 2 | 3 | INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src -I$(includedir)\ 4 | -DG_LOG_DOMAIN=\"Gts-test\" 5 | LDADD = $(top_builddir)/src/libgts.la -lm 6 | DEPS = $(top_builddir)/src/libgts.la 7 | 8 | check_PROGRAMS = set boole cubes 9 | 10 | TESTS = test.sh 11 | 12 | EXTRA_DIST = $(TESTS) tests surfaces 13 | -------------------------------------------------------------------------------- /test/boolean/cases/tt.cas: -------------------------------------------------------------------------------- 1 | none none none none none none 0 2 | . . . s2e3 none none 0 3 | . . . s1e0 s1e0 none 0 4 | . . . s1e0 s1e0 s2e3 0 5 | . . . s0e0 s1e0 s1e0 1 6 | . . . s0e0 s0e0 none 1 7 | s0e0 none none s0e0 none none 1 8 | . . . s1e0 s1e0 none 1 9 | s0e1 none none s0e1 none none 0 10 | . . . s2e3 s1e0 none 0 11 | . . . s0e1 s0e0 none 1 12 | . . . s0e1 s1e0 s1e0 1 13 | s0e2 none none s1e1 s1e1 none 0 14 | . . . s1e1 s2e3 none 0 15 | . . . s1e1 s2e3 s1e0 0 16 | . . . s1e1 s1e1 s0e0 1 17 | s2e3 none none none none none 0 18 | . . . s1e1 s1e1 none 0 19 | . . . s1e1 s1e1 s2e3 0 20 | . . . s1e1 s1e1 s0e1 1 21 | . . . s0e1 s0e1 none 1 22 | . . . s2e3 none none 0 23 | s0e0 s0e0 none none none none 1 24 | s0e0 s0e1 none s0e1 none none 1 25 | s0e0 s0e2 none s1e1 s1e1 none 1 26 | s0e1 s0e1 none s2e3 none none 0 27 | . . . s0e1 s0e1 none 1 28 | s0e1 s0e2 none s2e3 s1e1 none 0 29 | . . . s0e1 s1e1 s1e1 1 30 | s0e2 s0e2 none s1e1 s1e1 s2e3 0 31 | s1e0 s1e0 none s0e0 none none 1 32 | . . . s1e0 s1e0 none 1 33 | . . . none none none 0 34 | s1e0 s2e3 none s0e1 none none 1 35 | . . . s1e1 s1e1 none 1 36 | s1e1 s1e1 none s0e2 none none 0 37 | . . . s2e3 none none 0 38 | . . . s2e3 s1e0 none 0 39 | . . . s0e2 s0e0 none 1 40 | . . . s0e2 s1e0 s1e0 1 41 | s1e1 s2e3 none s0e2 none none 0 42 | . . . s2e3 s1e1 none 0 43 | . . . s0e2 s0e1 none 1 44 | . . . s0e2 s1e1 s1e1 1 45 | s1e2 s1e2 none s1e2 s1e2 none 0 46 | . . . s1e2 s2e3 none 0 47 | . . . s1e2 s2e3 s1e0 0 48 | . . . s1e2 s1e2 s0e0 1 49 | s1e2 s2e3 none s1e2 s1e2 none 0 50 | . . . s1e2 s2e3 none 0 51 | . . . s1e2 s2e3 s1e1 0 52 | . . . s1e2 s1e2 s0e1 1 53 | s0e0 s1e0 s1e0 none none none 1 54 | s0e0 s1e1 s1e1 s0e2 none none 1 55 | s0e0 s1e2 s1e2 s1e2 s1e2 none 1 56 | s0e1 s1e0 s1e0 s0e1 none none 1 57 | s0e1 s1e1 s1e1 s2e3 none none 0 58 | . . . s0e1 s0e2 none 1 59 | s0e1 s1e2 s1e2 s2e3 s1e2 none 0 60 | . . . s0e1 s1e2 s1e2 1 61 | s0e2 s1e0 s1e0 s1e1 s1e1 none 1 62 | s0e2 s1e1 s1e1 s1e1 s2e3 none 0 63 | . . . s1e1 s1e1 s0e2 1 64 | s0e2 s1e2 s1e2 s1e1 s1e2 s2e3 0 65 | s1e0 s2e3 s1e0 none none none 1 66 | s1e0 s2e3 s1e1 s0e2 none none 1 67 | s1e0 s2e3 s1e2 s1e2 s1e2 none 1 68 | s1e1 s2e3 s1e1 s2e3 none none 0 69 | . . . s0e2 s0e2 none 1 70 | s1e1 s2e3 s1e2 s2e3 s1e2 none 0 71 | . . . s0e2 s1e2 s1e2 1 72 | s1e2 s2e3 s1e2 s2e3 s1e2 s1e2 0 73 | -------------------------------------------------------------------------------- /test/boolean/cases/tt.py: -------------------------------------------------------------------------------- 1 | types = ["none", 2 | "s0e0", "s0e1", "s0e2", 3 | "s1e0", "s1e1", "s1e2", 4 | "s2e3"] 5 | 6 | file = open("test/boolean/cases/tt.cas", "r") 7 | 8 | cases = [] 9 | header = [] 10 | for line in file: 11 | words = line.strip().split() 12 | 13 | if words[0]!=".": 14 | header = words[0:3] 15 | else: 16 | words[0:3] = header 17 | segment = (words[6]=="1") 18 | 19 | words_type = [-1]*6 20 | for i in range(6): 21 | for j in range(len(types)): 22 | if words[i]==types[j]: 23 | words_type[i] = j 24 | break 25 | if words_type[i]==-1: 26 | print "::::::::::::::::::::::::::::::::::::::::::::" 27 | print words[i] 28 | print "::::::::::::::::::::::::::::::::::::::::::::" 29 | 30 | types1 = words_type[0:3] 31 | types2 = words_type[3:6] 32 | 33 | types1.sort() 34 | types2.sort() 35 | 36 | words_type[0:3] = types1 37 | words_type[3:6] = types2 38 | if segment: 39 | words_type.append(1) 40 | else: 41 | words_type.append(0) 42 | 43 | cases.append(words_type) 44 | 45 | def cc(ci,cj): 46 | if ci[0]cj[0]: 49 | return 1 50 | else: 51 | return cc(ci[1:],cj[1:]) 52 | 53 | cases.sort(cmp=cc) 54 | 55 | finded = [] 56 | for i in xrange(len(cases)): 57 | if i in finded: 58 | continue 59 | 60 | ci = cases[i] 61 | ok = False 62 | printed = False 63 | for j in xrange(i+1,len(cases)): 64 | cj = cases[j] 65 | if ci[0]==cj[3] and ci[1]==cj[4] and ci[2]==cj[5] and cj[0]==ci[3] and cj[1]==ci[4] and cj[2]==ci[5]: 66 | wi = [types[ci[0]], types[ci[1]], types[ci[2]], str(ci[6])] 67 | wj = [types[cj[0]], types[cj[1]], types[cj[2]], str(cj[6])] 68 | li = " ".join(wi) 69 | lj = " ".join(wj) 70 | if (ci[6]==1 or cj[6]==1) and (ci[6]==0 or cj[6]==0): 71 | print "%s\n%s"%(li, lj) 72 | printed = True 73 | ok = True 74 | finded.append(j) 75 | 76 | if ok: 77 | if printed: 78 | print ":::::::::::::::::::::::::::::::::::::::::::::::::::" 79 | elif ci[0]!=ci[3] or ci[1]!=ci[4] or ci[2]!=ci[5]:# caso no autosimetrico sin correspondencia 80 | wi = [types[ci[0]], types[ci[1]], types[ci[2]], types[ci[3]], types[ci[4]], types[ci[5]], str(ci[6])] 81 | li = " ".join(wi) 82 | print "::::::::::::::::::::::::::::::::::::::::::::::::::: %s"%(li) 83 | else:# caso autosimetrico 84 | wi = [types[ci[0]], types[ci[1]], types[ci[2]], str(ci[6])] 85 | li = " ".join(wi) 86 | if ci[6]==1: 87 | print li 88 | print ":::::::::::::::::::::::::::::::::::::::::::::::::::" 89 | -------------------------------------------------------------------------------- /test/boolean/surfaces/a10.gts: -------------------------------------------------------------------------------- 1 | 4 6 4 GtsSurface GtsFace GtsEdge GtsVertex 2 | 2 0 0 3 | 0 0 2 4 | 0 2 0 5 | 0 0 0 6 | 1 2 7 | 1 3 8 | 3 2 9 | 4 2 10 | 4 1 11 | 3 4 12 | 1 2 3 13 | 4 5 1 14 | 3 6 4 15 | 6 2 5 16 | -------------------------------------------------------------------------------- /test/boolean/surfaces/a23.gts: -------------------------------------------------------------------------------- 1 | 4 6 4 GtsSurface GtsFace GtsEdge GtsVertex 2 | 2 0 0 3 | 0 0 2 4 | 0 2 0 5 | 0 0 0 6 | 1 2 7 | 1 3 8 | 3 2 9 | 4 2 10 | 4 1 11 | 3 4 12 | 1 2 3 13 | 4 5 1 14 | 3 6 4 15 | 6 2 5 16 | -------------------------------------------------------------------------------- /test/boolean/surfaces/a24.gts: -------------------------------------------------------------------------------- 1 | 4 6 4 GtsSurface GtsFace GtsEdge GtsVertex 2 | 2 0 0 3 | 0 0 2 4 | 0 2 0 5 | 0 0 0 6 | 1 2 7 | 1 3 8 | 3 2 9 | 4 2 10 | 4 1 11 | 3 4 12 | 1 2 3 13 | 4 5 1 14 | 3 6 4 15 | 6 2 5 16 | -------------------------------------------------------------------------------- /test/boolean/surfaces/a25.gts: -------------------------------------------------------------------------------- 1 | 4 6 4 GtsSurface GtsFace GtsEdge GtsVertex 2 | 2 0 0 3 | 0 0 2 4 | 0 2 0 5 | 0 0 0 6 | 1 2 7 | 1 3 8 | 3 2 9 | 4 2 10 | 4 1 11 | 3 4 12 | 1 2 3 13 | 4 5 1 14 | 3 6 4 15 | 6 2 5 16 | -------------------------------------------------------------------------------- /test/boolean/surfaces/a8.gts: -------------------------------------------------------------------------------- 1 | 4 6 4 GtsSurface GtsFace GtsEdge GtsVertex 2 | 2 0 0 3 | 0 0 2 4 | 0 2 0 5 | 0 0 0 6 | 1 2 7 | 1 3 8 | 3 2 9 | 4 2 10 | 4 1 11 | 3 4 12 | 1 2 3 13 | 4 5 1 14 | 3 6 4 15 | 6 2 5 16 | -------------------------------------------------------------------------------- /test/boolean/surfaces/a9.gts: -------------------------------------------------------------------------------- 1 | 4 6 4 GtsSurface GtsFace GtsEdge GtsVertex 2 | 2 0 0 3 | 0 0 2 4 | 0 2 0 5 | 0 0 0 6 | 1 2 7 | 1 3 8 | 3 2 9 | 4 2 10 | 4 1 11 | 3 4 12 | 1 2 3 13 | 4 5 1 14 | 3 6 4 15 | 6 2 5 16 | -------------------------------------------------------------------------------- /test/boolean/surfaces/b10.gts: -------------------------------------------------------------------------------- 1 | 4 6 4 GtsSurface GtsFace GtsEdge GtsVertex 2 | -1 1 1 3 | 0 0 2 4 | 3 -3 1 5 | 3 1 1 6 | 1 2 7 | 1 3 8 | 3 2 9 | 4 2 10 | 4 1 11 | 3 4 12 | 1 2 3 13 | 4 5 1 14 | 3 6 4 15 | 6 2 5 16 | -------------------------------------------------------------------------------- /test/boolean/surfaces/b23.gts: -------------------------------------------------------------------------------- 1 | 4 6 4 GtsSurface GtsFace GtsEdge GtsVertex 2 | 0 3 1 3 | 0 0 4 4 | 0 0 1 5 | 1 0 1 6 | 1 2 7 | 1 3 8 | 3 2 9 | 4 2 10 | 4 1 11 | 3 4 12 | 1 2 3 13 | 4 5 1 14 | 3 6 4 15 | 6 2 5 16 | -------------------------------------------------------------------------------- /test/boolean/surfaces/b24.gts: -------------------------------------------------------------------------------- 1 | 4 6 4 GtsSurface GtsFace GtsEdge GtsVertex 2 | 0 3 1 3 | 0 0 4 4 | 0 0 1 5 | 1 0 1 6 | 1 2 7 | 1 3 8 | 3 2 9 | 4 2 10 | 4 1 11 | 3 4 12 | 1 2 3 13 | 4 5 1 14 | 3 6 4 15 | 6 2 5 16 | -------------------------------------------------------------------------------- /test/boolean/surfaces/b25.gts: -------------------------------------------------------------------------------- 1 | 4 6 4 GtsSurface GtsFace GtsEdge GtsVertex 2 | 0 3 1 3 | 0 0 2 4 | 0 0 1 5 | 1 0 1 6 | 1 2 7 | 1 3 8 | 3 2 9 | 4 2 10 | 4 1 11 | 3 4 12 | 1 2 3 13 | 4 5 1 14 | 3 6 4 15 | 6 2 5 16 | -------------------------------------------------------------------------------- /test/boolean/surfaces/b8.gts: -------------------------------------------------------------------------------- 1 | 4 6 4 GtsSurface GtsFace GtsEdge GtsVertex 2 | 3 -3 1 3 | 3 1 1 4 | -1 1 1 5 | -1 -1 4 6 | 1 2 7 | 3 1 8 | 2 3 9 | 3 4 10 | 1 4 11 | 2 4 12 | 1 2 3 13 | 4 2 5 14 | 6 3 4 15 | 5 1 6 16 | -------------------------------------------------------------------------------- /test/boolean/surfaces/b9.gts: -------------------------------------------------------------------------------- 1 | 4 6 4 GtsSurface GtsFace GtsEdge GtsVertex 2 | -1 1 1 3 | 0 0 4 4 | 3 -3 1 5 | 3 1 1 6 | 1 2 7 | 1 3 8 | 3 2 9 | 4 2 10 | 4 1 11 | 3 4 12 | 1 2 3 13 | 4 5 1 14 | 3 6 4 15 | 6 2 5 16 | -------------------------------------------------------------------------------- /test/boolean/surfaces/cube: -------------------------------------------------------------------------------- 1 | 8 18 12 2 | 0 -1.63299 -1.5 A 3 | -1.63299 0 -1.5 B 4 | 0 1.63299 -1.5 C 5 | 1.63299 0 -1.5 D 6 | 0 -1.63299 1.1547 E 7 | -1.63299 0 1.1547 F 8 | 0 1.63299 1.1547 G 9 | 1.63299 0 1.1547 H 10 | 3 1 CA 11 | 2 1 BA 12 | 6 1 FA 13 | 2 6 BF 14 | 2 7 BG 15 | 3 2 CB 16 | 3 7 CG 17 | 3 8 CH 18 | 4 3 DC 19 | 4 8 DH 20 | 5 1 EA 21 | 4 5 DE 22 | 1 4 AD 23 | 6 5 FE 24 | 7 6 GF 25 | 5 8 EH 26 | 7 5 GE 27 | 8 7 HG 28 | 9 13 1 ACD 29 | 6 1 2 CBA 30 | 4 2 3 ABE 31 | 14 3 11 FAE 32 | 4 15 5 BFG 33 | 6 5 7 BCG 34 | 7 18 8 CGH 35 | 9 8 10 CHD 36 | 10 16 12 DHE 37 | 13 12 11 EAD 38 | 15 14 17 GFE 39 | 18 17 16 HGE 40 | -------------------------------------------------------------------------------- /test/boolean/surfaces/cube1: -------------------------------------------------------------------------------- 1 | 8 18 12 2 | 0 -1.63299 1.1547 3 | -1.63299 0 1.1547 4 | 0 1.63299 1.1547 5 | 1.63299 0 1.1547 6 | 0 -1.63299 3.5 7 | -1.63299 0 3.5 8 | 0 1.63299 3.5 9 | 1.63299 0 3.5 10 | 3 1 11 | 2 1 12 | 6 1 13 | 2 6 14 | 2 7 15 | 3 2 16 | 3 7 17 | 3 8 18 | 4 3 19 | 4 8 20 | 5 1 21 | 4 5 22 | 1 4 23 | 6 5 24 | 7 6 25 | 5 8 26 | 7 5 27 | 8 7 28 | 9 13 1 29 | 6 1 2 30 | 4 2 3 31 | 14 3 11 32 | 4 15 5 33 | 6 5 7 34 | 7 18 8 35 | 9 8 10 36 | 10 16 12 37 | 13 12 11 38 | 15 14 17 39 | 18 17 16 40 | -------------------------------------------------------------------------------- /test/boolean/surfaces/cube10: -------------------------------------------------------------------------------- 1 | 8 18 12 GtsSurface GtsFace GtsEdge GtsVertex 2 | 3.464094909 3.464094909 -1.5 3 | 1.154698303 3.464094909 -1.5 4 | 3.464094909 1.154698303 -1.5 5 | 1.154698303 1.154698303 -1.5 6 | 1.154698303 1.154698303 1.1547 7 | 3.464094909 1.154698303 1.1547 8 | 1.154698303 3.464094909 1.1547 9 | 3.464094909 3.464094909 1.1547 10 | 1 2 11 | 3 1 12 | 2 3 13 | 2 4 14 | 4 3 15 | 4 5 16 | 5 3 17 | 5 6 18 | 6 3 19 | 7 5 20 | 4 7 21 | 2 7 22 | 8 7 23 | 2 8 24 | 1 8 25 | 6 8 26 | 1 6 27 | 7 6 28 | 1 2 3 29 | 4 3 5 30 | 6 5 7 31 | 8 7 9 32 | 6 10 11 33 | 4 11 12 34 | 12 13 14 35 | 1 14 15 36 | 15 16 17 37 | 2 17 9 38 | 10 8 18 39 | 13 18 16 40 | -------------------------------------------------------------------------------- /test/boolean/surfaces/cube2: -------------------------------------------------------------------------------- 1 | 8 18 12 2 | 8 0 0 3 | 0 0 0 4 | 0 1 0 5 | 8 1 0 6 | 8 0 10 7 | 0 0 10 8 | 0 1 10 9 | 8 1 10 10 | 3 1 11 | 2 1 12 | 6 1 13 | 2 6 14 | 2 7 15 | 3 2 16 | 3 7 17 | 3 8 18 | 4 3 19 | 4 8 20 | 5 1 21 | 4 5 22 | 1 4 23 | 6 5 24 | 7 6 25 | 5 8 26 | 7 5 27 | 8 7 28 | 9 13 1 29 | 6 1 2 30 | 4 2 3 31 | 14 3 11 32 | 4 15 5 33 | 6 5 7 34 | 7 18 8 35 | 9 8 10 36 | 10 16 12 37 | 13 12 11 38 | 15 14 17 39 | 18 17 16 40 | -------------------------------------------------------------------------------- /test/boolean/surfaces/cube4: -------------------------------------------------------------------------------- 1 | 8 18 12 2 | 0 -1.63299 -2 3 | -1.63299 0 -2 4 | 0 1.63299 -2 5 | 1.63299 0 -2 6 | 0 -1.63299 2 7 | -1.63299 0 2 8 | 0 1.63299 2 9 | 1.63299 0 2 10 | 3 1 11 | 2 1 12 | 6 1 13 | 2 6 14 | 2 7 15 | 3 2 16 | 3 7 17 | 3 8 18 | 4 3 19 | 4 8 20 | 5 1 21 | 4 5 22 | 1 4 23 | 6 5 24 | 7 6 25 | 5 8 26 | 7 5 27 | 8 7 28 | 9 13 1 29 | 6 1 2 30 | 4 2 3 31 | 14 3 11 32 | 4 15 5 33 | 6 5 7 34 | 7 18 8 35 | 9 8 10 36 | 10 16 12 37 | 13 12 11 38 | 15 14 17 39 | 18 17 16 40 | -------------------------------------------------------------------------------- /test/boolean/surfaces/cube5: -------------------------------------------------------------------------------- 1 | 8 18 12 2 | 0 -1 -1 3 | -1 0 -1 4 | 0 1 -1 5 | 1 0 -1 6 | 0 -1 2 7 | -1 0 2 8 | 0 1 2 9 | 1 0 2 10 | 3 1 11 | 2 1 12 | 6 1 13 | 2 6 14 | 2 7 15 | 3 2 16 | 3 7 17 | 3 8 18 | 4 3 19 | 4 8 20 | 5 1 21 | 4 5 22 | 1 4 23 | 6 5 24 | 7 6 25 | 5 8 26 | 7 5 27 | 8 7 28 | 9 13 1 29 | 6 1 2 30 | 4 2 3 31 | 14 3 11 32 | 4 15 5 33 | 6 5 7 34 | 7 18 8 35 | 9 8 10 36 | 10 16 12 37 | 13 12 11 38 | 15 14 17 39 | 18 17 16 40 | -------------------------------------------------------------------------------- /test/boolean/surfaces/cube6: -------------------------------------------------------------------------------- 1 | 8 18 12 GtsSurface GtsFace GtsEdge GtsVertex 2 | -0.0471141 1.71734 -1.40185 3 | -1.88699 1.15792 -0.123091 4 | 1.55052 1.09747 0.625643 5 | -1.75833 -1.01684 -0.889362 6 | -0.289349 0.538054 1.90441 7 | -0.160693 -1.63671 1.13814 8 | 1.67918 -1.07729 -0.140628 9 | 0.0815424 -0.457427 -2.16813 10 | 1 2 11 | 2 3 12 | 1 3 13 | 2 4 14 | 4 5 15 | 2 5 16 | 4 6 17 | 5 6 18 | 6 7 19 | 6 8 20 | 7 8 21 | 3 5 22 | 4 8 23 | 2 8 24 | 5 7 25 | 7 3 26 | 8 1 27 | 1 7 28 | 1 2 3 29 | 4 5 6 30 | 7 8 5 31 | 9 10 11 32 | 6 12 2 33 | 7 13 10 34 | 4 14 13 35 | 12 15 16 36 | 1 17 14 37 | 8 9 15 38 | 17 18 11 39 | 3 16 18 40 | -------------------------------------------------------------------------------- /test/boolean/surfaces/cube7: -------------------------------------------------------------------------------- 1 | 8 18 12 GtsSurface GtsFace GtsEdge GtsVertex 2 | 1.55052 1.09747 0.625643 3 | -0.289349 0.538054 1.90441 4 | 2.96196 0.549843 2.41684 5 | -0.160693 -1.63671 1.13814 6 | 1.12209 -0.00957019 3.6956 7 | 1.25074 -2.18433 2.92933 8 | 3.09062 -1.62492 1.65057 9 | 1.67918 -1.07729 -0.140628 10 | 1 2 11 | 2 3 12 | 1 3 13 | 2 4 14 | 4 5 15 | 2 5 16 | 4 6 17 | 5 6 18 | 6 7 19 | 6 8 20 | 7 8 21 | 3 5 22 | 4 8 23 | 2 8 24 | 5 7 25 | 7 3 26 | 8 1 27 | 1 7 28 | 1 2 3 29 | 4 5 6 30 | 7 8 5 31 | 9 10 11 32 | 6 12 2 33 | 7 13 10 34 | 4 14 13 35 | 12 15 16 36 | 1 17 14 37 | 8 9 15 38 | 17 18 11 39 | 3 16 18 40 | -------------------------------------------------------------------------------- /test/boolean/surfaces/cube8: -------------------------------------------------------------------------------- 1 | 8 18 12 GtsSurface GtsFace GtsEdge GtsVertex 2 | 2.876285154e-07 -1.632989974 -1.500000029 3 | 1.632990003 3.111904603e-07 -1.499999997 4 | 2.829951898e-07 -1.63299002 1.154699971 5 | 1.632989998 2.648572046e-07 1.154700003 6 | -2.823925276e-07 1.632990026 -1.499999971 7 | -2.870258532e-07 1.63298998 1.154700029 8 | -1.632989997 -2.588305827e-07 -1.500000003 9 | -1.632990002 -3.051638383e-07 1.154699997 10 | 1 2 11 | 2 3 12 | 3 1 13 | 2 4 14 | 3 4 15 | 2 5 16 | 5 4 17 | 5 6 18 | 4 6 19 | 5 7 20 | 7 6 21 | 7 8 22 | 6 8 23 | 8 3 24 | 8 1 25 | 7 1 26 | 5 1 27 | 6 3 28 | 1 2 3 29 | 4 5 2 30 | 6 7 4 31 | 8 9 7 32 | 10 11 8 33 | 12 13 11 34 | 14 15 3 35 | 12 16 15 36 | 10 17 16 37 | 6 1 17 38 | 9 18 5 39 | 13 14 18 40 | -------------------------------------------------------------------------------- /test/boolean/surfaces/cube9: -------------------------------------------------------------------------------- 1 | 8 18 12 GtsSurface GtsFace GtsEdge GtsVertex 2 | 1.154698303 -1.154698303 -1.5 3 | 1.154698303 1.154698303 -1.5 4 | 1.154698303 -1.154698303 1.1547 5 | 1.154698303 1.154698303 1.1547 6 | -1.154698303 1.154698303 -1.5 7 | -1.154698303 1.154698303 1.1547 8 | -1.154698303 -1.154698303 -1.5 9 | -1.154698303 -1.154698303 1.1547 10 | 1 2 11 | 2 3 12 | 3 1 13 | 2 4 14 | 3 4 15 | 2 5 16 | 5 4 17 | 5 6 18 | 4 6 19 | 5 7 20 | 7 6 21 | 7 8 22 | 6 8 23 | 8 3 24 | 8 1 25 | 7 1 26 | 5 1 27 | 6 3 28 | 1 2 3 29 | 4 5 2 30 | 6 7 4 31 | 8 9 7 32 | 10 11 8 33 | 12 13 11 34 | 14 15 3 35 | 12 16 15 36 | 10 17 16 37 | 6 1 17 38 | 9 18 5 39 | 13 14 18 40 | -------------------------------------------------------------------------------- /test/boolean/surfaces/cutter: -------------------------------------------------------------------------------- 1 | 32 90 60 GtsSurface GtsFace GtsEdge GtsVertex 2 | -0.3333333333 0.3333333333 -0.3333333333 3 | -1 0.3333333333 0.3333333333 4 | -0.3333333333 0.3333333333 0.3333333333 5 | -0.3333333333 -0.3333333333 -1 6 | 0.3333333333 -0.3333333333 -0.3333333333 7 | -0.3333333333 -0.3333333333 -0.3333333333 8 | -0.3333333333 -1 -0.3333333333 9 | 0.3333333333 -1 0.3333333333 10 | -0.3333333333 -1 0.3333333333 11 | 0.3333333333 1 -0.3333333333 12 | -0.3333333333 1 -0.3333333333 13 | -0.3333333333 1 0.3333333333 14 | 0.3333333333 -0.3333333333 0.3333333333 15 | 1 0.3333333333 0.3333333333 16 | 0.3333333333 0.3333333333 0.3333333333 17 | -0.3333333333 0.3333333333 -1 18 | -1 -0.3333333333 -0.3333333333 19 | -1 0.3333333333 -0.3333333333 20 | -0.3333333333 -0.3333333333 0.3333333333 21 | -0.3333333333 0.3333333333 1 22 | 0.3333333333 0.3333333333 1 23 | 0.3333333333 1 0.3333333333 24 | 1 0.3333333333 -0.3333333333 25 | 0.3333333333 0.3333333333 -0.3333333333 26 | -1 -0.3333333333 0.3333333333 27 | 0.3333333333 0.3333333333 -1 28 | -0.3333333333 -0.3333333333 1 29 | 0.3333333333 -0.3333333333 1 30 | 1 -0.3333333333 -0.3333333333 31 | 1 -0.3333333333 0.3333333333 32 | 0.3333333333 -0.3333333333 -1 33 | 0.3333333333 -1 -0.3333333333 34 | 1 2 35 | 3 2 36 | 1 3 37 | 4 5 38 | 6 5 39 | 4 6 40 | 7 8 41 | 9 8 42 | 7 9 43 | 10 11 44 | 12 11 45 | 10 12 46 | 13 14 47 | 14 15 48 | 13 15 49 | 4 16 50 | 16 6 51 | 17 18 52 | 1 18 53 | 17 1 54 | 8 13 55 | 9 13 56 | 17 6 57 | 6 19 58 | 17 19 59 | 15 20 60 | 21 20 61 | 21 15 62 | 22 12 63 | 22 10 64 | 23 24 65 | 24 15 66 | 23 15 67 | 6 1 68 | 1 16 69 | 19 13 70 | 19 9 71 | 1 11 72 | 1 10 73 | 25 19 74 | 17 25 75 | 13 21 76 | 24 10 77 | 24 22 78 | 14 23 79 | 26 16 80 | 26 1 81 | 19 3 82 | 25 3 83 | 7 6 84 | 6 9 85 | 24 1 86 | 27 28 87 | 28 21 88 | 27 21 89 | 13 28 90 | 15 22 91 | 29 23 92 | 29 14 93 | 24 26 94 | 2 25 95 | 15 3 96 | 3 22 97 | 20 27 98 | 5 24 99 | 5 23 100 | 19 28 101 | 30 14 102 | 29 30 103 | 31 26 104 | 31 24 105 | 18 25 106 | 32 5 107 | 5 13 108 | 32 13 109 | 12 3 110 | 19 27 111 | 3 27 112 | 5 29 113 | 5 30 114 | 31 5 115 | 2 18 116 | 32 8 117 | 4 26 118 | 11 3 119 | 20 3 120 | 7 5 121 | 13 30 122 | 4 31 123 | 7 32 124 | 1 2 3 125 | 4 5 6 126 | 7 8 9 127 | 10 11 12 128 | 13 14 15 129 | 16 6 17 130 | 18 19 20 131 | 8 21 22 132 | 23 24 25 133 | 26 27 28 134 | 12 29 30 135 | 31 32 33 136 | 17 34 35 137 | 20 34 23 138 | 22 36 37 139 | 38 10 39 140 | 25 40 41 141 | 15 28 42 142 | 43 30 44 143 | 33 14 45 144 | 46 35 47 145 | 40 48 49 146 | 50 9 51 147 | 39 43 52 148 | 53 54 55 149 | 42 54 56 150 | 44 57 32 151 | 58 45 59 152 | 47 52 60 153 | 49 2 61 154 | 51 37 24 155 | 62 57 63 156 | 55 27 64 157 | 65 31 66 158 | 36 56 67 159 | 59 68 69 160 | 70 60 71 161 | 18 41 72 162 | 73 74 75 163 | 63 29 76 164 | 48 77 78 165 | 66 58 79 166 | 67 53 77 167 | 79 69 80 168 | 71 65 81 169 | 72 61 82 170 | 75 21 83 171 | 16 46 84 172 | 38 3 85 173 | 78 64 86 174 | 50 5 87 175 | 88 68 13 176 | 80 88 74 177 | 89 81 4 178 | 19 82 1 179 | 90 83 7 180 | 84 70 89 181 | 85 76 11 182 | 62 86 26 183 | 87 73 90 184 | -------------------------------------------------------------------------------- /test/boolean/surfaces/gts-crash.gts: -------------------------------------------------------------------------------- 1 | # object: Sphere Tessellation 1 2 | # num points [42] num edges [120] num triangles [80] 3 | 42 120 80 4 | # points 5 | 2.6 4.25325 2.62866 6 | 2.6 5 0 7 | 5.1 4.04508 1.54508 8 | -0.0286556 -0 -4.25325 9 | 1.05492 -2.5 -4.04508 10 | -1.44508 -1.54508 -2.5 11 | -2.4 -0 0 12 | -1.44508 -1.54508 2.5 13 | -1.44508 1.54508 2.5 14 | 0.1 4.04508 -1.54508 15 | 2.6 4.25325 -2.62866 16 | 6.64508 1.54508 -2.5 17 | 4.14508 2.5 -4.04508 18 | 5.1 4.04508 -1.54508 19 | 5.22866 -0 4.25325 20 | 6.64508 1.54508 2.5 21 | 6.64508 -1.54508 2.5 22 | 2.6 -4.25325 2.62866 23 | 0.1 -4.04508 1.54508 24 | 1.05492 -2.5 4.04508 25 | -1.65325 -2.62866 0 26 | 6.85325 2.62866 0 27 | 7.6 -0 0 28 | 4.14508 -2.5 4.04508 29 | 5.1 -4.04508 1.54508 30 | 0.1 -4.04508 -1.54508 31 | 2.6 -0 -5 32 | 1.05492 2.5 4.04508 33 | 2.6 -0 5 34 | -0.0286556 -0 4.25325 35 | 0.1 4.04508 1.54508 36 | -1.65325 2.62866 0 37 | 1.05492 2.5 -4.04508 38 | -1.44508 1.54508 -2.5 39 | 5.22866 -0 -4.25325 40 | 2.6 -4.25325 -2.62866 41 | 4.14508 -2.5 -4.04508 42 | 4.14508 2.5 4.04508 43 | 6.64508 -1.54508 -2.5 44 | 5.1 -4.04508 -1.54508 45 | 2.6 -5 0 46 | 6.85325 -2.62866 0 47 | # edges 48 | 13 14 49 | 13 27 50 | 13 33 51 | 13 35 52 | 13 11 53 | 13 12 54 | 14 22 55 | 14 11 56 | 14 12 57 | 14 2 58 | 14 3 59 | 15 16 60 | 15 17 61 | 15 24 62 | 15 29 63 | 15 38 64 | 16 17 65 | 16 22 66 | 16 23 67 | 16 38 68 | 16 3 69 | 17 23 70 | 17 24 71 | 17 25 72 | 17 42 73 | 18 19 74 | 18 20 75 | 18 24 76 | 18 25 77 | 18 41 78 | 19 20 79 | 19 21 80 | 19 26 81 | 19 8 82 | 19 41 83 | 20 24 84 | 20 29 85 | 20 30 86 | 20 8 87 | 21 26 88 | 21 6 89 | 21 7 90 | 21 8 91 | 22 23 92 | 22 12 93 | 22 3 94 | 23 39 95 | 23 12 96 | 23 42 97 | 24 25 98 | 24 29 99 | 25 40 100 | 25 41 101 | 25 42 102 | 26 36 103 | 26 6 104 | 26 5 105 | 26 41 106 | 27 33 107 | 27 35 108 | 27 37 109 | 27 4 110 | 27 5 111 | 28 29 112 | 28 30 113 | 28 31 114 | 28 38 115 | 28 9 116 | 28 1 117 | 29 30 118 | 29 38 119 | 30 8 120 | 30 9 121 | 31 32 122 | 31 9 123 | 31 10 124 | 31 1 125 | 31 2 126 | 32 34 127 | 32 7 128 | 32 9 129 | 32 10 130 | 33 34 131 | 33 10 132 | 33 11 133 | 33 4 134 | 34 6 135 | 34 7 136 | 34 10 137 | 34 4 138 | 35 37 139 | 35 39 140 | 35 12 141 | 36 37 142 | 36 5 143 | 36 40 144 | 36 41 145 | 37 39 146 | 37 5 147 | 37 40 148 | 38 1 149 | 38 3 150 | 39 12 151 | 39 40 152 | 39 42 153 | 6 7 154 | 6 4 155 | 6 5 156 | 7 8 157 | 7 9 158 | 8 9 159 | 10 11 160 | 10 2 161 | 11 2 162 | 1 2 163 | 1 3 164 | 2 3 165 | 4 5 166 | 40 41 167 | 40 42 168 | # triangles 169 | 117 116 115 170 | 107 108 118 171 | 110 111 109 172 | 112 114 113 173 | 9 1 6 174 | 17 13 12 175 | 31 27 26 176 | 42 109 43 177 | 44 19 18 178 | 50 29 28 179 | 56 57 108 180 | 62 118 63 181 | 8 10 114 182 | 70 65 64 183 | 24 50 23 184 | 78 115 77 185 | 43 34 32 186 | 81 74 75 187 | 13 23 14 188 | 90 86 83 189 | 113 78 76 190 | 60 4 2 191 | 99 95 94 192 | 15 14 51 193 | 67 69 101 194 | 106 87 88 195 | 82 76 74 196 | 66 77 69 197 | 92 91 98 198 | 84 85 112 199 | 63 99 61 200 | 40 32 33 201 | 3 5 85 202 | 60 61 91 203 | 36 28 27 204 | 12 16 20 205 | 42 41 106 206 | 51 36 37 207 | 15 71 16 208 | 73 68 65 209 | 100 94 96 210 | 2 3 59 211 | 79 89 82 212 | 75 66 68 213 | 35 26 30 214 | 62 59 86 215 | 70 37 38 216 | 45 7 9 217 | 102 101 116 218 | 87 107 90 219 | 39 31 34 220 | 105 104 120 221 | 83 84 89 222 | 44 45 48 223 | 98 100 104 224 | 55 58 97 225 | 1 8 5 226 | 18 21 46 227 | 20 102 21 228 | 80 88 79 229 | 96 97 119 230 | 41 40 56 231 | 48 103 47 232 | 103 93 92 233 | 64 67 71 234 | 80 81 110 235 | 93 6 4 236 | 33 35 58 237 | 53 30 29 238 | 7 46 11 239 | 57 55 95 240 | 119 53 52 241 | 49 47 105 242 | 22 17 19 243 | 49 25 22 244 | 72 38 39 245 | 111 73 72 246 | 25 54 24 247 | 11 117 10 248 | 120 52 54 249 | -------------------------------------------------------------------------------- /test/boolean/surfaces/gts-crash1.gts: -------------------------------------------------------------------------------- 1 | # object: Sphere Tessellation 2 2 | # num points [42] num edges [120] num triangles [80] 3 | 42 120 80 4 | # points 5 | -0 4.25325 2.62866 6 | -1.54508 2.5 4.04508 7 | -2.5 4.04508 1.54508 8 | 5 -0 0 9 | 4.04508 -1.54508 -2.5 10 | 4.04508 1.54508 -2.5 11 | 4.04508 1.54508 2.5 12 | 4.04508 -1.54508 2.5 13 | -4.04508 1.54508 2.5 14 | -5 -0 0 15 | -4.25325 2.62866 0 16 | 1.54508 -2.5 4.04508 17 | -0 -0 5 18 | 2.62866 -0 4.25325 19 | 4.25325 2.62866 0 20 | 2.5 4.04508 1.54508 21 | 1.54508 2.5 -4.04508 22 | -0 -0 -5 23 | 2.62866 -0 -4.25325 24 | -0 4.25325 -2.62866 25 | -2.5 4.04508 -1.54508 26 | -1.54508 2.5 -4.04508 27 | 4.25325 -2.62866 0 28 | 2.5 -4.04508 1.54508 29 | -2.62866 -0 4.25325 30 | 2.5 -4.04508 -1.54508 31 | -0 -5 0 32 | 2.5 4.04508 -1.54508 33 | -1.54508 -2.5 -4.04508 34 | -2.62866 -0 -4.25325 35 | -4.04508 -1.54508 2.5 36 | -4.04508 -1.54508 -2.5 37 | -2.5 -4.04508 -1.54508 38 | -0 -4.25325 2.62866 39 | -1.54508 -2.5 4.04508 40 | -4.04508 1.54508 -2.5 41 | -0 5 0 42 | -0 -4.25325 -2.62866 43 | 1.54508 -2.5 -4.04508 44 | -4.25325 -2.62866 0 45 | -2.5 -4.04508 1.54508 46 | 1.54508 2.5 4.04508 47 | # edges 48 | 1 2 49 | 1 3 50 | 1 16 51 | 1 37 52 | 1 42 53 | 2 3 54 | 2 9 55 | 2 13 56 | 2 25 57 | 2 42 58 | 3 9 59 | 3 11 60 | 3 21 61 | 3 37 62 | 4 5 63 | 4 6 64 | 4 7 65 | 4 8 66 | 4 15 67 | 4 23 68 | 5 6 69 | 5 19 70 | 5 23 71 | 5 26 72 | 5 39 73 | 6 15 74 | 6 17 75 | 6 19 76 | 6 28 77 | 7 8 78 | 7 14 79 | 7 15 80 | 7 16 81 | 7 42 82 | 8 12 83 | 8 14 84 | 8 23 85 | 8 24 86 | 9 10 87 | 9 11 88 | 9 25 89 | 9 31 90 | 10 11 91 | 10 31 92 | 10 32 93 | 10 36 94 | 10 40 95 | 11 21 96 | 11 36 97 | 12 13 98 | 12 14 99 | 12 24 100 | 12 34 101 | 12 35 102 | 13 14 103 | 13 25 104 | 13 35 105 | 13 42 106 | 14 42 107 | 15 16 108 | 15 28 109 | 16 28 110 | 16 37 111 | 16 42 112 | 17 18 113 | 17 19 114 | 17 20 115 | 17 22 116 | 17 28 117 | 18 19 118 | 18 22 119 | 18 29 120 | 18 30 121 | 18 39 122 | 19 39 123 | 20 21 124 | 20 22 125 | 20 28 126 | 20 37 127 | 21 22 128 | 21 36 129 | 21 37 130 | 22 30 131 | 22 36 132 | 23 24 133 | 23 26 134 | 24 26 135 | 24 27 136 | 24 34 137 | 25 31 138 | 25 35 139 | 26 27 140 | 26 38 141 | 26 39 142 | 27 33 143 | 27 34 144 | 27 38 145 | 27 41 146 | 28 37 147 | 29 30 148 | 29 32 149 | 29 33 150 | 29 38 151 | 29 39 152 | 30 32 153 | 30 36 154 | 31 35 155 | 31 40 156 | 31 41 157 | 32 33 158 | 32 36 159 | 32 40 160 | 33 38 161 | 33 40 162 | 33 41 163 | 34 35 164 | 34 41 165 | 35 41 166 | 38 39 167 | 40 41 168 | # triangles 169 | 6 2 1 170 | 16 21 15 171 | 18 30 17 172 | 43 40 39 173 | 55 51 50 174 | 32 33 60 175 | 70 66 65 176 | 80 77 76 177 | 20 15 23 178 | 37 85 38 179 | 41 7 9 180 | 92 88 87 181 | 29 69 27 182 | 73 100 72 183 | 42 41 90 184 | 110 102 101 185 | 54 53 116 186 | 68 67 77 187 | 49 81 48 188 | 52 89 53 189 | 39 42 44 190 | 76 79 82 191 | 104 103 119 192 | 47 44 108 193 | 82 14 13 194 | 56 57 91 195 | 73 71 83 196 | 93 97 92 197 | 36 35 51 198 | 38 52 35 199 | 26 61 29 200 | 112 114 110 201 | 14 4 2 202 | 61 60 62 203 | 72 104 74 204 | 88 96 89 205 | 47 112 45 206 | 90 91 107 207 | 115 98 95 208 | 45 111 46 209 | 70 74 75 210 | 69 78 67 211 | 102 113 103 212 | 48 13 12 213 | 63 3 4 214 | 11 6 7 215 | 28 27 66 216 | 86 87 85 217 | 22 75 25 218 | 111 105 106 219 | 118 116 117 220 | 114 120 115 221 | 56 9 8 222 | 62 63 99 223 | 20 37 18 224 | 50 54 57 225 | 31 59 34 226 | 105 101 100 227 | 78 99 79 228 | 25 94 24 229 | 65 68 71 230 | 94 119 93 231 | 43 46 49 232 | 108 109 120 233 | 19 26 16 234 | 98 117 96 235 | 10 1 5 236 | 30 36 31 237 | 107 118 109 238 | 64 5 3 239 | 40 12 11 240 | 84 80 81 241 | 8 10 58 242 | 23 24 86 243 | 106 83 84 244 | 21 28 22 245 | 113 95 97 246 | 19 17 32 247 | 34 64 33 248 | 55 58 59 249 | -------------------------------------------------------------------------------- /test/boolean/surfaces/loc1: -------------------------------------------------------------------------------- 1 | 4 6 4 2 | 1 0 0 3 | 0 0 1 4 | 0 0 0 5 | 0 1 0 6 | 1 2 7 | 3 2 8 | 3 1 9 | 3 4 10 | 1 4 11 | 4 2 12 | 1 2 3 13 | 4 5 3 14 | 2 6 4 15 | 6 1 5 16 | -------------------------------------------------------------------------------- /test/boolean/surfaces/loc2: -------------------------------------------------------------------------------- 1 | 4 6 4 2 | 0.5 0 1 3 | 0.5 1 0 4 | 0.5 0 0 5 | 1.5 0 0 6 | 1 2 7 | 3 2 8 | 3 1 9 | 4 2 10 | 4 1 11 | 3 4 12 | 1 2 3 13 | 4 1 5 14 | 5 3 6 15 | 2 4 6 16 | -------------------------------------------------------------------------------- /test/boolean/surfaces/p1: -------------------------------------------------------------------------------- 1 | 8 18 12 GtsSurface GtsFace GtsEdge GtsVertex 2 | 0 1 2 3 | 0 1 0 4 | 0 0 1 5 | 1 1 0 6 | 1 0 1 7 | 1 0 0 8 | 0 0 0 9 | 1 1 2 10 | 1 2 11 | 3 2 12 | 1 3 13 | 4 5 14 | 6 5 15 | 6 4 16 | 7 2 17 | 4 2 18 | 7 4 19 | 7 6 20 | 8 5 21 | 4 8 22 | 7 5 23 | 3 5 24 | 7 3 25 | 8 2 26 | 3 8 27 | 1 8 28 | 1 2 3 29 | 4 5 6 30 | 7 8 9 31 | 9 6 10 32 | 11 4 12 33 | 5 13 10 34 | 13 14 15 35 | 8 16 12 36 | 2 7 15 37 | 17 18 3 38 | 14 11 17 39 | 16 1 18 40 | -------------------------------------------------------------------------------- /test/boolean/surfaces/p2: -------------------------------------------------------------------------------- 1 | 20 54 36 GtsSurface GtsFace GtsEdge GtsVertex 2 | 0.889865686 1.806185912 0.7958760584 3 | 1.369642857 1.108928571 1.260714286 4 | 0 1.494230769 1.003846154 5 | 0 0 2 6 | 0 0.8320502943 2.445299804 7 | 0 0.3705118328 1.752992111 8 | 1.10594603 2.418820147 1.387453235 9 | 1.5125 1.5375 1.975 10 | 2 3 1 11 | 1.267261242 0.8017837257 2.465477516 12 | 0 1.955769231 1.696153846 13 | 0 2.629488167 1.247007889 14 | 0 3 1 15 | 0 2.167949706 0.5547001962 16 | 1 0 3 17 | 0 0 3 18 | 1 0 2 19 | 1.732738758 2.198216274 0.5345224838 20 | 0 3 0 21 | 2 3 0 22 | 1 2 23 | 3 2 24 | 3 1 25 | 4 5 26 | 6 5 27 | 6 4 28 | 7 8 29 | 9 8 30 | 7 9 31 | 10 2 32 | 8 2 33 | 8 10 34 | 7 11 35 | 8 11 36 | 12 13 37 | 14 13 38 | 12 14 39 | 6 2 40 | 3 6 41 | 15 16 42 | 4 16 43 | 4 15 44 | 16 5 45 | 14 3 46 | 11 3 47 | 14 11 48 | 10 17 49 | 2 17 50 | 15 5 51 | 18 1 52 | 19 1 53 | 18 19 54 | 6 17 55 | 19 13 56 | 9 13 57 | 9 19 58 | 4 17 59 | 10 5 60 | 10 15 61 | 12 11 62 | 15 17 63 | 7 12 64 | 14 19 65 | 7 13 66 | 14 1 67 | 18 20 68 | 9 20 69 | 9 18 70 | 11 5 71 | 8 5 72 | 19 20 73 | 3 5 74 | 18 2 75 | 18 8 76 | 1 2 3 77 | 4 5 6 78 | 7 8 9 79 | 10 11 12 80 | 13 14 7 81 | 15 16 17 82 | 2 18 19 83 | 20 21 22 84 | 23 4 21 85 | 24 25 26 86 | 27 28 10 87 | 29 23 20 88 | 30 31 32 89 | 28 33 18 90 | 34 35 36 91 | 33 37 6 92 | 38 29 39 93 | 26 40 17 94 | 41 27 39 95 | 40 13 42 96 | 16 34 43 97 | 35 44 9 98 | 37 41 22 99 | 31 45 43 100 | 46 47 48 101 | 49 50 14 102 | 45 3 24 103 | 51 46 32 104 | 52 49 25 105 | 47 51 36 106 | 11 53 54 107 | 44 15 42 108 | 50 38 12 109 | 8 54 48 110 | 53 1 30 111 | 5 52 19 112 | -------------------------------------------------------------------------------- /test/boolean/surfaces/sponge: -------------------------------------------------------------------------------- 1 | 8 18 12 GtsSurface GtsFace GtsEdge GtsVertex 2 | 1 -1 -1 3 | 1 1 -1 4 | 1 1 1 5 | 1 -1 1 6 | -1 -1 1 7 | -1 -1 -1 8 | -1 1 1 9 | -1 1 -1 10 | 1 2 11 | 3 2 12 | 1 3 13 | 4 3 14 | 1 4 15 | 5 4 16 | 5 3 17 | 6 1 18 | 6 4 19 | 3 7 20 | 7 5 21 | 6 5 22 | 6 8 23 | 8 5 24 | 7 8 25 | 2 8 26 | 6 2 27 | 2 7 28 | 1 2 3 29 | 3 4 5 30 | 6 4 7 31 | 8 5 9 32 | 7 10 11 33 | 9 6 12 34 | 13 12 14 35 | 14 11 15 36 | 13 16 17 37 | 16 15 18 38 | 17 1 8 39 | 18 10 2 40 | -------------------------------------------------------------------------------- /test/boolean/surfaces/t1: -------------------------------------------------------------------------------- 1 | 3 3 1 2 | 1 0 0 A 3 | 0 1 0 B 4 | -1 0 0 C 5 | 1 2 AB 6 | 2 3 BC 7 | 3 1 CA 8 | 1 2 3 ABC 9 | -------------------------------------------------------------------------------- /test/boolean/surfaces/t10: -------------------------------------------------------------------------------- 1 | 3 3 1 2 | 0 -1 0 3 | 0 0 -1 4 | 0 0 1 5 | 1 2 6 | 2 3 7 | 3 1 8 | 1 2 3 9 | -------------------------------------------------------------------------------- /test/boolean/surfaces/t11: -------------------------------------------------------------------------------- 1 | 3 3 1 2 | 0 -1 0 G 3 | -1 0 -1 E 4 | -1 0 1 F 5 | 1 2 GE 6 | 2 3 EF 7 | 3 1 GF 8 | 1 2 3 GEF 9 | -------------------------------------------------------------------------------- /test/boolean/surfaces/t12: -------------------------------------------------------------------------------- 1 | 4 5 2 2 | 0 -1 0 D 3 | 0 0 -1 E 4 | 0 0 1 F 5 | 1 0.5 0 G 6 | 1 2 DE 7 | 2 3 EF 8 | 3 1 FD 9 | 4 2 GE 10 | 4 3 GF 11 | 1 2 3 DEF 12 | 5 2 4 GEF 13 | -------------------------------------------------------------------------------- /test/boolean/surfaces/t13: -------------------------------------------------------------------------------- 1 | 4 5 2 2 | 0 -1 0 D 3 | 0 0 -1 E 4 | 0 0 1 F 5 | 0 1.5 0 G 6 | 1 2 DE 7 | 2 3 EF 8 | 3 1 FD 9 | 4 2 GE 10 | 4 3 GF 11 | 1 2 3 DEF 12 | 5 2 4 GEF 13 | -------------------------------------------------------------------------------- /test/boolean/surfaces/t14: -------------------------------------------------------------------------------- 1 | 8 18 4 2 | 0 -1.63299 -1.1547 A 3 | -1.63299 0 -1.1547 D 4 | 0 1.63299 -1.1547 C 5 | 1.63299 0 -1.1547 B 6 | 0 -1.63299 1.1547 F 7 | -1.63299 0 1.1547 E 8 | 0 1.63299 1.1547 9 | 1.63299 0 1.1547 10 | 3 1 CA 11 | 2 1 DA 12 | 6 1 EA 13 | 2 6 DE 14 | 2 7 15 | 3 2 CD 16 | 3 7 17 | 3 8 18 | 4 3 BC 19 | 4 8 20 | 5 1 FA 21 | 4 5 BF 22 | 1 4 AB 23 | 6 5 EF 24 | 7 6 25 | 5 8 26 | 7 5 27 | 8 7 28 | 9 13 1 ABC 29 | 6 1 2 ACD 30 | 4 2 3 ADE 31 | 14 3 11 EAF 32 | -------------------------------------------------------------------------------- /test/boolean/surfaces/t15: -------------------------------------------------------------------------------- 1 | 4 6 2 2 | -1.63299 -0.942809 -0.666667 J 3 | 0 1.88562 -0.666667 I 4 | 1.63299 -0.942809 -0.666667 H 5 | 0 0 2 G 6 | 2 1 IJ 7 | 3 2 HI 8 | 2 4 IG 9 | 1 3 JH 10 | 4 1 GJ 11 | 3 4 HG 12 | 5 3 1 IGJ 13 | 6 5 4 HGJ 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /test/boolean/surfaces/t16: -------------------------------------------------------------------------------- 1 | 4 5 2 2 | 1 0 0 A 3 | 0 1 0 B 4 | -1 0 0 C 5 | 0 -2 -0.5 D 6 | 1 2 AB 7 | 2 3 BC 8 | 3 1 CA 9 | 1 4 AD 10 | 3 4 CD 11 | 1 2 3 ABC 12 | 3 5 4 ACD 13 | -------------------------------------------------------------------------------- /test/boolean/surfaces/t17: -------------------------------------------------------------------------------- 1 | 3 3 1 GtsSurface GtsNFace GtsNEdge GtsNVertex 2 | 0 0 1 A 3 | 0.045944 1.43664e-16 0.998944 B 4 | 0.0141975 0.0436953 0.998944 C 5 | 1 2 AB 6 | 2 3 BC 7 | 1 3 AC 8 | 1 2 3 ABC 9 | -------------------------------------------------------------------------------- /test/boolean/surfaces/t18: -------------------------------------------------------------------------------- 1 | 3 3 1 GtsSurface GtsNFace GtsNEdge GtsNVertex 2 | 0 0 1 D 3 | 0.197173 6.16548e-16 0.980369 E 4 | 0.0609297 0.187522 0.980369 F 5 | 1 2 DE 6 | 2 3 EF 7 | 1 3 FD 8 | 1 2 3 DEF 9 | -------------------------------------------------------------------------------- /test/boolean/surfaces/t19: -------------------------------------------------------------------------------- 1 | 4 5 1 2 | 1 0 0 A 3 | 0 1 0 B 4 | -1 0 0 C 5 | 0 -1 0 D 6 | 1 2 AB 7 | 2 3 BC 8 | 3 4 CD 9 | 4 1 DA 10 | 2 4 BD 11 | 1 5 4 ABD 12 | 2 3 5 BCD 13 | -------------------------------------------------------------------------------- /test/boolean/surfaces/t2: -------------------------------------------------------------------------------- 1 | 3 3 1 2 | 0 -1 0 E 3 | 0 0.5 -1 F 4 | 0 0.5 1 G 5 | 1 2 EF 6 | 2 3 FG 7 | 3 1 GE 8 | 1 2 3 EFG 9 | -------------------------------------------------------------------------------- /test/boolean/surfaces/t20: -------------------------------------------------------------------------------- 1 | 4 5 2 2 | 0 1 0.5 E 3 | 0 -1 0.5 F 4 | 0 -1 -0.5 G 5 | 0 1 -0.5 H 6 | 1 2 EF 7 | 2 3 FG 8 | 3 4 GH 9 | 4 1 HE 10 | 1 3 EG 11 | 1 2 5 EFG 12 | 3 4 5 GHE 13 | -------------------------------------------------------------------------------- /test/boolean/surfaces/t21: -------------------------------------------------------------------------------- 1 | 4 5 1 2 | 0 0.5 1 E 3 | 0 0.5 -1 F 4 | 0 -0.5 -1 G 5 | 0 -0.5 1 H 6 | 1 2 EF 7 | 2 3 FG 8 | 3 4 GH 9 | 4 1 HE 10 | 1 3 EG 11 | 1 2 5 EFG 12 | 3 4 5 GHE 13 | -------------------------------------------------------------------------------- /test/boolean/surfaces/t22: -------------------------------------------------------------------------------- 1 | 3 3 1 2 | 1 0 0 D 3 | 0 0 1 E 4 | -1 0 0 F 5 | 1 2 DE 6 | 2 3 EF 7 | 3 1 FD 8 | 1 2 3 DEF 9 | -------------------------------------------------------------------------------- /test/boolean/surfaces/t23: -------------------------------------------------------------------------------- 1 | 3 3 1 2 | 1.5 0 0 D 3 | 0 0 1 E 4 | -1 0 0 F 5 | 1 2 DE 6 | 2 3 EF 7 | 3 1 FD 8 | 1 2 3 DEF 9 | -------------------------------------------------------------------------------- /test/boolean/surfaces/t24: -------------------------------------------------------------------------------- 1 | 3 3 1 2 | 1.5 0 0 D 3 | 0 0 1 E 4 | -1.5 0 0 F 5 | 1 2 DE 6 | 2 3 EF 7 | 3 1 FD 8 | 1 2 3 DEF 9 | -------------------------------------------------------------------------------- /test/boolean/surfaces/t25: -------------------------------------------------------------------------------- 1 | 3 3 1 2 | -0.198159 1.13233e-16 -0.985271 A 3 | -0.28322 0.205771 -0.942056 B 4 | -0.419495 2.39712e-16 -0.913263 C 5 | 1 2 AB 6 | 2 3 BC 7 | 3 1 CA 8 | 1 2 3 ABC 9 | -------------------------------------------------------------------------------- /test/boolean/surfaces/t26: -------------------------------------------------------------------------------- 1 | 3 3 1 2 | -0.361845 2.06769e-16 -0.932238 D 3 | -0.417408 2.38519e-16 -0.908719 E 4 | -0.386478 -0.050289 -0.920926 F 5 | 1 2 DE 6 | 2 3 EF 7 | 3 1 FD 8 | 1 2 3 DEF 9 | -------------------------------------------------------------------------------- /test/boolean/surfaces/t27: -------------------------------------------------------------------------------- 1 | 8 18 2 2 | 0 -1.63299 -1.5 3 | -1.63299 0 -1.5 4 | 0 1.63299 -1.5 5 | 1.63299 0 -1.5 6 | 0 -1.63299 1.1547 7 | -1.63299 0 1.1547 8 | 0 1.63299 1.1547 9 | 1.63299 0 1.1547 10 | 3 1 11 | 2 1 12 | 6 1 13 | 2 6 14 | 2 7 15 | 3 2 16 | 3 7 17 | 3 8 18 | 4 3 19 | 4 8 20 | 5 1 21 | 4 5 22 | 1 4 23 | 6 5 24 | 7 6 25 | 5 8 26 | 7 5 27 | 8 7 28 | 6 1 2 29 | 4 2 3 30 | -------------------------------------------------------------------------------- /test/boolean/surfaces/t28: -------------------------------------------------------------------------------- 1 | 8 18 1 2 | 0 -1.63299 -2 3 | -1.63299 0 -2 4 | 0 1.63299 -2 5 | 1.63299 0 -2 6 | 0 -1.63299 2 7 | -1.63299 0 2 8 | 0 1.63299 2 9 | 1.63299 0 2 10 | 3 1 11 | 2 1 12 | 6 1 13 | 2 6 14 | 2 7 15 | 3 2 16 | 3 7 17 | 3 8 18 | 4 3 19 | 4 8 20 | 5 1 21 | 4 5 22 | 1 4 23 | 6 5 24 | 7 6 25 | 5 8 26 | 7 5 27 | 8 7 28 | 4 2 3 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /test/boolean/surfaces/t29: -------------------------------------------------------------------------------- 1 | 4 5 2 2 | -1 0 0 A 3 | 0 0 0 B 4 | 0 -1 0 C 5 | 0 0 1 D 6 | 1 2 AB 7 | 2 4 BD 8 | 4 1 DA 9 | 2 3 BC 10 | 3 4 CD 11 | 1 2 3 ABD 12 | 4 5 2 BCD 13 | -------------------------------------------------------------------------------- /test/boolean/surfaces/t3: -------------------------------------------------------------------------------- 1 | 4 5 2 2 | 0 -1 0 3 | 0 0.5 -1 4 | 0 0.5 1 5 | 1 0.5 0 6 | 1 2 7 | 2 3 8 | 3 1 9 | 4 2 10 | 4 3 11 | 1 2 3 12 | 5 2 4 13 | -------------------------------------------------------------------------------- /test/boolean/surfaces/t30: -------------------------------------------------------------------------------- 1 | 4 5 2 2 | 1 0 0 F 3 | 0 0 0 G 4 | 0 1 0 E 5 | 0 0 1 H 6 | 1 2 FG 7 | 2 4 GH 8 | 4 1 HF 9 | 2 3 GE 10 | 3 4 EH 11 | 1 2 3 FGH 12 | 4 5 2 GEH 13 | -------------------------------------------------------------------------------- /test/boolean/surfaces/t31: -------------------------------------------------------------------------------- 1 | 4 5 2 2 | -1 0 0 A 3 | 1 0 0 B 4 | 0 1 0 C 5 | 0 -1 0 D 6 | 1 2 AB 7 | 2 3 BC 8 | 3 1 CA 9 | 1 4 AD 10 | 4 2 DB 11 | 1 2 3 ABC 12 | 4 5 1 ADB 13 | -------------------------------------------------------------------------------- /test/boolean/surfaces/t32: -------------------------------------------------------------------------------- 1 | 3 3 1 2 | -0.5 0 -1 E 3 | 0.5 0 -1 F 4 | 0 0 1 G 5 | 1 2 EF 6 | 2 3 FG 7 | 3 1 GE 8 | 1 2 3 EFG 9 | -------------------------------------------------------------------------------- /test/boolean/surfaces/t4: -------------------------------------------------------------------------------- 1 | 4 5 2 2 | 0 -1 0 D 3 | 0 0.5 -1 E 4 | 0 0.5 1 F 5 | 0 1.5 0 G 6 | 1 2 DE 7 | 2 3 EF 8 | 3 1 FD 9 | 4 2 GE 10 | 4 3 GF 11 | 1 2 3 DEF 12 | 5 2 4 GEF 13 | -------------------------------------------------------------------------------- /test/boolean/surfaces/t5: -------------------------------------------------------------------------------- 1 | 4 5 2 2 | 0 -1 0 3 | 0 0.5 -1 4 | 0 0.5 1 5 | 1 -0.5 0 6 | 1 2 7 | 2 3 8 | 3 1 9 | 4 2 10 | 4 3 11 | 1 2 3 12 | 5 2 4 13 | -------------------------------------------------------------------------------- /test/boolean/surfaces/t6: -------------------------------------------------------------------------------- 1 | 3 3 1 2 | 0 0.4 0 D 3 | 0 0.6 -1 E 4 | 0 0.5 1 F 5 | 1 2 DE 6 | 2 3 EF 7 | 3 1 FD 8 | 1 2 3 DEF 9 | -------------------------------------------------------------------------------- /test/boolean/surfaces/t7: -------------------------------------------------------------------------------- 1 | 3 3 1 2 | 0 0.4 0 D 3 | 0 0.6 -1 E 4 | 0 0.5 0 F 5 | 1 2 DE 6 | 2 3 EF 7 | 3 1 FD 8 | 1 2 3 EFD 9 | -------------------------------------------------------------------------------- /test/boolean/surfaces/t9: -------------------------------------------------------------------------------- 1 | 4 5 2 2 | 0 -1 0 D 3 | 0 0.5 -1 E 4 | 0 0.5 1 F 5 | 0 1 0 G 6 | 1 2 DE 7 | 2 3 EF 8 | 3 1 FD 9 | 4 2 GE 10 | 4 3 GF 11 | 1 2 3 DEF 12 | 5 2 4 EGF 13 | -------------------------------------------------------------------------------- /test/boolean/test.sh.in: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | make boole@EXEEXT@ cubes@EXEEXT@ set@EXEEXT@ 4 | 5 | rm -f errors 6 | if awk '{ 7 | if (NF >= 2 && NF <= 3 && substr ($1, 1, 1) != "#") { 8 | summary = $1 " " $2; 9 | command = "./set@EXEEXT@ surfaces/" $1 " surfaces/" $2; 10 | if (NF == 3 && $3 == "XFAIL") 11 | xfailed = 1; 12 | else 13 | xfailed = 0; 14 | setfailed = 0; 15 | if (system (command " > /dev/null 2> log")) { 16 | system ("echo \"======== set " summary " ========\" >> errors; cat log >> errors"); 17 | if (xfailed) 18 | print "XFAIL: set " summary; 19 | else { 20 | print "FAIL: set " summary; 21 | failed++; 22 | } 23 | setfailed = 1; 24 | } 25 | else { 26 | if (system ("grep CRITICAL log > /dev/null") && 27 | !system ("grep \"duplicate edges: 0\" log > /dev/null")) { 28 | if (xfailed) 29 | print "XPASS: set " summary; 30 | else 31 | print "PASS: set " summary; 32 | } 33 | else { 34 | system ("echo \"======== set " summary " ========\" >> errors; cat log >> errors"); 35 | if (xfailed) 36 | print "XFAIL: set " summary; 37 | else { 38 | print "FAIL: set " summary; 39 | failed++; 40 | } 41 | setfailed = 1; 42 | } 43 | } 44 | total++; 45 | if (!setfailed && 46 | !system ("../../tools/gtscheck@EXEEXT@ -v 2> log < surfaces/" $1) && 47 | !system ("grep \"boundary edges: 0\" log > /dev/null") && 48 | !system ("../../tools/gtscheck@EXEEXT@ -v 2> log < surfaces/" $2) && 49 | !system ("grep \"boundary edges: 0\" log > /dev/null")) { 50 | command = "./boole@EXEEXT@ surfaces/" $1 " surfaces/" $2; 51 | if (system (command " > /dev/null 2> log")) { 52 | system ("echo \"======== boole " summary " ========\" >> errors; cat log >> errors"); 53 | if (xfailed) 54 | print "XFAIL: boole " summary; 55 | else { 56 | print "FAIL: boole " summary; 57 | failed++; 58 | } 59 | } 60 | else { 61 | if (system ("grep CRITICAL log > /dev/null") && 62 | !system ("grep \"duplicate edges: 0\" log > /dev/null")) { 63 | if (xfailed) 64 | print "XPASS: boole " summary; 65 | else 66 | print "PASS: boole " summary; 67 | } 68 | else { 69 | system ("echo \"======== boole " summary " ========\" >> errors; cat log >> errors"); 70 | if (xfailed) 71 | print "XFAIL: boole " summary; 72 | else { 73 | print "FAIL: boole " summary; 74 | failed++; 75 | } 76 | } 77 | } 78 | total++; 79 | } 80 | } 81 | } 82 | END { 83 | if (failed > 0) 84 | msg = failed " of " total " tests failed"; 85 | else 86 | msg = "All " total " tests passed"; 87 | line = msg; 88 | gsub (".", "=", line); 89 | print line; 90 | print msg; 91 | print line; 92 | if (failed > 0) 93 | exit (1); 94 | else 95 | exit (0); 96 | }' < tests; then 97 | ret=0; 98 | else 99 | ret=1; 100 | fi 101 | rm -f log 102 | exit $ret; 103 | -------------------------------------------------------------------------------- /test/boolean/tests: -------------------------------------------------------------------------------- 1 | # simple degenerate cases 2 | t1 t2 3 | t1 t3 4 | t1 t4 5 | t1 t5 6 | t1 t6 7 | t1 t7 8 | t1 t9 9 | t1 t10 10 | t1 t11 11 | t1 t12 12 | t1 t13 13 | t14 t15 14 | t11 t16 15 | t17 t18 16 | t19 t20 17 | t19 t21 18 | t31 t32 19 | 20 | # Various cubes 21 | t1 t22 22 | t1 t23 23 | t1 t24 24 | t27 t28 25 | cube cube1 26 | cube cube2 27 | cube cube5 28 | 29 | # touching corner 30 | t29 t30 31 | 32 | # cube and sligthly rotated cube 33 | cube cube8 34 | 35 | # cubes just touching through one edge (like t29 t30) 36 | cube9 cube10 37 | 38 | # Floating point problems 39 | t25 t26 40 | 41 | # Coincident faces 42 | cube cube4 43 | 44 | # Rotated cube cube1 (touching faces) 45 | cube6 cube7 46 | 47 | # Coincident faces (tetrahedra by T. Binder) 48 | loc1 loc2 49 | 50 | # Coincident faces (again by T. Binder) 51 | p1 p2 52 | 53 | # Menger sponge (by B. Petit) 54 | sponge cutter 55 | 56 | # cylinders (by Darie Aron) 57 | 1.gts 2.gts 58 | 59 | # horse and sligthly rotated horse 60 | horse5.gts horse6.gts 61 | 62 | # simplified horse 63 | horse4.gts horse5.gts XFAIL 64 | 65 | # identical surfaces 66 | horse5.gts horse5.gts XFAIL 67 | sphere.gts sphere.gts 68 | 69 | # tetrahedra by Wayne Gramlich 70 | # looks like it works but visual inspection shows it doesn't 71 | # (now it should work: Sept 2003) 72 | a8.gts b8.gts 73 | a9.gts b9.gts 74 | a10.gts b10.gts 75 | a23.gts b23.gts 76 | a24.gts b24.gts 77 | a25.gts b25.gts 78 | 79 | # Spheres by Romain Behar 80 | gts-crash.gts gts-crash1.gts 81 | -------------------------------------------------------------------------------- /test/clipping/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to produce Makefile.in 2 | 3 | INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src -I$(includedir)\ 4 | -DG_LOG_DOMAIN=\"Gts-test\" 5 | LDADD = $(top_builddir)/src/libgts.la -lm 6 | DEPS = $(top_builddir)/src/libgts.la 7 | 8 | check_PROGRAMS = clipping 9 | 10 | TESTS = \ 11 | clipping_c1_c2.sh \ 12 | clipping_c1_c4.sh \ 13 | clipping_c1_c7.sh \ 14 | clipping_l1_l2.sh \ 15 | clipping_l1_l3.sh \ 16 | ## two squares touching at one vertex 17 | clipping_c1_c5.sh \ 18 | ## two squares touching at one edge 19 | clipping_c1_c6.sh \ 20 | ## two colinear segments 21 | clipping_l1_l5.sh \ 22 | ## two squares with coincident edges 23 | clipping_c1_c3.sh \ 24 | ## a square and a rectangle touching at one edge 25 | clipping_c1_c8.sh \ 26 | ## a square and a rectangle touching at one edge and one vertex 27 | clipping_c1_c9.sh \ 28 | ## two colinear segments 29 | clipping_l1_l4.sh 30 | 31 | XFAIL_TESTS = 32 | 33 | EXTRA_DIST = \ 34 | c1 c2 c3 c4 c5 c6 c7 c8 c9 \ 35 | l1 l2 l3 l4 l5 \ 36 | clipping.sh \ 37 | $(TESTS) 38 | 39 | test-cleanup: 40 | rm -f errors 41 | 42 | check-TESTS: test-cleanup 43 | -------------------------------------------------------------------------------- /test/clipping/c1: -------------------------------------------------------------------------------- 1 | 4 4 2 | 0 0 3 | 1 0 4 | 1 1 5 | 0 1 6 | 1 2 7 | 2 3 8 | 3 4 9 | 4 1 10 | -------------------------------------------------------------------------------- /test/clipping/c10: -------------------------------------------------------------------------------- 1 | 3 2 2 | 1.5 1 3 | 0.5 1 4 | 0.5 0 5 | 1 2 6 | 2 3 7 | -------------------------------------------------------------------------------- /test/clipping/c2: -------------------------------------------------------------------------------- 1 | 4 4 2 | 0.5 0.5 3 | 1.5 0.5 4 | 1.5 1.5 5 | 0.5 1.5 6 | 1 2 7 | 2 3 8 | 3 4 9 | 4 1 10 | -------------------------------------------------------------------------------- /test/clipping/c3: -------------------------------------------------------------------------------- 1 | 4 4 2 | 0.5 0 3 | 1.5 0 4 | 1.5 1 5 | 0.5 1 6 | 1 2 7 | 2 3 8 | 3 4 9 | 4 1 10 | -------------------------------------------------------------------------------- /test/clipping/c4: -------------------------------------------------------------------------------- 1 | 4 4 2 | 0.5 -0.5 3 | 1.5 -0.5 4 | 1.5 1.5 5 | 0.5 1.5 6 | 1 2 7 | 2 3 8 | 3 4 9 | 4 1 10 | -------------------------------------------------------------------------------- /test/clipping/c5: -------------------------------------------------------------------------------- 1 | 4 4 2 | 1 1 3 | 1.5 1 4 | 1.5 1.5 5 | 1 1.5 6 | 1 2 7 | 2 3 8 | 3 4 9 | 4 1 10 | -------------------------------------------------------------------------------- /test/clipping/c6: -------------------------------------------------------------------------------- 1 | 4 4 2 | 1 0 3 | 2 0 4 | 2 1 5 | 1 1 6 | 1 2 7 | 2 3 8 | 3 4 9 | 4 1 10 | -------------------------------------------------------------------------------- /test/clipping/c7: -------------------------------------------------------------------------------- 1 | 3 3 2 | 0.5 0.5 3 | 1.5 -0.5 4 | 1.5 0.5 5 | 1 2 6 | 2 3 7 | 3 1 8 | -------------------------------------------------------------------------------- /test/clipping/c8: -------------------------------------------------------------------------------- 1 | 4 4 2 | 1 -0.5 3 | 2 -0.5 4 | 2 1.5 5 | 1 1.5 6 | 1 2 7 | 2 3 8 | 3 4 9 | 4 1 10 | -------------------------------------------------------------------------------- /test/clipping/c9: -------------------------------------------------------------------------------- 1 | 4 4 2 | 1 0.0 3 | 2 0.0 4 | 2 1.5 5 | 1 1.5 6 | 1 2 7 | 2 3 8 | 3 4 9 | 4 1 10 | -------------------------------------------------------------------------------- /test/clipping/clipping.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | if ./clipping $1 $2 2> log > /dev/null; then 3 | : 4 | else 5 | echo "======== clipping $1 $2 ========" >> errors 6 | cat log >> errors 7 | rm -f log 8 | exit 1 9 | fi 10 | if ./clipping $2 $1 2> log > /dev/null; then 11 | : 12 | else 13 | echo "======== clipping $2 $1 ========" >> errors 14 | cat log >> errors 15 | rm -f log 16 | exit 1 17 | fi 18 | rm -f log 19 | -------------------------------------------------------------------------------- /test/clipping/clipping_c1_c2.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | ./clipping.sh c1 c2 3 | 4 | -------------------------------------------------------------------------------- /test/clipping/clipping_c1_c3.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | ./clipping.sh c1 c3 3 | 4 | -------------------------------------------------------------------------------- /test/clipping/clipping_c1_c4.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | ./clipping.sh c1 c4 3 | 4 | -------------------------------------------------------------------------------- /test/clipping/clipping_c1_c5.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | ./clipping.sh c1 c5 3 | 4 | -------------------------------------------------------------------------------- /test/clipping/clipping_c1_c6.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | ./clipping.sh c1 c6 3 | 4 | -------------------------------------------------------------------------------- /test/clipping/clipping_c1_c7.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | ./clipping.sh c1 c7 3 | 4 | -------------------------------------------------------------------------------- /test/clipping/clipping_c1_c8.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | ./clipping.sh c1 c8 3 | 4 | -------------------------------------------------------------------------------- /test/clipping/clipping_c1_c9.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | ./clipping.sh c1 c9 3 | 4 | -------------------------------------------------------------------------------- /test/clipping/clipping_l1_l2.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | ./clipping.sh l1 l2 3 | 4 | -------------------------------------------------------------------------------- /test/clipping/clipping_l1_l3.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | ./clipping.sh l1 l3 3 | 4 | -------------------------------------------------------------------------------- /test/clipping/clipping_l1_l4.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | ./clipping.sh l1 l4 3 | 4 | -------------------------------------------------------------------------------- /test/clipping/clipping_l1_l5.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | ./clipping.sh l1 l5 3 | 4 | -------------------------------------------------------------------------------- /test/clipping/l1: -------------------------------------------------------------------------------- 1 | 2 1 2 | 0 0 3 | 0 1 4 | 1 2 5 | -------------------------------------------------------------------------------- /test/clipping/l2: -------------------------------------------------------------------------------- 1 | 2 1 2 | 0 0.5 3 | 1 0.5 4 | 1 2 5 | -------------------------------------------------------------------------------- /test/clipping/l3: -------------------------------------------------------------------------------- 1 | 3 2 2 | 0 0.5 3 | 0.5 0.5 4 | -0.5 0.5 5 | 3 1 6 | 1 2 7 | -------------------------------------------------------------------------------- /test/clipping/l4: -------------------------------------------------------------------------------- 1 | 2 1 2 | 0 0.5 3 | 0 1.5 4 | 1 2 5 | -------------------------------------------------------------------------------- /test/clipping/l5: -------------------------------------------------------------------------------- 1 | 2 1 2 | 0 0.25 3 | 0 0.75 4 | 1 2 5 | -------------------------------------------------------------------------------- /test/coarsen/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to produce Makefile.in 2 | 3 | INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src -I$(includedir)\ 4 | -DG_LOG_DOMAIN=\"Gts-test\" 5 | LDADD = $(top_builddir)/src/libgts.la -lm 6 | DEPS = $(top_builddir)/src/libgts.la 7 | 8 | check_PROGRAMS = cartesian c1 c2 c3 double_prism 9 | 10 | TESTS = flat.sh flat1.sh 11 | 12 | EXTRA_DIST = flat.sh flat1.sh 13 | -------------------------------------------------------------------------------- /test/coarsen/cartesian.c: -------------------------------------------------------------------------------- 1 | /* GTS - Library for the manipulation of triangulated surfaces 2 | * Copyright (C) 1999 Stéphane Popinet 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Library General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Library General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Library General Public 15 | * License along with this library; if not, write to the 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 | * Boston, MA 02111-1307, USA. 18 | */ 19 | 20 | #include 21 | #include 22 | #include "gts.h" 23 | 24 | int main (int argc, char * argv[]) 25 | { 26 | guint i, j, nx, ny; 27 | gdouble cosa, sina, noise; 28 | GtsSurface * surface; 29 | GSList * l, * vertices = NULL; 30 | GtsTriangle * t; 31 | GtsVertex * v1, * v2, * v3; 32 | 33 | if (argc != 5) { 34 | fprintf (stderr, "usage: cartesian nx ny angle noise\n"); 35 | return 1; 36 | } 37 | 38 | nx = strtol (argv[1], NULL, 0); 39 | ny = strtol (argv[2], NULL, 0); 40 | cosa = cos (strtod (argv[3], NULL)); 41 | sina = sin (strtod (argv[3], NULL)); 42 | noise = strtod (argv[4], NULL); 43 | 44 | for (i = 0; i < nx; i++) { 45 | gdouble x = (gdouble) i/(gdouble) (nx - 1); 46 | for (j = 0; j < ny; j++) { 47 | gdouble y = (gdouble) j/(gdouble) (nx - 1); 48 | vertices = g_slist_prepend (vertices, 49 | gts_vertex_new (gts_vertex_class (), 50 | cosa*x - sina*y, 51 | sina*x + cosa*y, 52 | noise*rand()/(gdouble) RAND_MAX)); 53 | } 54 | } 55 | 56 | t = gts_triangle_enclosing (gts_triangle_class (), vertices, 100.); 57 | gts_triangle_vertices (t, &v1, &v2, &v3); 58 | surface = gts_surface_new (gts_surface_class (), 59 | gts_face_class (), 60 | gts_edge_class (), 61 | gts_vertex_class ()); 62 | gts_surface_add_face (surface, gts_face_new (gts_face_class (), 63 | t->e1, t->e2, t->e3)); 64 | l = vertices; 65 | while (l) { 66 | g_assert (gts_delaunay_add_vertex (surface, l->data, NULL) == NULL); 67 | l = l->next; 68 | } 69 | 70 | gts_allow_floating_vertices = TRUE; 71 | gts_object_destroy (GTS_OBJECT (v1)); 72 | gts_object_destroy (GTS_OBJECT (v2)); 73 | gts_object_destroy (GTS_OBJECT (v3)); 74 | gts_allow_floating_vertices = FALSE; 75 | 76 | gts_surface_write (surface, stdout); 77 | 78 | if (gts_delaunay_check (surface)) { 79 | fprintf (stderr, "WARNING: surface is not Delaunay\n"); 80 | return 1; 81 | } 82 | 83 | return 0; 84 | } 85 | -------------------------------------------------------------------------------- /test/coarsen/double_prism.c: -------------------------------------------------------------------------------- 1 | #include "gts.h" 2 | 3 | int main (int argc, char * argv[]) 4 | { 5 | GtsSurface * surface = gts_surface_new (gts_surface_class (), 6 | gts_face_class (), 7 | gts_edge_class (), 8 | gts_vertex_class ()); 9 | 10 | GtsVertex * v1 = gts_vertex_new (gts_vertex_class (), 0, 0, 0); 11 | GtsVertex * v2 = gts_vertex_new (gts_vertex_class (), 0, -0.5, 1); 12 | GtsVertex * v3 = gts_vertex_new (gts_vertex_class (), 0, 0.5, 1); 13 | GtsVertex * v4 = gts_vertex_new (gts_vertex_class (), 1, 0, 0); 14 | GtsVertex * v5 = gts_vertex_new (gts_vertex_class (), 0, -0.5, -1); 15 | GtsVertex * v6 = gts_vertex_new (gts_vertex_class (), 1, -0.5, -1); 16 | GtsVertex * v7 = gts_vertex_new (gts_vertex_class (), 1, 0.5, -1); 17 | GtsVertex * v8 = gts_vertex_new (gts_vertex_class (), 1, -0.5, 1); 18 | GtsVertex * v9 = gts_vertex_new (gts_vertex_class (), 1, 0.5, 1); 19 | GtsVertex * v10 = gts_vertex_new (gts_vertex_class (), 0, 0.5, -1); 20 | 21 | GtsEdge * e1 = gts_edge_new (gts_edge_class (), v1, v2); 22 | GtsEdge * e2 = gts_edge_new (gts_edge_class (), v1, v3); 23 | GtsEdge * e3 = gts_edge_new (gts_edge_class (), v2, v3); 24 | GtsEdge * e4 = gts_edge_new (gts_edge_class (), v4, v5); 25 | GtsEdge * e5 = gts_edge_new (gts_edge_class (), v4, v6); 26 | GtsEdge * e6 = gts_edge_new (gts_edge_class (), v5, v6); 27 | GtsEdge * e7 = gts_edge_new (gts_edge_class (), v1, v4); 28 | GtsEdge * e8 = gts_edge_new (gts_edge_class (), v1, v5); 29 | GtsEdge * e9 = gts_edge_new (gts_edge_class (), v6, v7); 30 | GtsEdge * e10 = gts_edge_new (gts_edge_class (), v4, v7); 31 | GtsEdge * e11 = gts_edge_new (gts_edge_class (), v1, v7); 32 | GtsEdge * e12 = gts_edge_new (gts_edge_class (), v8, v9); 33 | GtsEdge * e13 = gts_edge_new (gts_edge_class (), v4, v9); 34 | GtsEdge * e14 = gts_edge_new (gts_edge_class (), v4, v8); 35 | GtsEdge * e15 = gts_edge_new (gts_edge_class (), v5, v10); 36 | GtsEdge * e16 = gts_edge_new (gts_edge_class (), v1, v10); 37 | GtsEdge * e17 = gts_edge_new (gts_edge_class (), v10, v7); 38 | GtsEdge * e18 = gts_edge_new (gts_edge_class (), v1, v8); 39 | GtsEdge * e19 = gts_edge_new (gts_edge_class (), v2, v8); 40 | GtsEdge * e20 = gts_edge_new (gts_edge_class (), v4, v3); 41 | GtsEdge * e21 = gts_edge_new (gts_edge_class (), v3, v9); 42 | 43 | GtsFace * f1 = gts_face_new (gts_face_class (), 44 | e1, e2, e3); 45 | GtsFace * f2 = gts_face_new (gts_face_class (), 46 | e4, e5, e6); 47 | GtsFace * f3 = gts_face_new (gts_face_class (), 48 | e7, e4, e8); 49 | GtsFace * f4 = gts_face_new (gts_face_class (), 50 | e9, e5, e10); 51 | GtsFace * f5 = gts_face_new (gts_face_class (), 52 | e11, e10, e7); 53 | GtsFace * f6 = gts_face_new (gts_face_class (), 54 | e12, e13, e14); 55 | GtsFace * f7 = gts_face_new (gts_face_class (), 56 | e15, e16, e8); 57 | GtsFace * f8 = gts_face_new (gts_face_class (), 58 | e17, e11, e16); 59 | GtsFace * f9 = gts_face_new (gts_face_class (), 60 | e18, e14, e7); 61 | GtsFace * f10 = gts_face_new (gts_face_class (), 62 | e19, e18, e1); 63 | GtsFace * f11 = gts_face_new (gts_face_class (), 64 | e20, e13, e21); 65 | GtsFace * f12 = gts_face_new (gts_face_class (), 66 | e7, e20, e2); 67 | GtsVertex * v; 68 | GtsVolumeOptimizedParams params = { 0.5, 0.5, 0.0 }; 69 | GtsSplit * vs; 70 | 71 | gts_surface_add_face (surface, f1); 72 | gts_surface_add_face (surface, f2); 73 | gts_surface_add_face (surface, f3); 74 | gts_surface_add_face (surface, f4); 75 | gts_surface_add_face (surface, f5); 76 | gts_surface_add_face (surface, f6); 77 | gts_surface_add_face (surface, f7); 78 | gts_surface_add_face (surface, f8); 79 | gts_surface_add_face (surface, f9); 80 | gts_surface_add_face (surface, f10); 81 | gts_surface_add_face (surface, f11); 82 | gts_surface_add_face (surface, f12); 83 | 84 | g_assert (gts_edge_collapse_is_valid (e7)); 85 | v = gts_volume_optimized_vertex (e7, gts_vertex_class (), ¶ms); 86 | vs = gts_split_new (gts_split_class (), v, 87 | GTS_OBJECT (GTS_SEGMENT (e7)->v1), 88 | GTS_OBJECT (GTS_SEGMENT (e7)->v2)); 89 | gts_split_collapse (vs, gts_edge_class (), NULL); 90 | 91 | gts_surface_write (surface, stdout); 92 | 93 | return 0; 94 | } 95 | -------------------------------------------------------------------------------- /test/coarsen/flat.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | ./cartesian 10 10 0 0 | ../../examples/coarsen -n 116 -v 2> /tmp/tutu > /dev/null 3 | if awk 'BEGIN {area = 0.} { if ($4 == "area:") { if (area) { if (area == $5) exit 1; else exit 0;} else area = $5;}}' < /tmp/tutu; then 4 | exit 1 5 | fi 6 | exit 0 7 | 8 | -------------------------------------------------------------------------------- /test/coarsen/flat1.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | ./cartesian 15 15 0 0 | ../../examples/coarsen -n 100 -v 2> /tmp/tutu > /dev/null 3 | if awk 'BEGIN {area = 0.} { if ($4 == "area:") { if (area) { if (area == $5) exit 1; else exit 0;} else area = $5;}}' < /tmp/tutu; then 4 | exit 1 5 | fi 6 | exit 0 7 | 8 | -------------------------------------------------------------------------------- /test/delaunay/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to produce Makefile.in 2 | 3 | INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src -I$(includedir) \ 4 | -DG_LOG_DOMAIN=\"Gts-test\" 5 | LDADD = $(top_builddir)/src/libgts.la -lm 6 | DEPS = $(top_builddir)/src/libgts.la 7 | 8 | check_PROGRAMS = cartesian random 9 | 10 | TESTS = cartesian.sh two_segments.sh too_close.sh 11 | 12 | EXTRA_DIST = \ 13 | cartesian.sh \ 14 | cartesian_speed.sh \ 15 | random_speed.sh \ 16 | two_segments.gts two_segments.sh \ 17 | too_close.gts too_close.sh 18 | -------------------------------------------------------------------------------- /test/delaunay/c1.c: -------------------------------------------------------------------------------- 1 | /* GTS - Library for the manipulation of triangulated surfaces 2 | * Copyright (C) 1999 Stéphane Popinet 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Library General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Library General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Library General Public 15 | * License along with this library; if not, write to the 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 | * Boston, MA 02111-1307, USA. 18 | */ 19 | 20 | #include "gts.h" 21 | 22 | int main (int argc, char * argv[]) 23 | { 24 | GtsSurface * surface = gts_surface_new (gts_surface_class (), 25 | gts_face_class (), 26 | gts_edge_class (), 27 | gts_vertex_class ()); 28 | 29 | GtsVertex * v1 = gts_vertex_new (gts_vertex_class (), 0, 0, 0); 30 | GtsVertex * v2 = gts_vertex_new (gts_vertex_class (), 0.5, 0.5, 0); 31 | GtsVertex * v3 = gts_vertex_new (gts_vertex_class (), 0, 0.5, 0); 32 | GtsVertex * v4 = gts_vertex_new (gts_vertex_class (), 0, 1, 0); 33 | GtsVertex * v5 = gts_vertex_new (gts_vertex_class (), -0.5, 0.5, 0); 34 | 35 | GtsEdge * e1 = gts_edge_new (GTS_EDGE_CLASS (gts_constraint_class ()), 36 | v1, v2); 37 | GtsEdge * e2 = gts_edge_new (GTS_EDGE_CLASS (gts_constraint_class ()), 38 | v3, v2); 39 | GtsEdge * e3 = gts_edge_new (GTS_EDGE_CLASS (gts_constraint_class ()), 40 | v1, v3); 41 | GtsEdge * e4 = gts_edge_new (gts_edge_class (), v1, v4); 42 | GtsEdge * e5 = gts_edge_new (GTS_EDGE_CLASS (gts_constraint_class ()), 43 | v4, v5); 44 | GtsEdge * e6 = gts_edge_new (GTS_EDGE_CLASS (gts_constraint_class ()), 45 | v1, v5); 46 | GtsEdge * e7 = gts_edge_new (GTS_EDGE_CLASS (gts_constraint_class ()), 47 | v4, v2); 48 | GtsEdge * e8 = gts_edge_new (GTS_EDGE_CLASS (gts_constraint_class ()), 49 | v3, v4); 50 | GtsEdge * e9 = gts_edge_new (GTS_EDGE_CLASS (gts_constraint_class ()), 51 | v5, v3); 52 | 53 | GtsFace * f1 = gts_face_new (gts_face_class (), 54 | e1, e2, e3); 55 | GtsFace * f2 = gts_face_new (gts_face_class (), 56 | e4, e5, e6); 57 | GtsFace * f3 = gts_face_new (gts_face_class (), 58 | e7, e8, e2); 59 | GtsFace * f4 = gts_face_new (gts_face_class (), 60 | e4, e3, e8); 61 | 62 | gts_surface_add_face (surface, f1); 63 | gts_surface_add_face (surface, f2); 64 | gts_surface_add_face (surface, f3); 65 | gts_surface_add_face (surface, f4); 66 | 67 | gts_delaunay_add_constraint (surface, GTS_CONSTRAINT (e9)); 68 | 69 | #if 0 70 | gts_surface_print_stats (surface, stderr); 71 | gts_surface_write (surface, stdout); 72 | #endif 73 | 74 | return 0; 75 | } 76 | -------------------------------------------------------------------------------- /test/delaunay/cartesian.c: -------------------------------------------------------------------------------- 1 | /* GTS - Library for the manipulation of triangulated surfaces 2 | * Copyright (C) 1999 Stéphane Popinet 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Library General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Library General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Library General Public 15 | * License along with this library; if not, write to the 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 | * Boston, MA 02111-1307, USA. 18 | */ 19 | 20 | #include 21 | #include 22 | #include "gts.h" 23 | 24 | int main (int argc, char * argv[]) 25 | { 26 | guint i, j, nx, ny; 27 | gdouble cosa, sina; 28 | GtsSurface * surface; 29 | GSList * l, * vertices = NULL; 30 | GtsTriangle * t; 31 | GtsVertex * v1, * v2, * v3; 32 | GTimer * timer; 33 | 34 | if (argc != 4) { 35 | fprintf (stderr, "usage: cartesian nx ny angle\n"); 36 | return 0; 37 | } 38 | 39 | nx = strtol (argv[1], NULL, 0); 40 | ny = strtol (argv[2], NULL, 0); 41 | cosa = cos (strtod (argv[3], NULL)); 42 | sina = sin (strtod (argv[3], NULL)); 43 | 44 | timer = g_timer_new (); 45 | g_timer_start (timer); 46 | for (i = 0; i < nx; i++) { 47 | gdouble x = (gdouble) i/(gdouble) (nx - 1); 48 | for (j = 0; j < ny; j++) { 49 | gdouble y = (gdouble) j/(gdouble) (nx - 1); 50 | vertices = g_slist_prepend (vertices, 51 | gts_vertex_new (gts_vertex_class (), 52 | cosa*x - sina*y, sina*x + cosa*y, 0.)); 53 | } 54 | } 55 | 56 | t = gts_triangle_enclosing (gts_triangle_class (), vertices, 100.); 57 | gts_triangle_vertices (t, &v1, &v2, &v3); 58 | surface = gts_surface_new (gts_surface_class (), 59 | gts_face_class (), 60 | gts_edge_class (), 61 | gts_vertex_class ()); 62 | gts_surface_add_face (surface, gts_face_new (gts_face_class (), 63 | t->e1, t->e2, t->e3)); 64 | g_timer_stop (timer); 65 | fprintf (stderr, "Input: %g s\n", g_timer_elapsed (timer, NULL)); 66 | g_timer_reset (timer); 67 | 68 | g_timer_start (timer); 69 | l = vertices; 70 | while (l) { 71 | g_assert (gts_delaunay_add_vertex (surface, l->data, NULL) == NULL); 72 | l = l->next; 73 | } 74 | 75 | gts_allow_floating_vertices = TRUE; 76 | gts_object_destroy (GTS_OBJECT (v1)); 77 | gts_object_destroy (GTS_OBJECT (v2)); 78 | gts_object_destroy (GTS_OBJECT (v3)); 79 | gts_allow_floating_vertices = FALSE; 80 | g_timer_stop (timer); 81 | 82 | fprintf (stderr, "Triangulation: %g s speed: %.0f vertex/s\n", 83 | g_timer_elapsed (timer, NULL), 84 | g_slist_length (vertices)/g_timer_elapsed (timer, NULL)); 85 | g_timer_reset (timer); 86 | 87 | g_timer_start (timer); 88 | gts_surface_write (surface, stdout); 89 | g_timer_stop (timer); 90 | 91 | fprintf (stderr, "Output: %g s\n", g_timer_elapsed (timer, NULL)); 92 | 93 | if (gts_delaunay_check (surface)) { 94 | fprintf (stderr, "WARNING: surface is not Delaunay\n"); 95 | return 0; 96 | } 97 | 98 | return 1; 99 | } 100 | -------------------------------------------------------------------------------- /test/delaunay/cartesian.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | if ./cartesian 10 10 0.1 2> /dev/null > /dev/null; then 3 | exit 1 4 | fi 5 | exit 0 6 | -------------------------------------------------------------------------------- /test/delaunay/cartesian_speed.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | rm -f cartesian_speed 3 | if ./cartesian 32 32 0.1 > /dev/null 2> /tmp/speed; then 4 | exit 1 5 | fi 6 | speed=`awk '{if ($4 == "speed:") print $5}' < /tmp/speed` 7 | echo "1024 $speed" >> cartesian_speed 8 | 9 | if ./cartesian 45 45 0.1 > /dev/null 2> /tmp/speed; then 10 | exit 1 11 | fi 12 | speed=`awk '{if ($4 == "speed:") print $5}' < /tmp/speed` 13 | echo "2025 $speed" >> cartesian_speed 14 | 15 | if ./cartesian 64 64 0.1 > /dev/null 2> /tmp/speed; then 16 | exit 1 17 | fi 18 | speed=`awk '{if ($4 == "speed:") print $5}' < /tmp/speed` 19 | echo "4096 $speed" >> cartesian_speed 20 | 21 | if ./cartesian 90 90 0.1 > /dev/null 2> /tmp/speed; then 22 | exit 1 23 | fi 24 | speed=`awk '{if ($4 == "speed:") print $5}' < /tmp/speed` 25 | echo "8100 $speed" >> cartesian_speed 26 | 27 | if ./cartesian 128 128 0.1 > /dev/null 2> /tmp/speed; then 28 | exit 1 29 | fi 30 | speed=`awk '{if ($4 == "speed:") print $5}' < /tmp/speed` 31 | echo "16384 $speed" >> cartesian_speed 32 | 33 | exit 0 34 | -------------------------------------------------------------------------------- /test/delaunay/random.c: -------------------------------------------------------------------------------- 1 | /* GTS - Library for the manipulation of triangulated surfaces 2 | * Copyright (C) 1999 Stéphane Popinet 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Library General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Library General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Library General Public 15 | * License along with this library; if not, write to the 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 | * Boston, MA 02111-1307, USA. 18 | */ 19 | 20 | #include 21 | #include 22 | #include "gts.h" 23 | 24 | int main (int argc, char * argv[]) 25 | { 26 | guint i, n; 27 | GtsSurface * surface; 28 | GSList * l, * vertices = NULL; 29 | GtsTriangle * t; 30 | GtsVertex * v1, * v2, * v3; 31 | GTimer * timer; 32 | 33 | if (argc != 2) { 34 | fprintf (stderr, "usage: random n\n"); 35 | return 0; 36 | } 37 | 38 | n = strtol (argv[1], NULL, 0); 39 | 40 | timer = g_timer_new (); 41 | g_timer_start (timer); 42 | for (i = 0; i < n; i++) 43 | vertices = g_slist_prepend (vertices, 44 | gts_vertex_new (gts_vertex_class (), 45 | rand (), rand (), 0.)); 46 | 47 | t = gts_triangle_enclosing (gts_triangle_class (), vertices, 100.); 48 | gts_triangle_vertices (t, &v1, &v2, &v3); 49 | surface = gts_surface_new (gts_surface_class (), 50 | gts_face_class (), 51 | gts_edge_class (), 52 | gts_vertex_class ()); 53 | gts_surface_add_face (surface, gts_face_new (gts_face_class (), 54 | t->e1, t->e2, t->e3)); 55 | g_timer_stop (timer); 56 | fprintf (stderr, "Input: %g s\n", g_timer_elapsed (timer, NULL)); 57 | g_timer_reset (timer); 58 | 59 | g_timer_start (timer); 60 | l = vertices; 61 | while (l) { 62 | gts_delaunay_add_vertex (surface, l->data, NULL); 63 | l = l->next; 64 | } 65 | 66 | gts_allow_floating_vertices = TRUE; 67 | gts_object_destroy (GTS_OBJECT (v1)); 68 | gts_object_destroy (GTS_OBJECT (v2)); 69 | gts_object_destroy (GTS_OBJECT (v3)); 70 | gts_allow_floating_vertices = FALSE; 71 | g_timer_stop (timer); 72 | 73 | fprintf (stderr, "Triangulation: %g s speed: %.0f vertex/s\n", 74 | g_timer_elapsed (timer, NULL), 75 | g_slist_length (vertices)/g_timer_elapsed (timer, NULL)); 76 | g_timer_reset (timer); 77 | 78 | g_timer_start (timer); 79 | gts_surface_write (surface, stdout); 80 | g_timer_stop (timer); 81 | 82 | fprintf (stderr, "Output: %g s\n", g_timer_elapsed (timer, NULL)); 83 | 84 | if (gts_delaunay_check (surface)) { 85 | fprintf (stderr, "WARNING: surface is not Delaunay\n"); 86 | return 0; 87 | } 88 | 89 | return 1; 90 | } 91 | -------------------------------------------------------------------------------- /test/delaunay/random_speed.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | rm -f random_speed 3 | if ./random 1000 > /dev/null 2> /tmp/speed; then 4 | exit 1 5 | fi 6 | speed=`awk '{if ($4 == "speed:") print $5}' < /tmp/speed` 7 | echo "1000 $speed" >> random_speed 8 | 9 | if ./random 2000 > /dev/null 2> /tmp/speed; then 10 | exit 1 11 | fi 12 | speed=`awk '{if ($4 == "speed:") print $5}' < /tmp/speed` 13 | echo "2000 $speed" >> random_speed 14 | 15 | if ./random 4000 > /dev/null 2> /tmp/speed; then 16 | exit 1 17 | fi 18 | speed=`awk '{if ($4 == "speed:") print $5}' < /tmp/speed` 19 | echo "4000 $speed" >> random_speed 20 | 21 | if ./random 8000 > /dev/null 2> /tmp/speed; then 22 | exit 1 23 | fi 24 | speed=`awk '{if ($4 == "speed:") print $5}' < /tmp/speed` 25 | echo "8000 $speed" >> random_speed 26 | 27 | if ./random 16000 > /dev/null 2> /tmp/speed; then 28 | exit 1 29 | fi 30 | speed=`awk '{if ($4 == "speed:") print $5}' < /tmp/speed` 31 | echo "16000 $speed" >> random_speed 32 | 33 | if ./random 32000 > /dev/null 2> /tmp/speed; then 34 | exit 1 35 | fi 36 | speed=`awk '{if ($4 == "speed:") print $5}' < /tmp/speed` 37 | echo "32000 $speed" >> random_speed 38 | 39 | if ./random 64000 > /dev/null 2> /tmp/speed; then 40 | exit 1 41 | fi 42 | speed=`awk '{if ($4 == "speed:") print $5}' < /tmp/speed` 43 | echo "64000 $speed" >> random_speed 44 | 45 | if ./random 128000 > /dev/null 2> /tmp/speed; then 46 | exit 1 47 | fi 48 | speed=`awk '{if ($4 == "speed:") print $5}' < /tmp/speed` 49 | echo "128000 $speed" >> random_speed 50 | 51 | exit 0 52 | -------------------------------------------------------------------------------- /test/delaunay/squarehole.gts: -------------------------------------------------------------------------------- 1 | 8 8 0 2 | 0 0 0 3 | 1 0 0 4 | 1 1 0 5 | 0 1 0 6 | 0.3333 0.3333 0 7 | 0.3333 0.6666 0 8 | 0.6666 0.6666 0 9 | 0.6666 0.3333 0 10 | 1 2 11 | 2 3 12 | 3 4 13 | 4 1 14 | 5 6 15 | 6 7 16 | 7 8 17 | 8 5 18 | 19 | -------------------------------------------------------------------------------- /test/delaunay/too_close.gts: -------------------------------------------------------------------------------- 1 | 6 2 0 2 | -1 0 0 3 | 0.5 0 0 4 | -0.5 -0.15 0 5 | 1 -0.5 0 6 | 0 1 0 7 | 0 -1 0 8 | 1 2 9 | 3 4 10 | -------------------------------------------------------------------------------- /test/delaunay/too_close.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | if ../../examples/delaunay -o < too_close.gts > /dev/null; then 3 | exit 0 4 | fi 5 | exit 1 6 | -------------------------------------------------------------------------------- /test/delaunay/two_segments.gts: -------------------------------------------------------------------------------- 1 | 6 2 0 2 | -1 0 0 3 | 0.5 0 0 4 | -0.5 0 0 5 | 1 0 0 6 | 0 1 0 7 | 0 -1 0 8 | 1 2 9 | 3 4 10 | -------------------------------------------------------------------------------- /test/delaunay/two_segments.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | if ../../examples/delaunay < two_segments.gts > /dev/null; then 3 | exit 0 4 | fi 5 | exit 1 6 | -------------------------------------------------------------------------------- /tools/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to produce Makefile.in 2 | 3 | INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src -I$(includedir)\ 4 | -DG_LOG_DOMAIN=\"Gts-tools\" 5 | LDADD = $(top_builddir)/src/libgts.la -lm 6 | DEPS = $(top_builddir)/src/libgts.la 7 | 8 | bin_PROGRAMS = gts2oogl gtscompare gtscheck stl2gts gts2dxf gts2stl gts2obj 9 | bin_SCRIPTS = gtstemplate 10 | 11 | EXTRA_DIST = gtstemplate 12 | -------------------------------------------------------------------------------- /tools/gts2dxf.c: -------------------------------------------------------------------------------- 1 | /* GTS - Library for the manipulation of triangulated surfaces 2 | * Copyright (C) 1999 Stéphane Popinet 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Library General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Library General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Library General Public 15 | * License along with this library; if not, write to the 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 | * Boston, MA 02111-1307, USA. 18 | */ 19 | 20 | #include 21 | 22 | #include "gts.h" 23 | 24 | static void write_vertex (GtsVertex * v, guint * nv) 25 | { 26 | printf (" 0\nVERTEX\n 8\n0\n 10\n%g\n 20\n%g\n 30\n%g\n 70\n192\n", 27 | GTS_POINT (v)->x, GTS_POINT (v)->y, GTS_POINT (v)->z); 28 | GTS_OBJECT (v)->reserved = GUINT_TO_POINTER ((*nv)++); 29 | } 30 | 31 | static void write_face (GtsTriangle * t) 32 | { 33 | GtsVertex * v1, * v2, * v3; 34 | 35 | gts_triangle_vertices (t, &v1, &v2, &v3); 36 | printf (" 0\nVERTEX\n 8\n0\n 10\n0.0\n 20\n0.0\n 30\n0.0\n 70\n128\n" 37 | " 71\n%u\n 72\n%u\n 73\n%u\n", 38 | GPOINTER_TO_UINT (GTS_OBJECT (v1)->reserved), 39 | GPOINTER_TO_UINT (GTS_OBJECT (v2)->reserved), 40 | GPOINTER_TO_UINT (GTS_OBJECT (v3)->reserved)); 41 | } 42 | 43 | int main (int argc, char * argv[]) 44 | { 45 | GtsSurface * s; 46 | GtsFile * fp; 47 | guint nv = 1; 48 | GtsSurfaceStats st; 49 | 50 | if (!setlocale (LC_ALL, "POSIX")) 51 | g_warning ("cannot set locale to POSIX"); 52 | 53 | s = gts_surface_new (gts_surface_class (), 54 | gts_face_class (), 55 | gts_edge_class (), 56 | gts_vertex_class ()); 57 | fp = gts_file_new (stdin); 58 | if (gts_surface_read (s, fp)) { 59 | fputs ("gts2dxf: file on standard input is not a valid GTS file\n", 60 | stderr); 61 | fprintf (stderr, "stdin:%d:%d: %s\n", fp->line, fp->pos, fp->error); 62 | return 1; /* failure */ 63 | } 64 | 65 | gts_surface_stats (s, &st); 66 | printf (" 0\nSECTION\n 2\nHEADER\n 9\n$ACADVER\n 1\n" 67 | "AC1009\n 0\nENDSEC\n 0\n" 68 | "SECTION\n" 69 | " 2\n" 70 | "ENTITIES\n" 71 | " 0\n" 72 | "POLYLINE\n" 73 | " 8\n0\n" 74 | " 66\n1\n" 75 | " 10\n0.0\n" 76 | " 20\n0.0\n" 77 | " 30\n0.0\n" 78 | " 70\n64\n" 79 | " 71\n%u\n" 80 | " 72\n%u\n", 81 | st.edges_per_vertex.n, st.n_faces); 82 | gts_surface_foreach_vertex (s, (GtsFunc) write_vertex, &nv); 83 | gts_surface_foreach_face (s, (GtsFunc) write_face, NULL); 84 | printf (" 0\nSEQEND\n 0\nENDSEC\n 0\nEOF\n"); 85 | return 0; 86 | } 87 | -------------------------------------------------------------------------------- /tools/gts2obj.c: -------------------------------------------------------------------------------- 1 | /* GTS - Library for the manipulation of triangulated surfaces 2 | * Copyright (C) 1999 Stéphane Popinet 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Library General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Library General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Library General Public 15 | * License along with this library; if not, write to the 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 | * Boston, MA 02111-1307, USA. 18 | */ 19 | 20 | #include 21 | 22 | #include "gts.h" 23 | 24 | volatile FILE * fptr; 25 | 26 | static void write_vertex (GtsVertex * v, guint * nv) 27 | { 28 | fprintf (fptr, "v %g %g %g\n", GTS_POINT (v)->x, GTS_POINT (v)->y, GTS_POINT (v)->z); 29 | GTS_OBJECT (v)->reserved = GUINT_TO_POINTER ((*nv)++); 30 | } 31 | 32 | static void write_face (GtsTriangle * t) 33 | { 34 | GtsVertex * v1, * v2, * v3; 35 | 36 | gts_triangle_vertices (t, &v1, &v2, &v3); 37 | fprintf (fptr, "f %u %u %u\n", 38 | GPOINTER_TO_UINT (GTS_OBJECT (v1)->reserved), 39 | GPOINTER_TO_UINT (GTS_OBJECT (v2)->reserved), 40 | GPOINTER_TO_UINT (GTS_OBJECT (v3)->reserved)); 41 | } 42 | 43 | int main (int argc, char * argv[]) 44 | { 45 | GtsSurface * s; 46 | GtsFile * fp; 47 | guint nv = 1; 48 | 49 | if (!setlocale (LC_ALL, "POSIX")) 50 | g_warning ("cannot set locale to POSIX"); 51 | 52 | s = gts_surface_new (gts_surface_class (), 53 | gts_face_class (), 54 | gts_edge_class (), 55 | gts_vertex_class ()); 56 | 57 | /* open first file */ 58 | FILE * fptr_in; 59 | if ((fptr_in = fopen (argv[1], "rt")) == NULL) { 60 | fprintf (stderr, "set: can not open file `%s'\n", argv[1]); 61 | return 1; 62 | } 63 | if ((fptr = fopen (argv[2], "wt")) == NULL) { 64 | fprintf (stderr, "set: can not open file `%s'\n", argv[2]); 65 | return 1; 66 | } 67 | 68 | fp = gts_file_new (fptr_in); 69 | if (gts_surface_read (s, fp)) { 70 | fputs ("gts2obj: file on standard input is not a valid GTS file\n", 71 | stderr); 72 | fprintf (stderr, "stdin:%d:%d: %s\n", fp->line, fp->pos, fp->error); 73 | return 1; /* failure */ 74 | } 75 | 76 | gts_surface_foreach_vertex (s, (GtsFunc) write_vertex, &nv); 77 | gts_surface_foreach_face (s, (GtsFunc) write_face, NULL); 78 | 79 | fclose(fptr); 80 | return 0; 81 | } 82 | -------------------------------------------------------------------------------- /tools/gts2stl.c: -------------------------------------------------------------------------------- 1 | /* GTS - Library for the manipulation of triangulated surfaces 2 | * Copyright (C) 1999 Stéphane Popinet 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Library General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Library General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Library General Public 15 | * License along with this library; if not, write to the 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 | * Boston, MA 02111-1307, USA. 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include "config.h" 25 | #ifdef HAVE_GETOPT_H 26 | # include 27 | #endif /* HAVE_GETOPT_H */ 28 | #ifdef HAVE_UNISTD_H 29 | # include 30 | #endif /* HAVE_UNISTD_H */ 31 | #include "gts.h" 32 | 33 | static void write_face (GtsTriangle * t) 34 | { 35 | GtsVertex * v1, * v2, * v3; 36 | GtsVector n; 37 | 38 | gts_triangle_vertices (t, &v1, &v2, &v3); 39 | gts_triangle_normal (t, &n[0], &n[1], &n[2]); 40 | gts_vector_normalize (n); 41 | printf ("facet normal %g %g %g\nouter loop\n", n[0], n[1], n[2]); 42 | printf ("vertex %g %g %g\n", 43 | GTS_POINT (v1)->x, GTS_POINT (v1)->y, GTS_POINT (v1)->z); 44 | printf ("vertex %g %g %g\n", 45 | GTS_POINT (v2)->x, GTS_POINT (v2)->y, GTS_POINT (v2)->z); 46 | printf ("vertex %g %g %g\n", 47 | GTS_POINT (v3)->x, GTS_POINT (v3)->y, GTS_POINT (v3)->z); 48 | puts ("endloop\nendfacet"); 49 | } 50 | 51 | int main (int argc, char * argv[]) 52 | { 53 | int c = 0; 54 | gboolean verbose = FALSE; 55 | gboolean revert = FALSE; 56 | GtsSurface * s; 57 | GtsFile * fp; 58 | 59 | if (!setlocale (LC_ALL, "POSIX")) 60 | g_warning ("cannot set locale to POSIX"); 61 | 62 | while (c != EOF) { 63 | #ifdef HAVE_GETOPT_LONG 64 | static struct option long_options[] = { 65 | {"revert", no_argument, NULL, 'r'}, 66 | {"help", no_argument, NULL, 'h'}, 67 | {"verbose", no_argument, NULL, 'v'}, 68 | { NULL } 69 | }; 70 | int option_index = 0; 71 | switch ((c = getopt_long (argc, argv, "hvr", 72 | long_options, &option_index))) { 73 | #else /* not HAVE_GETOPT_LONG */ 74 | switch ((c = getopt (argc, argv, "hvr"))) { 75 | #endif /* not HAVE_GETOPT_LONG */ 76 | case 'r': /* revert */ 77 | revert = TRUE; 78 | break; 79 | case 'h': /* help */ 80 | fprintf (stderr, 81 | "Usage: gts2stl [OPTION]... < input.gts > output.stl\n" 82 | "Convert a GTS file to STL format.\n" 83 | "\n" 84 | " -r, --revert revert face normals\n" 85 | " -v, --verbose display surface statistics\n" 86 | " -h, --help display this help and exit\n" 87 | "\n" 88 | "Report bugs to %s\n", 89 | GTS_MAINTAINER); 90 | return 0; 91 | break; 92 | case 'v': 93 | verbose = TRUE; 94 | break; 95 | case '?': /* wrong options */ 96 | fprintf (stderr, "Try `gts2stl --help' for more information.\n"); 97 | return 1; 98 | } 99 | } 100 | 101 | s = gts_surface_new (gts_surface_class (), 102 | gts_face_class (), 103 | gts_edge_class (), 104 | gts_vertex_class ()); 105 | fp = gts_file_new (stdin); 106 | if (gts_surface_read (s, fp)) { 107 | fputs ("gts2stl: file on standard input is not a valid GTS file\n", 108 | stderr); 109 | fprintf (stderr, "stdin:%d:%d: %s\n", fp->line, fp->pos, fp->error); 110 | return 1; /* failure */ 111 | } 112 | 113 | if (revert) 114 | gts_surface_foreach_face (s, (GtsFunc) gts_triangle_revert, NULL); 115 | if (verbose) 116 | gts_surface_print_stats (s, stderr); 117 | 118 | puts ("solid"); 119 | gts_surface_foreach_face (s, (GtsFunc) write_face, NULL); 120 | puts ("endsolid"); 121 | 122 | return 0; 123 | } 124 | -------------------------------------------------------------------------------- /tools/gtscheck.c: -------------------------------------------------------------------------------- 1 | /* GTS - Library for the manipulation of triangulated surfaces 2 | * Copyright (C) 1999 Stéphane Popinet 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Library General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Library General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Library General Public 15 | * License along with this library; if not, write to the 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 | * Boston, MA 02111-1307, USA. 18 | */ 19 | 20 | #include 21 | #include 22 | 23 | #include "config.h" 24 | #ifdef HAVE_GETOPT_H 25 | # include 26 | #endif /* HAVE_GETOPT_H */ 27 | #ifdef HAVE_UNISTD_H 28 | # include 29 | #endif /* HAVE_UNISTD_H */ 30 | #include "gts.h" 31 | 32 | int main (int argc, char * argv[]) 33 | { 34 | GtsSurface * s, * self_intersects; 35 | gboolean verbose = FALSE; 36 | int c = 0; 37 | GtsFile * fp; 38 | 39 | if (!setlocale (LC_ALL, "POSIX")) 40 | g_warning ("cannot set locale to POSIX"); 41 | 42 | s = gts_surface_new (gts_surface_class (), 43 | gts_face_class (), 44 | gts_edge_class (), 45 | gts_vertex_class ()); 46 | 47 | /* parse options using getopt */ 48 | while (c != EOF) { 49 | #ifdef HAVE_GETOPT_LONG 50 | static struct option long_options[] = { 51 | {"help", no_argument, NULL, 'h'}, 52 | {"verbose", no_argument, NULL, 'v'}, 53 | { NULL } 54 | }; 55 | int option_index = 0; 56 | switch ((c = getopt_long (argc, argv, "hv", 57 | long_options, &option_index))) { 58 | #else /* not HAVE_GETOPT_LONG */ 59 | switch ((c = getopt (argc, argv, "hv"))) { 60 | #endif /* not HAVE_GETOPT_LONG */ 61 | case 'v': /* verbose */ 62 | verbose = TRUE; 63 | break; 64 | case 'h': /* help */ 65 | fprintf (stderr, 66 | "Usage: gtscheck [OPTION] < FILE\n" 67 | "Checks that a surface defines a closed, orientable\n" 68 | "non self-intersecting manifold.\n" 69 | "\n" 70 | "If the surface is self-intersecting, the set of intersected faces\n" 71 | "is written on standard output as a GTS surface file.\n" 72 | "\n" 73 | " -v --verbose print statistics about the surface\n" 74 | " -h --help display this help and exit\n" 75 | "\n" 76 | "The return status reflects the error encountered:\n" 77 | " 0: none\n" 78 | " 1: the input file is not a valid GTS file\n" 79 | " 2: the surface is not an orientable manifold\n" 80 | " 3: the surface is an orientable manifold but is self-intersecting\n" 81 | "\n" 82 | "Reports bugs to %s\n", 83 | GTS_MAINTAINER); 84 | return 0; /* success */ 85 | break; 86 | case '?': /* wrong options */ 87 | fprintf (stderr, "Try `gtscheck --help' for more information.\n"); 88 | return 1; /* failure */ 89 | } 90 | } 91 | 92 | /* read surface in */ 93 | s = gts_surface_new (gts_surface_class (), 94 | gts_face_class (), 95 | gts_edge_class (), 96 | gts_vertex_class ()); 97 | fp = gts_file_new (stdin); 98 | if (gts_surface_read (s, fp)) { 99 | fputs ("gtscheck: file on standard input is not a valid GTS file\n", 100 | stderr); 101 | fprintf (stderr, "stdin:%d:%d: %s\n", fp->line, fp->pos, fp->error); 102 | return 1; /* failure */ 103 | } 104 | 105 | /* if verbose on print stats */ 106 | if (verbose) 107 | gts_surface_print_stats (s, stderr); 108 | 109 | if (!gts_surface_is_orientable (s)) { 110 | if (verbose) 111 | fprintf (stderr, "gtscheck: the surface on standard input is not an orientable manifold\n"); 112 | return 2; /* failure */ 113 | } 114 | 115 | self_intersects = gts_surface_is_self_intersecting (s); 116 | if (self_intersects != NULL) { 117 | if (verbose) { 118 | fprintf (stderr, "gtscheck: the surface on standard input is self-intersecting\n"); 119 | gts_surface_print_stats (self_intersects, stderr); 120 | } 121 | gts_surface_write (self_intersects, stdout); 122 | return 3; /* failure */ 123 | } 124 | 125 | return 0; /* success */ 126 | } 127 | -------------------------------------------------------------------------------- /tools/makefile.msc: -------------------------------------------------------------------------------- 1 | ## Makefile for building the GTS tool programs with Microsoft C 2 | ## Use: nmake -f makefile.msc check 3 | 4 | ################################################################ 5 | 6 | # Nothing much configurable below 7 | 8 | # cl -? describes the options 9 | CC = cl -G5 -GF -Ox -W3 -nologo 10 | 11 | # No general LDFLAGS needed 12 | LDFLAGS = /link 13 | 14 | CFLAGS = -I. -DHAVE_CONFIG_H -DHAVE_GETOPT_H -DHAVE_GETOPT_LONG -DNATIVE_WIN32 -G5 -GF -Ox -W3 -MD -nologo 15 | 16 | TOOLS = gts2oogl.exe\ 17 | gtscheck.exe\ 18 | gtscompare.exe\ 19 | stl2gts.exe 20 | 21 | all : $(TOOLS) 22 | 23 | .c.exe : 24 | # $(CC) $(CFLAGS) -c $< 25 | $(CC) $(CFLAGS) -Fe$@ $< getopt.c getoptl.c gts-0.7.lib glib-1.3.lib $(LDFLAGS) /subsystem:console 26 | 27 | check: all 28 | for %p in ($(TOOLS)) do %p 29 | 30 | clean: 31 | del *.exe 32 | del *.obj 33 | del *.dll 34 | del *.lib 35 | del *.err 36 | del *.map 37 | del *.sym 38 | del *.exp 39 | del *.pdb 40 | --------------------------------------------------------------------------------