Downloads: Source Code (Visual Studio 2008 SP1, C++) [Zip]


SegTool is a simple tool for interactively creating a segmentation of a mesh. You can use several different tools to interactively select regions of the mesh and mark them as segments. Currently this is all SegTool does.

However, you might find SegTool useful as a basis for an interactive tool or testing environment. SegTool can load the OFF meshes and associated .SEG segmentation files from the Princeton Segmentation Benchmark. SegTool can also load Shape Diameter Function (SDF) files created using Lior Shapira's SDF software.

SegTool is built on libgeometry, which provides many geometry processing tools for you to experiment with.

Here is a screenshot:

SegTool is built on top of the libgeometry library (included in the subdirectory libgeometry\) which is in turn built on top of WildMagic4 from GeometricTools. To build SegTool you will need to follow three steps:

  1. run libgeometry\WildMagic4\autobuild_vs2008_x64.bat (or autobuild_vs2008.bat if you have a 32-bit machine)
  2. open SegTool\SegTool.sln
  3. build and run

Note that some pre-compiled static libraries are included (for exmaple GLUT and GLUI). These are built for Visual Studio 2008 SP1 and are unlikely to work with other versions (but they might - who knows!).

Here is a list of controls, which you will need to know to use the software:

  • Camera Control uses Maya Keys (ALT+LMB: rotate, ALT+MMB: pan, ALT+RMB: zoom)
  • ESC clears current selection
  • a key adds current selection as new segment
  • left-drag on background and then across model does laser-cut selection (closing loop is not required!)
  • left-drag on model begins multi-stroke on-surface lasso (closing loop is required. Go slow!)
  • Once selection exists, left-drag selects individual triangles, and right-drag deselects
  • s key - load SDF file
  • right-click does "magic wand" selection based on loaded SDF
  • wheel expands/contracts SDF selection by changing magic wand threshold
  • e key - export current segmentation as .SEG file
  • l key - load .SEG file
  • f key - load new mesh
  • w key - toggle wireframe

If you don't understand the lasso selection tools, this might help.

Shape Diameter Function (SDF) files can be generated using software on the Shape Diameter Function page.

You can get .SEG files for a large number of meshes from the Princeton Segmentation Benchmark (note that SegTool can load their OFF files as well)

Known Bugs

Too many to list. This is research software. It is not robust or efficient. Good luck!

If you are running inside the Visual Studio debugger and it is very slow, make sure you have set the environment variable _NO_DEBUG_HEAP=1 in the Environment field of the Debugging options in the SegTool Configuration Properties (right-click on the SegTool project in the Solution Explorer and select Properties at the bottom to get there). This will make an enormous difference.


This majority of this code is released under the Boost 1.0 License, so you can use it for any purpose, commercial or non-commercial. However, some of the code is taken from other sources and you will need to respect their individual licenses:

The subdirectory libgeometry\WildMagic4 is taken from the WildMagic library (version 4) developed and distributed by Dave Eberly at WildMagic contains, quite simply, the best low-level math library ever, and you should use it for everything. It is similarly under the Boost 1.0 License.

The subdirectory libgeometry\external\eigen contains the Eigen 3 distribution, a C++ headers-only math library. Eigen may be used under the LGPL3 or GPL3 licenses (FAQ).

The subdirectory libgeometry\external\SparseMatrix contains pre-compiled libraries that themselves contain compiled versions of many other math libraries, including LAPACK, BLAS, TAUCS, METIS, UMFPACK, and more. Please see the GSI page for details. (but, basically, this is a mish-mash of open-source licenses...)

The subdirectory CloneTool contains pre-compiled static libraries for GLUT, by Mark Kilgard, and GLUI, by Paul Rademacher. GLUT is "not public domain but freely redistributable" (link) and GLUI is distributed under the LGPL.

The file libgeometry\mesh_processing\Triangulator2D.cpp contains the source code to the TRIANGLE software, copyright Jonathan Richard Shewchuk. This code may not be used in commercial products without permission from the copyright owner. Please contact him, not me. (Note that TRIANGLE is not used in SegTool, it is just included with libgeometry)

If you want to reference TRIANGLE, here is a citation:

Jonathan Richard Shewchuk, Triangle: Engineering a 2D Quality Mesh Generator and Delaunay Triangulator, in ``Applied Computational Geometry: Towards Geometric Engineering'' (Ming C. Lin and Dinesh Manocha, editors), volume 1148 of Lecture Notes in Computer Science, pages 203-222, Springer-Verlag, Berlin, May 1996. (From the First ACM Workshop on Applied Computational Geometry.) [PostScript] [HTML].



Back To
DCS Logo
DGP Logo