1/*
2 *  Copyright (c) 2012-2014, Bruno Levy
3 *  All rights reserved.
4 *
5 *  Redistribution and use in source and binary forms, with or without
6 *  modification, are permitted provided that the following conditions are met:
7 *
8 *  * Redistributions of source code must retain the above copyright notice,
9 *  this list of conditions and the following disclaimer.
10 *  * Redistributions in binary form must reproduce the above copyright notice,
11 *  this list of conditions and the following disclaimer in the documentation
12 *  and/or other materials provided with the distribution.
13 *  * Neither the name of the ALICE Project-Team nor the names of its
14 *  contributors may be used to endorse or promote products derived from this
15 *  software without specific prior written permission.
16 *
17 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21 *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 *  POSSIBILITY OF SUCH DAMAGE.
28 *
29 *  If you modify this software, you should include a notice giving the
30 *  name of the person performing the modification, the date of modification,
31 *  and the reason for such modification.
32 *
33 *  Contact: Bruno Levy
34 *
35 *     Bruno.Levy@inria.fr
36 *     http://www.loria.fr/~levy
37 *
38 *     ALICE Project
39 *     LORIA, INRIA Lorraine,
40 *     Campus Scientifique, BP 239
41 *     54506 VANDOEUVRE LES NANCY CEDEX
42 *     FRANCE
43 *
44 */
45
46namespace GEO {
47
48/**
49
50\page geogram_examples Example programs
51
52Geogram sample programs
53=======================
54
55The options for all example programs can be queried using <program_name> -h or <program_name> /?
56
57vorpaview
58---------
59a simple mesh viewer
60
61Usage: \code vorpaview meshfile \endcode
62where meshfile is a .mesh, .meshb, .ply, .tet, .obj or .stl file.
63
64If the graphic board supports GLSL, vorpaview uses shaders. If the
65graphic board does not have sufficient GLSL support, vorpaview uses
66plain OpenGL (fixed functionality pipeline). Note that some old
67OpenGL drivers may erroneously claim they support GLSL. If you have
68this problem, you can force vorpaview to deactivate GLSL mode, use:
69\code vorpaview gfx:GLSL=false meshfile \endcode
70Alternatively, you can rename vorpaview(.exe) as vorpaview0(.exe),
71this will deactivate GLSL by default. Note that some options / key bindings
72may not work under this degraded mode.
73
74vorpastat
75---------
76vorpastat measures the Hausdorff distance between two meshes
77
78usage: \code vorpastat meshfile1 meshfile2 \endcode
79
80vorpastat can be used to automatically test remeshing algorithms on mesh databases.
81It tests both mesh topology and Haussdorff distance. Whenever the mesh topologies differ
82or the Haussdorff distance is larger than 5% of the bounding box diagonal, it
83returns a non-zero result.
84
85\code vorpastat stat:sampling_step=nnn meshfile1 meshfile2 \endcode
86can be used to specify the average distance between
87two samples used to estimate the Hausdorff distance (expressed in absolute units or
88in percentage of the bounding box diagonal if it has a trailing '\%' sign).
89
90vorpalite
91---------
92
93vorpalite implements several reconstruction and remeshing algorithms.
94Use the following command to see all the available options:
95\code
96   vorpalite -h
97\endcode
98
99Some examples: \n
100
101Reconstruction (clean point cloud):
102\code
103   vorpalite profile=reconstruct my_points.xyz my_surface.meshb
104\endcode
105
106Reconstruction (noisy point cloud):
107\code
108   vorpalite profile=reconstruct co3ne:Psmooth_iter=2 my_points.xyz my_surface.meshb
109\endcode
110
111Remeshing (anisotropic):
112\code
113   vorpalite profile=remesh input_surface.meshb output_surface.meshb pts=30000
114\endcode
115where 30000 is the desired number of points
116
117Remeshing (isotropic):
118\code
119   vorpalite profile=remesh input_surface.meshb output_surface.meshb pts=30000 aniso=0
120\endcode
121
122Remeshing (graded):
123\code
124   vorpalite profile=remesh input_surface.meshb output_surface.meshb pts=30000 aniso=0 gradation=1
125\endcode
126
127Repair:
128\code
129   vorpalite profile=repair input_surface.meshb output_surface.meshb
130\endcode
131
132Tetrahedral meshing (through bundled TetGen, by Hang Si):
133\code
134   vorpalite profile=tet input_surface.meshb output_tetrahedral_mesh.meshb
135\endcode
136
137compute_delaunay
138----------------
139computes the 3D Delaunay triangulation of a set of points. Note: this is not a
140reconstruction method, the 3D Delaunay triangulation is a tetrahedral mesh that
141uses all the points as its vertices, and that has a boundary that corresponds to
142the convex hull of the pointset. It is not directly useful for applications, but some users
143may want to compute it to extract information from it, e.g. to implement their own
144reconstruction method.
145
146usage:
147\code compute_delaunay pointsfile <outputfile> \endcode
148
149The points file can be in any mesh format supported by Geogram (.mesh, .meshb, .ply ...)
150and in .xyz file format (ASCII, one point per line). The output file (default: out.meshb
151if not specified) contains the tetrahedra. The result can be displayed using vorpaview.
152
153Additional parameters:
154- algo:delaunay=(BDEL|PDEL|tetgen) specify the implementation of the Delaunay triangulation. It can be one of
155  PDEL:Geogram parallel (default), BDEL:Geogram sequential or tetgen (if compiled with tetgen support).
156- dbg:delaunay_benchmark=true to enable more statistics/timings
157- sys:stats=true to display statistics (including predicates and symbolic perturbation)
158
159
160compute_OTM
161-----------
162computes semi-discrete optimal transport map in 3D,
163The algorithm is described in the following references:
164
1651. 3D algorithm: http://arxiv.org/abs/1409.1279
1662. Earlier 2D version by Quentin Merigot:
167 Q. Merigot. A multiscale approach to optimal transport.
168 Computer Graphics Forum 30 (5) 1583--1592, 2011 (Proc SGP 2011).
1693. Earlier theoretical article on OT and power diagrams:
170 F. Aurenhammer, F. Hoffmann, and B. Aronov. Minkowski-type theorems
171 and least-squares clustering. Algorithmica, 20:61-76, 1998.
172
173usage:
174\code compute_OTM meshfile1 meshfile2 \endcode
175
176where meshfile1 and meshfile2 are volumetric tetrahedral meshes. If geogram is compiled
177with tetgen support (see \link geogram_compiling  "compiling" \endlink), mesh files
178can be surfacic meshes (they are then tetrahedralized using tetgen).
179
180This computes a morphing between meshfile1 and meshfile2, saved in morph.tet6, and that
181can be displayed using vorpaview (see above). In addition to standard vorpaview key
182bindings, one can use 't' and 'r' to navigate through time and animate the morphing.
183'F1' can be used to display the tetrahedra inside the mesh.
184
185Additional parameters
186- recenter = true: moves the second mesh in such a way that their centroids match
187- rescale = true: rescale the second mesh in such a way it has the same volume as the first one
188- nb_pts = nnnnn: number of points used to resample the second mesh (default = 1000, use typically
189 30000 for a nice result)
190- singular = true: output the "singular set" (i.e. the points where transport is discontinuous) to
191 singular.obj
192- out=filename.eobj|filename.obj6|filename.tet6: specify the output file. tet6 file format is a
193 tetrahedral mesh with 6 coordinates per vertex (original and final time). obj6 file format is
194 a surfacic mesh with 6 coordinates per vertex (original and final time), and eobj file format
195 is a surfacic animated mesh with additional information (Kantorovich potential), to be displayed
196 in the Graphite software.
197
198
199compute_RVD
200-----------
201computes the intersection between a Voronoi diagram and a surfacic or volumetric simplicial set
202
203*/
204
205}
206