trimesh2 is a C++ library and set of utilities for input, output,
and basic manipulation of 3D triangle meshes. The goals of the code are
ease of use and efficiency, possibly at the expense of some generality.
The library includes the following:
- Support for reading PLY, OFF, 3DS, and Wavefront OBJ files, together with
a few other formats of mostly local interest (SM, RAY).
- Support for writing PLY, OFF, and OBJ files.
- Vec: a templated C++ class for constant-length vectors, with
support for the usual arithmetic operations (add, subtract,
componentwise multiply and divide, dot product, cross product, etc.)
- XForm: a class for rigid-body transformations.
- An OpenGL trackball/arcball implementation, with automatic selection of
- Algorithms for subdivision, smoothing, curvature estimation, triangle
stripping, and various other simple mesh manipulations.
Bundled together with the library are:
In addition, the following utility programs are included:
- mesh_view: a simple 3D mesh viewer
- mesh_make: create arbitrarily-tessellated meshes of various simple shapes
- mesh_filter: applies a variety of simple transformations to a mesh,
such as converting formats, flipping faces, subdivision, smoothing,
rigid-body transformations, etc.
- mesh_cc: list and/or extract connected components from a mesh
- mesh_cat: combine several meshes into a single file
- mesh_align: align 2 meshes using ICP
- mesh_shade: a few procedural shaders for adding per-vertex color
- mesh_check: check for some kinds of topological oddities (e.g.,
more than 2 faces at an edge) in a mesh file. Removes parts of the
mesh to "clean it up" and leave it a manifold.
- mesh_crunch: quick-n-dirty mesh decimation using the
Rossignac-Borrel method of vertex collapse
- mesh_info: print out some information about a mesh
- xf: create or compose transformations in .xf files
The library is distributed under the
General Public License (GPL), version 2. The various libraries
distributed with trimesh2 are open source, and are believed to be covered
by GPL-compatible licenses. Please see the COPYING file.
The code is written in C++, and is known to compile using a recent (4.x)
version of g++ on several Unix-like OSes (Linux x86 and x86-64, Solaris,
Mac OSX). Compiling under Windows is possible using Cygwin or MinGW32.
Anecdotally, the code compiles with MS Visual Studio .NET or later
(not MSVC 6), but I am not able to support this – you're on
your own. (However, I will gladly accept patches that fix compilation, and
will consider patches that squash warnings.)
Warning: some gcc versions are known to miscompile
Please avoid version 4.1.2, or anything earlier than 4.0.1.
The author of trimesh2 is Szymon Rusinkiewicz.
The packages include source that should compile on Linux, Mac, and
MINGW / Cygwin.
The most recent version is 2.15
Changes since version 2.14:
- Fix for a bug in the KDtree implementation. Please use version
2.15 instead of 2.14
Changes since version 2.13:
- Symmetric ICP implementation that includes the method presented in
"A Symmetric Objective Function for ICP"
- k-D tree implementation can now do approximate nearest-neighbor matching
- The library and mesh_info client can now compute mesh overlap
as IOU (intersection over union)
- mesh_view will now use distance-adaptive point sizes when drawing
- Many bug fixes, compile fixes, and code cleanups
Changes since version 2.12:
- Many re-writes of header files to accommodate a large variety of compilers
and modern versions of C++
- Generic (GLSL-like) functions have been split out from Vec.h
- Compatibility functions for earlier compilers have been moved to
- SVD implementation in lineqn.h
- Significant updates to ICP
- GLManager class to make it easier to use OpenGL buffers and
shaders. mesh_view is updated to use it.
- Many capabilities of mesh_make and mesh_filter are
now available in the library - check TriMesh_algo.h for details
- Can now create teapots - see make_teapot() or mesh_make
Changes since version 2.11:
- Major user-visible change: the library and headers are now
contained within the trimesh namespace. Existing code must
be updated to refer to the TriMesh class and associated functions with
an explicit namespace qualifier, or include the following declaration
using namespace trimesh;
- Compile fixes for Mac. The code should now correctly build into
bin.Darwin64 and lib.Darwin64 on 64-bit capable
versions of MacOS. A 32-bit build can be forced via "make darwin32".
- Many fixes for signed-unsigned and std-namespace correctness.
- Vec now contains the methods
at, front, back, data,
cbegin, cend, rbegin, rend,
crbegin, crend, max_size, and fill
for compatibility with C++11 arrays.
- Bugfix for step() function.
- More complete support for standard math library functions on
- fromarray and transp functions for XForms.
- Yet another attempt at fixing KDtree and ICP for
point sets with duplicate coordinates.
- TriMesh::read() no longer triangulates grids by default.
Code that works only with faces needs to call
- mesh_make can now create surfaces of revolution from curves.
Changes since version 2.10:
- Separate type / header file for bounding boxes
- Preliminary support for output of Collada .dae files
- GLCamera supports axis-constrained rotation
- Detection of "shared" vertices via
mesh_filter -share and
shared(TriMesh *mesh, float tol)
- mesh_filter -tsmooth: smoothing with umbrella operator,
constrained to tangent plane
- mesh_info csize to print out bounding box center and size
- mesh_view -grab command-line option to just
render a single image and save it out
- The Vec class now has a full set of comparison operators,
so that vecs can be put into STL sets
- Color has more accurate colorspace conversion matrices (and comments)
- Many bug fixes, including correct multi-threaded subdivision and diffusion
- Many compile fixes and code cleanups, including handling of PI,
float vs. double, std::, cstddef, etc.
Changes since version 2.9:
- Many more options for computing mesh statistics in mesh_info, e.g.
mesh_info in.ply median edgelen |
mesh_info in.ply total facearea
mesh_info in.ply rms dihedral
mesh_info in.ply overlap in2.ply
- Moved connected-components computation into library, with mesh_cc
just a wrapper
- Parallelized connectivity and diffusion computations
- Basic support for STL files
- Support for per-vertex normals in OBJ files
- More support for pointclouds, including normal computation based on
- Stricter use of std namespace. This may require adding using
declarations to client code for classes and functions that used to be
injected into the global namespace by Vec.h, including
std::vector, std::min, std::max, and
- Many bug, compile, and warning fixes
Changes since version 2.8:
- New utilities: mesh_check, mesh_crunch,
mesh_info, and xf
- Many small bugfixes, as well as fixes for compilation errors and warnings
- Bugfixes for OpenMP directives
- Componentwise functions (trigonometric, etc.) for Vec
- Colorspace conversion for Color
- The dist shader of mesh_shade now takes an absolute
distance scale, instead of auto-scaling. (This is useful much more frequently
than the previous behavior.)
- mesh_view now uses glArrayElement instead of
glDrawElements on Intel cards. This provides a considerable
speedup on the machines available to me.
- Provides the ability to install hooks (e.g. for GUI applications)
for status/warning/error messages printed by trimesh2
- Includes Darwin binaries
Changes since version 2.7:
- Many compilation, portability, and bug fixes
- Colors are now stored as floats - this will require updating
external code that uses trimesh2
- Support for maintaining range grids as grids, instead of automatically
converting to meshes upon read
- Rudimentary (possibly broken, incomplete) support for reading VVD files
- mesh_filter: Added bilateral mesh filtering using the method of
[Jones et al. 2003]
- mesh_make: Added Klein bottle, rhombic triacontahedron
- OpenMP directives in a few places for multi-threading
- Many functions moved from utilities into library
Changes since version 2.6:
- Miscellaneous compilation, portability, and bug fixes
- mesh_filter: Added -pcasnap; added -fly
(butterfly subdivision); more robust -orient
- mesh_make: Added trefoil knot
- Linux x86_64 libraries and binaries now go in lib.Linux64/ and bin.Linux64/
Changes since version 2.5:
Changes since version 2.4:
- mesh_filter: Added -sharpen and -usmooth flags;
bugfixes for Mac compilation, transforming meshes with normals
- mesh_make: Fix for making cubes with tess = 1
- mesh_align: ICP with isotropic or anisotropic (affine) scale
- mesh_cat: Bugfix in handling normals, colors, etc.
- mesh_shade: Added a few shaders, including coloring based on
- Fixed bug in curvature computation
- Small bugfix in mesh_view
- Compile fixes
- Added mesh_shade with a few procedural shaders
Changes since version 2.3:
- Added mesh_align
- XForm.h and some of the utility programs should now support
affine transforms (as opposed to just rigid-body)
- Added yet more options to mesh_filter
Changes since version 2.2:
Changes since version 2.1:
- Added a couple of options to mesh_filter
- Bugfix for depth readback on ATI cards with broken drivers
Changes since version 2.0:
- Added mesh_cat utility
- Added several options to mesh_filter
- Many bugfixes, including compilation errors, I/O, and mesh_view
Please contact smr at princeton edu if you have any questions about