* apps/statues/mesh-max-curv.cc, apps/statues/mesh-pinv-curv.cc,
* apps/statues/mesh-segm.cc, apps/statues/mesh-skel.cc:
s/exit/std::exit/.
* apps/statues/mesh-pinv-curv.cc (pi): Make it a constant.
* apps/statues/mesh-max-curv.cc (pi): Remove useless constant.
Remove useless #include directives.
Typo in comment.
* apps/statues/mesh-skel.cc: Fix Doxygen headers.
* apps/statues/mesh-complex-segm.cc: Aesthetic changes.
---
milena/ChangeLog | 14 ++++++++++++++
milena/apps/statues/mesh-complex-segm.cc | 26 ++++++++++----------------
milena/apps/statues/mesh-max-curv.cc | 16 ++++++----------
milena/apps/statues/mesh-pinv-curv.cc | 8 ++++----
milena/apps/statues/mesh-segm.cc | 6 +++---
milena/apps/statues/mesh-skel.cc | 8 ++++----
6 files changed, 41 insertions(+), 37 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index ef8b409..aa168d3 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,19 @@
2008-12-30 Roland Levillain <roland(a)lrde.epita.fr>
+ Clean up apps/statues/ a bit.
+
+ * apps/statues/mesh-max-curv.cc, apps/statues/mesh-pinv-curv.cc,
+ * apps/statues/mesh-segm.cc, apps/statues/mesh-skel.cc:
+ s/exit/std::exit/.
+ * apps/statues/mesh-pinv-curv.cc (pi): Make it a constant.
+ * apps/statues/mesh-max-curv.cc (pi): Remove useless constant.
+ Remove useless #include directives.
+ Typo in comment.
+ * apps/statues/mesh-skel.cc: Fix Doxygen headers.
+ * apps/statues/mesh-complex-segm.cc: Aesthetic changes.
+
+2008-12-30 Roland Levillain <roland(a)lrde.epita.fr>
+
Disable graph-based applications depending on Trimesh.
* apps/statues/Makefile.am (bin_PROGRAMS)
diff --git a/milena/apps/statues/mesh-complex-segm.cc
b/milena/apps/statues/mesh-complex-segm.cc
index 00c9d13..80f87a1 100644
--- a/milena/apps/statues/mesh-complex-segm.cc
+++ b/milena/apps/statues/mesh-complex-segm.cc
@@ -55,7 +55,7 @@ int main(int argc, char* argv[])
{
std::cerr << "usage: " << argv[0] << " input.off
lambda output.off"
<< std::endl;
- exit(1);
+ std::exit(1);
}
std::string input_filename = argv[1];
@@ -77,23 +77,18 @@ int main(int argc, char* argv[])
mln::io::off::load(input, input_filename);
// Values on edges.
-
- /* FIXME: To be improved: instead of computing the curvature on
- edges from a mean of the curvature on adjacent polygons, compute
- it directly from the curvature on vertices. We should probably
- integrate Trimesh's curvature computation into Milena. */
mln::p_n_faces_fwd_piter<D, G> e(input.domain(), 1);
typedef mln::complex_higher_neighborhood<D, G> adj_polygons_nbh_t;
adj_polygons_nbh_t adj_polygons_nbh;
- mln_niter_(adj_polygons_nbh_t) p(adj_polygons_nbh, e);
+ mln_niter_(adj_polygons_nbh_t) adj_p(adj_polygons_nbh, e);
// Iterate on edges (1-faces).
for_all(e)
{
float s = 0.0f;
unsigned n = 0;
- for_all(p)
+ for_all(adj_p)
{
- s += input(p);
+ s += input(adj_p);
++n;
}
input(e) = s / n;
@@ -118,14 +113,13 @@ int main(int argc, char* argv[])
| WST. |
`------*/
- /* FIXME: Note that the WST is either doing too much work, since we
- have not constrained the domain of the image to 1-faces only.
-
+ /* FIXME: Note that the WST is doing too much work, since we have
+ not constrained the domain of the image to 1-faces only.
It would be great if we could use something like this:
- closed_input | mln::p_faces<1, D, G>(closed_input.domain())
+ closed_input | mln::p_faces<1, D, G>(closed_input.domain())
- as input of the WST. */
+ as input of the WST. */
// Compute the WST on edges.
typedef unsigned wst_val_t;
@@ -138,8 +132,8 @@ int main(int argc, char* argv[])
// Label polygons (i.e., propagate labels from edges to polygons).
for_all(e)
if (wshed(e) != 0)
- for_all(p)
- wshed(p) = wshed(e);
+ for_all(adj_p)
+ wshed(adj_p) = wshed(e);
/*---------.
| Output. |
diff --git a/milena/apps/statues/mesh-max-curv.cc b/milena/apps/statues/mesh-max-curv.cc
index 8fc9a06..5524282 100644
--- a/milena/apps/statues/mesh-max-curv.cc
+++ b/milena/apps/statues/mesh-max-curv.cc
@@ -30,7 +30,6 @@
/// a mesh.
#include <cstdlib>
-#include <cmath>
#include <algorithm>
#include <vector>
@@ -47,17 +46,13 @@
#include "io.hh"
-// Doesn't C++ have a better way to express Pi?
-const float pi = 4 * atanf(1);
-
-
int main(int argc, char* argv[])
{
if (argc != 3)
{
std::cerr << "usage: " << argv[0] << " input.off
output.off"
<< std::endl;
- exit(1);
+ std::exit(1);
}
std::string input_filename = argv[1];
@@ -69,13 +64,14 @@ int main(int argc, char* argv[])
// object.
TriMesh* mesh_ptr = TriMesh::read(input_filename.c_str());
if (!mesh_ptr)
- exit(2);
+ std::exit(2);
TriMesh& mesh = *mesh_ptr;
// Computes faces (triangles).
mesh.need_faces();
// Computation of the curvature on each vertex of the mesh.
mesh.need_curvatures();
+
std::vector<float> vertex_m(mesh.vertices.size(), 0.f);
for (unsigned v = 0; v < mesh.vertices.size(); ++v)
// Max curvature.
@@ -84,7 +80,7 @@ int main(int argc, char* argv[])
// For each face of the mesh, computean an average curvature value
// from the mean curvature at its vertices.
- std::vector<float> face_m(mesh.faces.size(), 42.f);
+ std::vector<float> face_m(mesh.faces.size(), 0.f);
mln::accu::min_max<float> acc;
for (unsigned f = 0; f < mesh.faces.size(); ++f)
{
@@ -103,7 +99,7 @@ int main(int argc, char* argv[])
// FIXME: Taken from mln/level/stretch.hh (this should be factored).
float min = min_max.first;
float max = min_max.second;
- // Don't normalize actually if the curvature is constants (i.e.,
+ // Don't normalize actually if the curvature is constant (i.e.,
// if min == max).
if (min != max)
{
@@ -122,7 +118,7 @@ int main(int argc, char* argv[])
{
std::cerr << "Error opening " << output_filename.c_str()
<< " for writing." << std::endl;
- exit(2);
+ std::exit(2);
}
write_off_float(mesh_ptr, normalized_face_m, f_out);
fclose(f_out);
diff --git a/milena/apps/statues/mesh-pinv-curv.cc
b/milena/apps/statues/mesh-pinv-curv.cc
index 8f38c57..d7dd773 100644
--- a/milena/apps/statues/mesh-pinv-curv.cc
+++ b/milena/apps/statues/mesh-pinv-curv.cc
@@ -43,7 +43,7 @@
// Doesn't C++ have a better way to express Pi?
-const float pi = 4 * atanf(1);
+static const float pi = 4 * atanf(1);
int main(int argc, char* argv[])
@@ -52,7 +52,7 @@ int main(int argc, char* argv[])
{
std::cerr << "usage: " << argv[0] << " input.off
output.off"
<< std::endl;
- exit(1);
+ std::exit(1);
}
std::string input_filename = argv[1];
@@ -64,7 +64,7 @@ int main(int argc, char* argv[])
// object.
TriMesh* mesh_ptr = TriMesh::read(input_filename.c_str());
if (!mesh_ptr)
- exit(2);
+ std::exit(2);
TriMesh& mesh = *mesh_ptr;
// Computes faces (triangles).
@@ -98,7 +98,7 @@ int main(int argc, char* argv[])
{
std::cerr << "Error opening " << output_filename.c_str()
<< " for writing." << std::endl;
- exit(2);
+ std::exit(2);
}
write_off_float(mesh_ptr, face_h_inv, f_out);
fclose(f_out);
diff --git a/milena/apps/statues/mesh-segm.cc b/milena/apps/statues/mesh-segm.cc
index 5ab247f..46391a1 100644
--- a/milena/apps/statues/mesh-segm.cc
+++ b/milena/apps/statues/mesh-segm.cc
@@ -62,7 +62,7 @@ int main(int argc, char* argv[])
{
std::cerr << "usage: " << argv[0] << " input.off
lambda output.off"
<< std::endl;
- exit(1);
+ std::exit(1);
}
std::string input_filename = argv[1];
@@ -79,7 +79,7 @@ int main(int argc, char* argv[])
// object.
TriMesh* mesh_ptr = TriMesh::read(input_filename.c_str());
if (!mesh_ptr)
- exit(2);
+ std::exit(2);
TriMesh& mesh = *mesh_ptr;
// Computes faces (triangles).
@@ -224,7 +224,7 @@ int main(int argc, char* argv[])
{
std::cerr << "Error opening " << output_filename.c_str()
<< " for writing." << std::endl;
- exit(2);
+ std::exit(2);
}
write_off_colored(mesh_ptr, face_color, f_out);
fclose(f_out);
diff --git a/milena/apps/statues/mesh-skel.cc b/milena/apps/statues/mesh-skel.cc
index e45d07c..c4fd0f2 100644
--- a/milena/apps/statues/mesh-skel.cc
+++ b/milena/apps/statues/mesh-skel.cc
@@ -25,7 +25,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/// \file apps/statues/mesh-segm.cc
+/// \file apps/statues/mesh-skel.cc
/// \brief A program computing a skeleton of the surface of the
/// (triangle) mesh of a statue.
@@ -62,7 +62,7 @@ int main(int argc, char* argv[])
{
std::cerr << "usage: " << argv[0] << " input.off
lambda output.off"
<< std::endl;
- exit(1);
+ std::exit(1);
}
std::string input_filename = argv[1];
@@ -79,7 +79,7 @@ int main(int argc, char* argv[])
// object.
TriMesh* mesh_ptr = TriMesh::read(input_filename.c_str());
if (!mesh_ptr)
- exit(2);
+ std::exit(2);
TriMesh& mesh = *mesh_ptr;
// Computes faces (triangles).
@@ -201,7 +201,7 @@ int main(int argc, char* argv[])
{
std::cerr << "Error opening " << output_filename.c_str()
<< " for writing." << std::endl;
- exit(2);
+ std::exit(2);
}
write_off_binary(mesh_ptr, face_value, f_out);
fclose(f_out);
--
1.6.0.4