* build-aux/texi2dvi: Update from CVS Texinfo.
---
ChangeLog | 6 ++
build-aux/texi2dvi | 146 +++++++++++++++++++++++++++++----------------------
2 files changed, 89 insertions(+), 63 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c65aef6..efd4106 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2012-10-05 Roland Levillain <roland(a)lrde.epita.fr>
+ Update texi2dvi from upstream.
+
+ * build-aux/texi2dvi: Update from CVS Texinfo.
+
+2012-10-05 Roland Levillain <roland(a)lrde.epita.fr>
+
Remove Trimesh sources from Olena.
* external/trimesh/,
diff --git a/build-aux/texi2dvi b/build-aux/texi2dvi
index 7d1f2ab..1f346e1 100755
--- a/build-aux/texi2dvi
+++ b/build-aux/texi2dvi
@@ -1,9 +1,10 @@
#! /bin/sh
# texi2dvi --- produce DVI (or PDF) files from Texinfo (or (La)TeX) sources.
-# $Id: texi2dvi,v 1.157 2010/02/09 18:37:08 karl Exp $
+# $Id: texi2dvi,v 1.173 2012/04/20 18:52:48 karl Exp $
#
-# Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003,
-# 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+# Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+# Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,7 +34,7 @@ unset RUNNING_KSH
set -e
# This string is expanded automatically when this file is checked out.
-rcs_revision='$Revision: 1.157 $'
+rcs_revision='$Revision: 1.173 $'
rcs_version=`set - $rcs_revision; echo $2`
program=`echo $0 | sed -e 's!.*/!!'`
@@ -58,6 +59,7 @@ quiet=false # let the tools' message be displayed
recode=false
set_language=
src_specials=
+shell_escape=
latex2html=hevea # or set to tex4ht
textra= # Extra TeX commands to insert in the input file.
txiprereq=19990129 # minimum texinfo.tex version with macro expansion
@@ -129,13 +131,15 @@ test -n "$TEX" && test -d "$TEX" && unset TEX
test_local () {
local foo=foo
}
- test_local
+ test_local >/dev/null 2>&1
test $foo = bar
-) || local () {
+) || eval '
+local () {
case $1 in
*=*) eval "$1";;
esac
}
+'
# cd_orig
@@ -186,8 +190,8 @@ absolute ()
local rel
rel=$orig_pwd/`func_dirname "$1"`
if test -d "$rel"; then
- (cd "$rel" 2>/dev/null &&
- local n
+ (cd "$rel" 2>/dev/null \
+ && local n
n=`pwd`/`basename "$1"`"$slashes"
echo "$n")
else
@@ -218,7 +222,7 @@ ensure_dir ()
# error EXIT_STATUS LINE1 LINE2...
# --------------------------------
-# Report an error and exit with failure if EXIT_STATUS is non null.
+# Report an error and exit with failure if EXIT_STATUS is non-null.
error ()
{
local s="$1"
@@ -248,8 +252,8 @@ findprog ()
# design decisions, so there is little chance to make them consistent.)
# Thusly, it seems to be difficult to make use of these enhancements.
#
- if { test -f "$dir/$1" && test -x "$dir/$1"; } ||
- { test -f "$dir/$1.exe" && test -x "$dir/$1.exe"; }; then
+ if { test -f "$dir/$1" && test -x "$dir/$1"; } \
+ || { test -f "$dir/$1.exe" && test -x "$dir/$1.exe"; }; then
return 0
fi
done
@@ -274,8 +278,8 @@ report ()
run ()
{
verbose "Running $@"
- "$@" 2>&5 1>&2 ||
- error 1 "$1 failed"
+ "$@" 2>&5 1>&2 \
+ || error 1 "$1 failed"
}
@@ -295,8 +299,8 @@ usage ()
# where % denotes the eol character.
cat <<EOF
Usage: $program [OPTION]... FILE...
- texi2pdf [OPTION]... FILE...
- pdftexi2dvi [OPTION]... FILE...
+ or: texi2pdf [OPTION]... FILE...
+ or: pdftexi2dvi [OPTION]... FILE...
Run each Texinfo or (La)TeX FILE through TeX in turn until all
cross-references are resolved, building all indices. The directory
@@ -316,13 +320,21 @@ General options:
-b, --batch no interaction
-D, --debug turn on shell debugging (set -x)
-h, --help display this help and exit successfully
- -o, --output=OFILE leave output in OFILE (implies --clean);
- only one input FILE may be specified in this case
+ -o, --output=OFILE leave output in OFILE; only one input FILE is allowed
-q, --quiet no output unless errors (implies --batch)
-s, --silent same as --quiet
-v, --version display version information and exit successfully
-V, --verbose report on what is done
+Output format:
+ --dvi output a DVI file [default]
+ --dvipdf output a PDF file via DVI (using a dvi-to-pdf program)
+ --html output an HTML file from LaTeX, using HeVeA
+ --info output an Info file from LaTeX, using HeVeA
+ -p, --pdf use pdftex or pdflatex for processing
+ --ps output a PostScript file via DVI (using dvips)
+ --text output a plain text file from LaTeX, using HeVeA
+
TeX tuning:
-@ use @input instead of \input for preloaded Texinfo
-e, -E, --expand force macro expansion using makeinfo
@@ -331,20 +343,12 @@ TeX tuning:
--no-line-error do not pass --file-line-error to TeX
-r, --recode call recode before TeX to translate input
--recode-from=ENC recode from ENC to the @documentencoding
+ --shell-escape pass --shell-escape to TeX
--src-specials pass --src-specials to TeX
-t, --command=CMD insert CMD in copy of input file
or --texinfo=CMD multiple values accumulate
--translate-file=FILE use given charset translation file for TeX
-Output format:
- --dvi output a DVI file [default]
- --dvipdf output a PDF file via DVI (using dvipdf)
- --html output an HTML file. Use HeVeA for LaTeX files
- --info output an Info file. Use HeVeA for LaTeX files
- -p, --pdf use pdftex or pdflatex for processing
- --ps output a PDF file via DVI (using dvips)
- --text output a plain text file. Use HeVeA for LaTeX files
-
Build modes:
--build=MODE specify the treatment of auxiliary files [$build_mode]
--tidy same as --build=tidy
@@ -374,7 +378,7 @@ Using the \`tidy' mode brings several advantages:
directories are stored there.
- clutter can be reduced to zero using, e.g., --build-dir=/tmp/\$USER.t2d
or --build-dir=\$HOME/.t2d.
- - the output file is updated after every succesful TeX run, for
+ - the output file is updated after every successful TeX run, for
sake of concurrent visualization of the output. In a \`local' build
the viewer stops during the whole TeX run.
- if the compilation fails, the previous state of the output file
@@ -384,13 +388,19 @@ Using the \`tidy' mode brings several advantages:
On the other hand, because \`tidy' compilation takes place in another
directory, occasionally TeX won't be able to find some files (e.g., when
-using \\graphicspath): in that case use -I to specify the additional
+using \\graphicspath): in that case, use -I to specify the additional
directories to consider.
-The values of the BIBTEX, DVIPDF, DVIPS, LATEX, MAKEINDEX, MAKEINFO,
-PDFLATEX, PDFTEX, TEX, TEXINDEX, and THUMBPDF environment variables are used
-to run those commands, if they are set. Any CMD strings are added after
-@setfilename for Texinfo input, in the first line for LaTeX input.
+The values of the BIBTEX, DVIPDF, DVIPS, HEVEA, LATEX, MAKEINDEX,
+MAKEINFO, PDFLATEX, PDFTEX, T4HT, TEX, TEX4HT, TEXINDEX, and THUMBPDF
+environment variables are used to run those commands, if they are set.
+
+Regarding --dvipdf, if DVIPDF is not set in the environment, the
+following programs are looked for (in this order): dvipdfmx dvipdfm
+dvipdf dvi2pdf dvitopdf.
+
+Any CMD strings are added after @setfilename for Texinfo input, or in
+the first line for LaTeX input.
Report bugs to bug-texinfo(a)gnu.org,
general questions and discussion to help-texinfo(a)gnu.org.
@@ -414,13 +424,13 @@ verbose ()
# version
# -------
-# Display version info and exit succesfully.
+# Display version info and exit successfully.
version ()
{
cat <<EOF
-texi2dvi (GNU Texinfo 4.13) $rcs_version
+texi2dvi (GNU Texinfo 4.13+dev) $rcs_version
-Copyright (C) 2008 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
@@ -673,7 +683,10 @@ destdir ()
# an auxiliary file with the same base name.
move_to_dest ()
{
- # If we built in place, there is nothing to install, leave.
+# echo "move_to_dest $*, tidy=$tidy, oname=$oname"
+
+ # If we built in place and have no output name, there is nothing to
+ # do, so just return.
case $tidy:$oname in
false:) return;;
esac
@@ -686,14 +699,17 @@ move_to_dest ()
for file
do
- test -f "$file" ||
- error 1 "no such file or directory: $file"
+ test -f "$file" \
+ || error 1 "no such file or directory: $file"
case $tidy:$oname in
true:) destdir=$orig_pwd
destfile=$destdir/$file;;
- *:*) destfile=`output_base_name "$file"`
+ true:*) destfile=`output_base_name "$file"`
destdir=`dirname "$destfile"`;;
+ false:*) destfile=$oname
+ destdir=`dirname "$destfile"`;;
esac
+
# We want to compare the source location and the output location,
# and if they are different, do the move. But if they are the
# same, we must preserve the source. Since we can't assume
@@ -987,6 +1003,9 @@ run_tex ()
# source, given a sufficiently smart editor), if specified.
test -n "$src_specials" && cmd="$cmd $src_specials"
+ # Tell TeX to allow running external executables
+ test -n "$shell_escape" && cmd="$cmd $shell_escape"
+
# Tell TeX to be batch if requested.
if $batch; then
# \batchmode does not show terminal output at all, so we don't
@@ -1103,9 +1122,10 @@ run_bibtex ()
# won't know that if the index files are out of date or nonexistent.
run_index ()
{
- local index_files=`generated_files_get $in_noext index_file_p`
- test -n "$index_files" ||
- return 0
+ local index_files
+ index_files=`generated_files_get $in_noext index_file_p`
+ test -n "$index_files" \
+ || return 0
: ${MAKEINDEX:=makeindex}
: ${TEXINDEX:=texindex}
@@ -1154,7 +1174,7 @@ run_tex4ht ()
{
case $in_lang:$latex2html:`out_lang_tex` in
latex:tex4ht:html)
- : ${TEX4HT=tex4ht} ${T4HT=t4ht}
+ : ${TEX4HT:=tex4ht} ${T4HT:=t4ht}
run "$TEX4HT" "-f/$in_noext"
# Do not remove the / after the destdir.
run "$T4HT" "-d`destdir`/" "-f/$in_noext"
@@ -1191,8 +1211,7 @@ run_dvipdf ()
{
# Find which dvi->pdf program is available.
if test -z "$dvipdf"; then
- for i in "$DVIPDF" dvipdfmx dvipdfm dvipdf dvi2pdf dvitopdf;
- do
+ for i in "$DVIPDF" dvipdfmx dvipdfm dvipdf dvi2pdf dvitopdf; do
if findprog $i; then
dvipdf=$i
fi
@@ -1259,8 +1278,8 @@ run_tex_suite ()
move_to_dest "$in_noext.`out_lang_ext`"
;;
*:ps)
- : {DVIPS=dvips}
- $DVIPS -o "$in_noext.`out_lang_ext`" "$in_noext.`out_lang_tex`"
+ : ${DVIPS:=dvips}
+ run $DVIPS -o "$in_noext.`out_lang_ext`" "$in_noext.`out_lang_tex`"
move_to_dest "$in_noext.`out_lang_ext`"
;;
esac
@@ -1274,7 +1293,7 @@ run_tex_suite ()
# A sed script that preprocesses Texinfo sources in order to keep the
-# iftex sections only. We want to remove non TeX sections, and comment
+# iftex sections only. We want to remove non-TeX sections, and comment
# (with `@c _texi2dvi') TeX sections so that makeinfo does not try to
# parse them. Nevertheless, while commenting TeX sections, don't
# comment @macro/@end macro so that makeinfo does propagate them.
@@ -1330,22 +1349,21 @@ run_makeinfo ()
# Check if texinfo.tex performs macro expansion by looking for
# its version. The version is a date of the form YEAR-MO-DA.
# We don't need to use [0-9] to match the digits since anyway
- # the comparison with $txiprereq, a number, will fail with non
- # digits.
+ # the comparison with $txiprereq, a number, will fail with non-digits.
# Run in a temporary directory to avoid leaving files.
version_test_dir=$t2ddir/version_test
ensure_dir "$version_test_dir"
- (
+ if (
cd "$version_test_dir"
echo '\input texinfo.tex @bye' >txiversion.tex
# Be sure that if tex wants to fail, it is not interactive:
# close stdin.
$TEX txiversion.tex </dev/null >txiversion.out 2>txiversion.err
- )
- if test $? != 0; then
+ ); then :; else
+ report "texinfo.tex appears to be broken:"
cat "$version_test_dir/txiversion.out"
cat "$version_test_dir/txiversion.err" >&2
- error 1 "texinfo.tex appears to be broken, quitting."
+ error 1 "quitting."
fi
eval `sed -n 's/^.*\[\(.*\)version \(....\)-\(..\)-\(..\).*$/txiformat=\1 txiversion="\2\3\4"/p' "$version_test_dir/txiversion.out"`
verbose "texinfo.tex preloaded as \`$txiformat', version is \`$txiversion' ..."
@@ -1699,6 +1717,7 @@ while test x"$1" != x"$arg_sep"; do
-r | --recode) recode=true;;
--recode-from) shift; recode=true; recode_from="$1";;
--src-specials) src_specials=--src-specials;;
+ --shell-escape) shell_escape=--shell-escape;;
--tex4ht) latex2html=tex4ht;;
-t | --texinfo | --command ) shift; textra="$textra\\
"`echo "$1" | sed 's/\\\\/\\\\\\\\/g'`;;
@@ -1800,14 +1819,15 @@ fi
# Enable tracing, and auxiliary tools output.
-#
-# Should be used where you'd typically use /dev/null to throw output
-# away. But sometimes it is convenient to see that output (e.g., from
-# a grep) to aid debugging. Especially debugging at distance, via the
-# user.
+#
+# This fd should be used where you'd typically use /dev/null to throw
+# output away. But sometimes it is convenient to see that output (e.g.,
+# from a grep) to aid debugging. Especially debugging at distance, via
+# the user.
+#
if $debug; then
exec 6>&1
- set -x
+ set -vx
else
exec 6>/dev/null
fi
@@ -1848,15 +1868,15 @@ input_file_name_decode ()
# If the COMMAND_LINE_FILENAME is not absolute (e.g., --debug.tex),
# prepend `./' in order to avoid that the tools take it as an option.
- echo "$command_line_filename" | $EGREP '^(/|[A-Za-z]:/)' >&6 \
+ echo "$command_line_filename" | LC_ALL=C $EGREP '^(/|[A-Za-z]:/)' >&6 \
|| command_line_filename="./$command_line_filename"
# See if the file exists. If it doesn't we're in trouble since, even
# though the user may be able to reenter a valid filename at the tex
# prompt (assuming they're attending the terminal), this script won't
# be able to find the right xref files and so forth.
- test -r "$command_line_filename" ||
- error 1 "cannot read $command_line_filename, skipping."
+ test -r "$command_line_filename" \
+ || error 1 "cannot read $command_line_filename, skipping."
# Get the name of the current directory.
in_dir=`func_dirname "$command_line_filename"`
--
1.7.2.5
* apps/mesh-segm-skel/io.hh,
* apps/mesh-segm-skel/mesh-max-curv.cc,
* apps/mesh-segm-skel/mesh-pinv-curv.cc,
* apps/mesh-segm-skel/mesh-segm.cc,
* apps/mesh-segm-skel/mesh-skel.cc,
* apps/mesh-segm-skel/test-mesh-max-curv.in,
* apps/mesh-segm-skel/test-mesh-segm.in:
Remove.
* apps/mesh-segm-skel/Makefile.am: Remove anything related to the
Trimesh library.
---
milena/ChangeLog | 15 ++
milena/apps/mesh-segm-skel/Makefile.am | 72 +------
milena/apps/mesh-segm-skel/io.hh | 205 -------------------
milena/apps/mesh-segm-skel/mesh-max-curv.cc | 125 ------------
milena/apps/mesh-segm-skel/mesh-pinv-curv.cc | 105 ----------
milena/apps/mesh-segm-skel/mesh-segm.cc | 230 ----------------------
milena/apps/mesh-segm-skel/mesh-skel.cc | 207 -------------------
milena/apps/mesh-segm-skel/test-mesh-max-curv.in | 23 ---
milena/apps/mesh-segm-skel/test-mesh-segm.in | 26 ---
9 files changed, 21 insertions(+), 987 deletions(-)
delete mode 100644 milena/apps/mesh-segm-skel/io.hh
delete mode 100644 milena/apps/mesh-segm-skel/mesh-max-curv.cc
delete mode 100644 milena/apps/mesh-segm-skel/mesh-pinv-curv.cc
delete mode 100644 milena/apps/mesh-segm-skel/mesh-segm.cc
delete mode 100644 milena/apps/mesh-segm-skel/mesh-skel.cc
delete mode 100644 milena/apps/mesh-segm-skel/test-mesh-max-curv.in
delete mode 100755 milena/apps/mesh-segm-skel/test-mesh-segm.in
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 83f5520..bb0f61c 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,18 @@
+2012-10-05 Roland Levillain <roland(a)lrde.epita.fr>
+
+ Remove anything depending on the Trimesh library.
+
+ * apps/mesh-segm-skel/io.hh,
+ * apps/mesh-segm-skel/mesh-max-curv.cc,
+ * apps/mesh-segm-skel/mesh-pinv-curv.cc,
+ * apps/mesh-segm-skel/mesh-segm.cc,
+ * apps/mesh-segm-skel/mesh-skel.cc,
+ * apps/mesh-segm-skel/test-mesh-max-curv.in,
+ * apps/mesh-segm-skel/test-mesh-segm.in:
+ Remove.
+ * apps/mesh-segm-skel/Makefile.am: Remove anything related to the
+ Trimesh library.
+
2012-06-15 Roland Levillain <roland(a)lrde.epita.fr>
Remove dependencies on suppressed files.
diff --git a/milena/apps/mesh-segm-skel/Makefile.am b/milena/apps/mesh-segm-skel/Makefile.am
index 9768f25..55ef805 100644
--- a/milena/apps/mesh-segm-skel/Makefile.am
+++ b/milena/apps/mesh-segm-skel/Makefile.am
@@ -1,4 +1,5 @@
-# Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE).
+# Copyright (C) 2008, 2009, 2012 EPITA Research and Development
+# Laboratory (LRDE).
#
# This file is part of Olena.
#
@@ -14,25 +15,11 @@
# You should have received a copy of the GNU General Public License
# along with Olena. If not, see <http://www.gnu.org/licenses/>.
-# Linking with gluit and GLUT/OpenGL.
-gluit_builddir = $(top_builddir)/external/trimesh/gluit
-include $(top_srcdir)/external/trimesh/gluit/gluit.mk
-
-# Find Milena and trimesh headers.
+# Find Milena headers.
AM_CPPFLAGS = -I$(top_srcdir)/milena
-CPPFLAGS_trimesh = -I$(top_srcdir)/external/trimesh/include
# Produce fast code.
APPS_CXXFLAGS = @APPS_CXXFLAGS@
AM_CXXFLAGS = $(APPS_CXXFLAGS)
-# Find the trimesh library and its dependencies.
-#
-# Don't use TRIMESH_LDFLAGS, since it looks like the LDFLAGS of the
-# program `TRIMESH' and triggers Automake warnings; use
-# LDFLAGS_trimesh instead. Likewise for CPPFLAGS_trimesh and
-# LDADD_trimesh, for symmetry reasons.
-LDFLAGS_trimesh = $(GLFLAGS)
-LDADD_trimesh = -L$(top_builddir)/external/trimesh/libsrc -ltrimesh $(GLLIBS)
-
bin_PROGRAMS =
TESTS =
@@ -41,56 +28,9 @@ MOSTLYCLEANFILES =
# FIXME: Have program names embed the type of structure used (either
# graph or complex).
-## FIXME: Likewise, programs' names should reflect a dependency on
-## Trimesh, if any.
-
-## ------------------------------------------------ ##
-## Graph-based applications, depending on Trimesh. ##
-## ------------------------------------------------ ##
-
-if ENABLE_TRIMESH
-# bin_PROGRAMS += mesh-segm mesh-skel
-#
-# mesh_segm_SOURCES = mesh-segm.cc io.hh
-# mesh_segm_CPPFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS_trimesh)
-# mesh_segm_LDFLAGS = $(LDFLAGS_trimesh)
-# mesh_segm_LDADD = $(LDADD_trimesh)
-#
-# TESTS += test-mesh-segm
-# MOSTLYCLEANFILES += socket-segm.off teapot-segm.off
-
-# FIXME: mesh_skel is unfinished. Anyway, it should be superseded by
-# another program, using no Trimesh code.
-
-# mesh_skel_SOURCES = mesh-skel.cc io.hh
-# mesh_skel_CPPFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS_trimesh)
-# mesh_skel_LDFLAGS = $(LDFLAGS_trimesh)
-# mesh_skel_LDADD = $(LDADD_trimesh)
-endif ENABLE_TRIMESH
-
-## -------------------------------------------------- ##
-## Complex-based applications, depending on Trimesh. ##
-## -------------------------------------------------- ##
-
-if ENABLE_TRIMESH
- bin_PROGRAMS += mesh-pinv-curv mesh-max-curv
-
- mesh_pinv_curv_SOURCES = mesh-pinv-curv.cc io.hh
- mesh_pinv_curv_CPPFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS_trimesh)
- mesh_pinv_curv_LDFLAGS = $(LDFLAGS_trimesh)
- mesh_pinv_curv_LDADD = $(LDADD_trimesh)
-
- mesh_max_curv_SOURCES = mesh-max-curv.cc io.hh
- mesh_max_curv_CPPFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS_trimesh)
- mesh_max_curv_LDFLAGS = $(LDFLAGS_trimesh)
- mesh_max_curv_LDADD = $(LDADD_trimesh)
- TESTS += test-mesh-max-curv
- MOSTLYCLEANFILES += teapot-max-curv-skel.off
-endif ENABLE_TRIMESH
-
-## ---------------------------------------------------- ##
-## Complex-based applications, independent of Trimesh. ##
-## ---------------------------------------------------- ##
+## ---------------------------- ##
+## Complex-based applications. ##
+## ---------------------------- ##
# A Milena re-implementation of some features from Trimesh. This code
# is completely independent from the Trimesh library.
diff --git a/milena/apps/mesh-segm-skel/io.hh b/milena/apps/mesh-segm-skel/io.hh
deleted file mode 100644
index 4d7516c..0000000
--- a/milena/apps/mesh-segm-skel/io.hh
+++ /dev/null
@@ -1,205 +0,0 @@
-// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
-//
-// This file is part of Olena.
-//
-// Olena is free software: you can redistribute it and/or modify it under
-// the terms of the GNU General Public License as published by the Free
-// Software Foundation, version 2 of the License.
-//
-// Olena is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Olena. If not, see <http://www.gnu.org/licenses/>.
-//
-// As a special exception, you may use this file as part of a free
-// software project without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to produce
-// an executable, this file does not by itself cause the resulting
-// executable to be covered by the GNU General Public License. This
-// exception does not however invalidate any other reasons why the
-// executable file might be covered by the GNU General Public License.
-
-#ifndef APPS_MESH_SEGM_SKEL_IO_HH
-# define APPS_MESH_SEGM_SKEL_IO_HH
-
-/// \file apps/mesh-segm-skel/io.hh
-/// \brief I/O routines adapted from TriMesh's ones.
-
-#include <cstdio>
-
-#include <algorithm>
-
-#include <TriMesh.h>
-
-#include <mln/value/rgb8.hh>
-
-
-/// Taken from TriMesh_io.cc
-/// \{
-// Convert colors float -> uchar
-inline unsigned char color2uchar(float p)
-{
- return min(max(int(255.0f * p + 0.5f), 0), 255);
-}
-
-// Write a bunch of vertices to an ASCII file
-inline void write_verts_asc(TriMesh *mesh, FILE *f,
- const char *before_vert,
- const char *before_norm,
- const char *before_color,
- bool float_color,
- const char *before_conf,
- const char *after_line)
-{
- for (unsigned i = 0; i < mesh->vertices.size(); i++) {
- fprintf(f, "%s%.7g %.7g %.7g", before_vert,
- mesh->vertices[i][0],
- mesh->vertices[i][1],
- mesh->vertices[i][2]);
- if (!mesh->normals.empty() && before_norm)
- fprintf(f, "%s%.7g %.7g %.7g", before_norm,
- mesh->normals[i][0],
- mesh->normals[i][1],
- mesh->normals[i][2]);
- if (!mesh->colors.empty() && before_color && float_color)
- fprintf(f, "%s%.7g %.7g %.7g", before_color,
- mesh->colors[i][0],
- mesh->colors[i][1],
- mesh->colors[i][2]);
- if (!mesh->colors.empty() && before_color && !float_color)
- fprintf(f, "%s%d %d %d", before_color,
- color2uchar(mesh->colors[i][0]),
- color2uchar(mesh->colors[i][1]),
- color2uchar(mesh->colors[i][2]));
- if (!mesh->confidences.empty() && before_conf)
- fprintf(f, "%s%.7g", before_conf, mesh->confidences[i]);
- fprintf(f, "%s\n", after_line);
- }
-}
-/// \}
-
-
-/// Taken and adapted from TriMesh_io.cc
-/// \{
-
-/*----------------------.
-| OFF with color data. |
-`----------------------*/
-
-/// Write a bunch of faces to an ASCII file with colors.
-inline void write_faces_asc_colored(TriMesh *mesh,
- const std::vector<mln::value::rgb8>& colors,
- FILE *f,
- const char *before_face,
- const char *after_line)
-{
- mesh->need_faces();
- for (unsigned i = 0; i < mesh->faces.size(); i++)
- {
- fprintf(f, "%s%d %d %d %d %d %d%s\n",
- before_face,
- mesh->faces[i][0], mesh->faces[i][1], mesh->faces[i][2],
- int(colors[i].red()),
- int(colors[i].green()),
- int(colors[i].blue()),
- after_line);
- }
-}
-
-/// Write an off file with colors.
-inline void write_off_colored(TriMesh *mesh,
- const std::vector<mln::value::rgb8>& colors,
- FILE *f)
-{
- fprintf(f, "OFF\n");
- mesh->need_faces();
- fprintf(f, "%lu %lu 0\n", (unsigned long) mesh->vertices.size(),
- (unsigned long) mesh->faces.size());
- write_verts_asc(mesh, f, "", 0, 0, false, 0, "");
- write_faces_asc_colored(mesh, colors, f, "3 ", "");
-}
-
-/*----------------------.
-| OFF with float data. |
-`----------------------*/
-
-/// Write a bunch of faces to an ASCII file with colors.
-inline void write_faces_asc_float(TriMesh *mesh,
- const std::vector<float>& values,
- FILE *f,
- const char *before_face,
- const char *after_line)
-{
- mesh->need_faces();
- for (unsigned i = 0; i < mesh->faces.size(); i++)
- {
- // Vertices Color
- // -------- ------------
- // V0 V1 V2 R G B A
- fprintf(f, "%s%d %d %d %f %f %f 1.0%s\n",
- before_face,
- mesh->faces[i][0], mesh->faces[i][1], mesh->faces[i][2],
- values[i], values[i], values[i],
- after_line);
- }
-}
-
-/// Write an off file with floating-point values.
-inline void write_off_float(TriMesh *mesh, const std::vector<float>& values,
- FILE *f)
-{
- fprintf(f, "OFF\n");
- mesh->need_faces();
- fprintf(f, "%lu %lu 0\n", (unsigned long) mesh->vertices.size(),
- (unsigned long) mesh->faces.size());
- write_verts_asc(mesh, f, "", 0, 0, false, 0, "");
- write_faces_asc_float(mesh, values, f, "3 ", "");
-}
-/// \}
-
-
-/*---------------------------------------.
-| OFF without data (``binary values''). |
-`---------------------------------------*/
-
-/// Taken and adapted from TriMesh_io.cc
-/// \{
-/// Write a bunch of faces to an ASCII file, removing the ones tagged
-/// as ``false'' in \a face_value.
-inline void write_faces_asc_binary(TriMesh *mesh,
- const std::vector<bool>& face_value,
- FILE *f,
- const char *before_face,
- const char *after_line)
-{
- mesh->need_faces();
- for (unsigned i = 0; i < mesh->faces.size(); i++)
- if (face_value[i])
- {
- fprintf(f, "%s%d %d %d%s\n",
- before_face,
- mesh->faces[i][0], mesh->faces[i][1], mesh->faces[i][2],
- after_line);
- }
-}
-
-/// Write an off file, removing faces tagged as ``false'' in \a face_value.
-inline void write_off_binary(TriMesh *mesh,
- const std::vector<bool>& face_value,
- FILE *f)
-{
- fprintf(f, "OFF\n");
- mesh->need_faces();
- unsigned long nfaces =
- std::count(face_value.begin(), face_value.end(), true);
- fprintf(f, "%lu %lu 0\n", (unsigned long) mesh->vertices.size(), nfaces);
- write_verts_asc(mesh, f, "", 0, 0, false, 0, "");
- write_faces_asc_binary(mesh, face_value, f, "3 ", "");
-}
-/// \}
-
-#endif // ! APPS_MESH_SEGM_SKEL_IO_HH
diff --git a/milena/apps/mesh-segm-skel/mesh-max-curv.cc b/milena/apps/mesh-segm-skel/mesh-max-curv.cc
deleted file mode 100644
index 8376fc0..0000000
--- a/milena/apps/mesh-segm-skel/mesh-max-curv.cc
+++ /dev/null
@@ -1,125 +0,0 @@
-// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
-//
-// This file is part of Olena.
-//
-// Olena is free software: you can redistribute it and/or modify it under
-// the terms of the GNU General Public License as published by the Free
-// Software Foundation, version 2 of the License.
-//
-// Olena is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Olena. If not, see <http://www.gnu.org/licenses/>.
-//
-// As a special exception, you may use this file as part of a free
-// software project without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to produce
-// an executable, this file does not by itself cause the resulting
-// executable to be covered by the GNU General Public License. This
-// exception does not however invalidate any other reasons why the
-// executable file might be covered by the GNU General Public License.
-
-/// \file apps/mesh-segm-skel/mesh-max-curv.cc
-/// \brief A program computing the max curvature at each (2-)face of
-/// a mesh.
-
-#include <cstdlib>
-
-#include <algorithm>
-#include <vector>
-#include <iostream>
-#include <utility>
-
-#include <TriMesh.h>
-
-#include <mln/math/max.hh>
-#include <mln/math/sqr.hh>
-#include <mln/accu/stat/min_max.hh>
-#include <mln/fun/v2v/linear.hh>
-
-#include "io.hh"
-
-
-int main(int argc, char* argv[])
-{
- if (argc != 3)
- {
- std::cerr << "usage: " << argv[0] << " input.off output.off"
- << std::endl;
- std::exit(1);
- }
-
- std::string input_filename = argv[1];
- std::string output_filename = argv[2];
-
-
- // TriMesh is a pain: it systematically allocates on the heap.
- // Introduce another name to manipulate the mesh as a (non-pointer)
- // object.
- TriMesh* mesh_ptr = TriMesh::read(input_filename.c_str());
- if (!mesh_ptr)
- 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.
- vertex_m[v] = mln::math::max(mln::math::sqr(mesh.curv1[v]),
- mln::math::sqr(mesh.curv2[v]));
-
- // 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(), 0.f);
- mln::accu::stat::min_max<float> acc;
- for (unsigned f = 0; f < mesh.faces.size(); ++f)
- {
- float m = (vertex_m[mesh.faces[f][0]] +
- vertex_m[mesh.faces[f][1]] +
- vertex_m[mesh.faces[f][2]]) / 3;
- face_m[f] = m;
- acc.take(m);
- }
-
- /* Shrink the values of FACE_M into the range 0..1, as these are
- the only values accepted a an RGB floating-point component in the
- OFF file format. */
- std::vector<float> normalized_face_m(face_m.size(), 0.0f);
- std::pair<float, float> min_max(acc);
- // FIXME: Taken from mln/data/stretch.hh (this should be factored).
- float min = min_max.first;
- float max = min_max.second;
- // Don't normalize actually if the curvature is constant (i.e.,
- // if min == max).
- if (min != max)
- {
- float m = 0.0f;
- float M = 1.0f;
- float a = (M - m) / (max - min);
- float b = (m * max - M * min) / (max - min);
- mln::fun::v2v::linear<float, float, float> f(a, b);
- std::transform(face_m.begin(), face_m.end(),
- normalized_face_m.begin(), f);
- }
-
- // Taken and adapted from TriMesh_io.cc
- FILE* f_out = fopen(output_filename.c_str(), "wb");
- if (!f_out)
- {
- std::cerr << "Error opening " << output_filename.c_str()
- << " for writing." << std::endl;
- std::exit(2);
- }
- write_off_float(mesh_ptr, normalized_face_m, f_out);
- fclose(f_out);
-
- delete mesh_ptr;
-}
diff --git a/milena/apps/mesh-segm-skel/mesh-pinv-curv.cc b/milena/apps/mesh-segm-skel/mesh-pinv-curv.cc
deleted file mode 100644
index af51c97..0000000
--- a/milena/apps/mesh-segm-skel/mesh-pinv-curv.cc
+++ /dev/null
@@ -1,105 +0,0 @@
-// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
-//
-// This file is part of Olena.
-//
-// Olena is free software: you can redistribute it and/or modify it under
-// the terms of the GNU General Public License as published by the Free
-// Software Foundation, version 2 of the License.
-//
-// Olena is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Olena. If not, see <http://www.gnu.org/licenses/>.
-//
-// As a special exception, you may use this file as part of a free
-// software project without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to produce
-// an executable, this file does not by itself cause the resulting
-// executable to be covered by the GNU General Public License. This
-// exception does not however invalidate any other reasons why the
-// executable file might be covered by the GNU General Public License.
-
-/// \file apps/mesh-segm-skel/mesh-pinv-curv.cc
-/// \brief A program computing the pseudo-inverse curvature at each
-/// (2-)face of a mesh.
-
-#include <cstdlib>
-#include <cmath>
-
-#include <algorithm>
-#include <vector>
-#include <iostream>
-#include <utility>
-
-#include <TriMesh.h>
-
-#include "io.hh"
-
-
-// Doesn't C++ have a better way to express Pi?
-static 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;
- std::exit(1);
- }
-
- std::string input_filename = argv[1];
- std::string output_filename = argv[2];
-
-
- // TriMesh is a pain: it systematically allocates on the heap.
- // Introduce another name to manipulate the mesh as a (non-pointer)
- // object.
- TriMesh* mesh_ptr = TriMesh::read(input_filename.c_str());
- if (!mesh_ptr)
- 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_h_inv(mesh.vertices.size(), 0.f);
- for (unsigned v = 0; v < mesh.vertices.size(); ++v)
- {
- float h = (mesh.curv1[v] + mesh.curv2[v]) / 2;
- // Pseudo-inverse curvature.
- float h_inv = 1 / pi * (atan(-h) + pi / 2);
- vertex_h_inv[v] = h_inv;
- }
- // For each face of the mesh, computean an average curvature value
- // from the mean curvature at its vertices.
- std::vector<float> face_h_inv(mesh.faces.size(), 42.f);
- for (unsigned f = 0; f < mesh.faces.size(); ++f)
- {
- float h_inv = (vertex_h_inv[mesh.faces[f][0]] +
- vertex_h_inv[mesh.faces[f][1]] +
- vertex_h_inv[mesh.faces[f][2]]) / 3;
- mln_invariant(0.f <= h_inv);
- mln_invariant(h_inv <= 1.f);
- face_h_inv[f] = h_inv;
- }
-
- // Taken and adapted from TriMesh_io.cc
- FILE* f_out = fopen(output_filename.c_str(), "wb");
- if (!f_out)
- {
- std::cerr << "Error opening " << output_filename.c_str()
- << " for writing." << std::endl;
- std::exit(2);
- }
- write_off_float(mesh_ptr, face_h_inv, f_out);
- fclose(f_out);
-
- delete mesh_ptr;
-}
diff --git a/milena/apps/mesh-segm-skel/mesh-segm.cc b/milena/apps/mesh-segm-skel/mesh-segm.cc
deleted file mode 100644
index 63e707d..0000000
--- a/milena/apps/mesh-segm-skel/mesh-segm.cc
+++ /dev/null
@@ -1,230 +0,0 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
-//
-// This file is part of Olena.
-//
-// Olena is free software: you can redistribute it and/or modify it under
-// the terms of the GNU General Public License as published by the Free
-// Software Foundation, version 2 of the License.
-//
-// Olena is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Olena. If not, see <http://www.gnu.org/licenses/>.
-//
-// As a special exception, you may use this file as part of a free
-// software project without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to produce
-// an executable, this file does not by itself cause the resulting
-// executable to be covered by the GNU General Public License. This
-// exception does not however invalidate any other reasons why the
-// executable file might be covered by the GNU General Public License.
-
-/// \file apps/mesh-segm-skel/mesh-segm.cc
-/// \brief A program performing a WST-based segmentation of the
-/// surface of the (triangle) mesh of a statue.
-
-// FIXME: Factor commons parts between mesh-segm and mesh-skel.
-
-#include <cstdlib>
-#include <cmath>
-
-#include <utility>
-#include <iostream>
-
-#include <TriMesh.h>
-
-#include <mln/core/alias/point3d.hh>
-#include <mln/core/alias/point3d.hh>
-
-#include <mln/util/graph.hh>
-#include <mln/core/image/line_graph_image.hh>
-#include <mln/core/image/line_graph_elt_neighborhood.hh>
-
-#include <mln/morpho/closing/area.hh>
-#include <mln/morpho/meyer_wst.hh>
-
-#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 != 4)
- {
- std::cerr << "usage: " << argv[0] << " input.off lambda output.off"
- << std::endl;
- std::exit(1);
- }
-
- std::string input_filename = argv[1];
- unsigned lambda = atoi(argv[2]);
- std::string output_filename = argv[3];
-
-
- /*-------.
- | Mesh. |
- `-------*/
-
- // TriMesh is a pain: it systematically allocates on the heap.
- // Introduce another name to manipulate the mesh as a (non-pointer)
- // object.
- TriMesh* mesh_ptr = TriMesh::read(input_filename.c_str());
- if (!mesh_ptr)
- std::exit(2);
- TriMesh& mesh = *mesh_ptr;
-
- // Computes faces (triangles).
- mesh.need_faces();
- // Computation of the mean curvature on each vertex of the mesh.
- mesh.need_curvatures();
- /* FIXME: Our implementation of the WST doesn't work well with
- floats (yet). Convert floating point values to a proportional
- integer value for the moment. */
- typedef int curv_t;
- std::vector<curv_t> vertex_h_inv(mesh.vertices.size(), 0.f);
- for (unsigned v = 0; v < mesh.vertices.size(); ++v)
- {
- float h = (mesh.curv1[v] + mesh.curv2[v]) / 2;
- float h_inv = 1 / pi * atan(-h) + pi / 2;
- /* FIXME: This coefficient is used to distinguish small
- curvature values. We should get rid of it as soon as
- morpho::meyer_wst works correctly on images of float
- values. */
- vertex_h_inv[v] = 1000 * h_inv;
- }
-
- /*--------.
- | Graph. |
- `--------*/
-
- /* Build a graph whose vertices correspond to the faces of the mesh,
- whose edges (between two vertices) correspond to edges (between
- two faces) of the mesh. */
-
- // Values associated to the graph sites.
- // (Reminder: currently, values associated to vertices in a
- // line_graph_image are dummy.)
- std::vector<curv_t> vertex_values (mesh.faces.size(), 0.f);
- std::vector<curv_t> edge_values;
-
- /* FIXME: We don't have the required site type yet. Simulate with a
- dummy type (point3d). */
- mln::util::graph<mln::point3d> g;
- // Populate the graph with vertices.
- for (unsigned i = 0; i < mesh.faces.size(); ++i)
- g.add_vertex (mln::point3d(i, i, i));
-
- // Populate the graph with edges.
- mesh.need_across_edge();
- for (unsigned f = 0; f < mesh.faces.size(); ++f)
- for (unsigned e = 0; e < 3; ++e)
- {
- int f_adj = mesh.across_edge[f][e];
- if (f_adj != -1)
- {
- // Add an edge into the graph.
- if (g.add_edge(f, f_adj) != mln_max(mln::util::edge_id::equiv))
- {
- // Find the edge (i.e., the two vertices) common to faces
- // F and F_ADJ.
- /* FIXME: We lack a proper interface from the TriMesh
- structure to do this elegantly. */
- std::vector<int> adj_vertices;
- adj_vertices.reserve(2);
- for (unsigned i = 0; i < 3; ++i)
- for (unsigned j = 0; j < 3; ++j)
- if (mesh.faces[f][i] == mesh.faces[f_adj][j])
- adj_vertices.push_back(mesh.faces[f][i]);
- mln_assertion(adj_vertices.size() == 2);
-
- // Compute the mean curvature on the edge.
- edge_values.push_back((vertex_h_inv[adj_vertices[0]] +
- vertex_h_inv[adj_vertices[1]])
- / 2);
- }
-
- // Check the consistency of the two arrays.
- mln_assertion(g.edges().size() == edge_values.size());
- }
- }
-
- /*-------------------.
- | Line graph image. |
- `-------------------*/
-
- mln::p_line_graph<mln::point3d> plg(g);
-
- typedef mln::line_graph_image<mln::point3d, curv_t> ima_t;
- ima_t lg_ima(plg, vertex_values, edge_values);
-
- /*-----------------.
- | Simplification. |
- `-----------------*/
-
- typedef mln::line_graph_elt_neighborhood<mln::point3d> nbh_t;
- nbh_t nbh;
-
- ima_t closed_lg_ima = mln::morpho::closing::area(lg_ima, nbh, lambda);
-
- /*------.
- | WST. |
- `------*/
-
- typedef unsigned wst_val_t;
- wst_val_t nbasins;
- typedef mln::line_graph_image<mln::point3d, wst_val_t> wst_ima_t;
- wst_ima_t wshed = mln::morpho::meyer_wst(closed_lg_ima, nbh, nbasins);
- std::cout << "nbasins = " << nbasins << std::endl;
-
- /*------------------------------------------.
- | Label graph vertices (i.e., mesh faces). |
- `------------------------------------------*/
-
- /* FIXME: We should be using wshed.vertex_values_ if
- mln::line_graph_image were fully functional... */
- std::vector<unsigned> vertex_label(wshed.domain().nvertices(), 0);
- mln_piter_(wst_ima_t) pw(wshed.domain());
- for_all(pw)
- if (wshed(pw) != 0)
- {
- mln_psite_(wst_ima_t) pp(pw);
- vertex_label[pp.first_id().to_equiv()] = wshed(pw);
- vertex_label[pp.second_id().to_equiv()] = wshed(pw);
- }
-
- /*---------.
- | Output. |
- `---------*/
-
- // Choose random colors for each basin number.
- std::vector<mln::value::rgb8> basin_color (nbasins + 1);
- for (unsigned i = 0; i <= nbasins; ++i)
- basin_color[i] = mln::value::rgb8(random() % 256,
- random() % 256,
- random() % 256);
-
- // Assign colors to graph vertices (mesh faces).
- std::vector<mln::value::rgb8> face_color (vertex_label.size());
- for (unsigned i = 0; i < vertex_label.size() ; ++i)
- face_color[i] = basin_color[vertex_label[i]];
-
- // Taken and adapted from TriMesh_io.cc
- FILE* f_out = fopen(output_filename.c_str(), "wb");
- if (!f_out)
- {
- std::cerr << "Error opening " << output_filename.c_str()
- << " for writing." << std::endl;
- std::exit(2);
- }
- write_off_colored(mesh_ptr, face_color, f_out);
- fclose(f_out);
-
- delete mesh_ptr;
-}
diff --git a/milena/apps/mesh-segm-skel/mesh-skel.cc b/milena/apps/mesh-segm-skel/mesh-skel.cc
deleted file mode 100644
index e68620d..0000000
--- a/milena/apps/mesh-segm-skel/mesh-skel.cc
+++ /dev/null
@@ -1,207 +0,0 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
-//
-// This file is part of Olena.
-//
-// Olena is free software: you can redistribute it and/or modify it under
-// the terms of the GNU General Public License as published by the Free
-// Software Foundation, version 2 of the License.
-//
-// Olena is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Olena. If not, see <http://www.gnu.org/licenses/>.
-//
-// As a special exception, you may use this file as part of a free
-// software project without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to produce
-// an executable, this file does not by itself cause the resulting
-// executable to be covered by the GNU General Public License. This
-// exception does not however invalidate any other reasons why the
-// executable file might be covered by the GNU General Public License.
-
-/// \file apps/mesh-segm-skel/mesh-skel.cc
-/// \brief A program computing a skeleton of the surface of the
-/// (triangle) mesh of a statue.
-
-// FIXME: Factor commons parts between mesh-segm and mesh-skel.
-
-#include <cstdlib>
-#include <cmath>
-
-#include <utility>
-#include <iostream>
-
-#include <TriMesh.h>
-
-#include <mln/core/alias/point3d.hh>
-#include <mln/core/alias/point3d.hh>
-
-#include <mln/util/graph.hh>
-#include <mln/core/image/graph_image.hh>
-#include <mln/core/image/graph_elt_neighborhood.hh>
-
-#include <mln/morpho/closing/area.hh>
-#include <mln/labeling/regional_minima.hh>
-
-#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 != 4)
- {
- std::cerr << "usage: " << argv[0] << " input.off lambda output.off"
- << std::endl;
- std::exit(1);
- }
-
- std::string input_filename = argv[1];
- unsigned lambda = atoi(argv[2]);
- std::string output_filename = argv[3];
-
-
- /*-------.
- | Mesh. |
- `-------*/
-
- // TriMesh is a pain: it systematically allocates on the heap.
- // Introduce another name to manipulate the mesh as a (non-pointer)
- // object.
- TriMesh* mesh_ptr = TriMesh::read(input_filename.c_str());
- if (!mesh_ptr)
- std::exit(2);
- TriMesh& mesh = *mesh_ptr;
-
- // Computes faces (triangles).
- mesh.need_faces();
- // Computation of the mean curvature on each vertex of the mesh.
- mesh.need_curvatures();
- std::vector<float> vertex_h_inv(mesh.faces.size(), 0.f);
- for (unsigned v = 0; v < mesh.vertices.size(); ++v)
- {
- float h = (mesh.curv1[v] + mesh.curv2[v]) / 2;
- float h_inv = 1 / pi * atan(-h) + pi / 2;
- vertex_h_inv[v] = h_inv;
- }
- // Computation of the mean curvature on each face of the mesh.
- /* FIXME: Our implementation of the computation of the regional
- minima doesn't work well with floats (yet). Convert floating
- point values to a proportional integer value for the moment. */
- typedef int curv_t;
- std::vector<curv_t> face_h_inv(mesh.faces.size(), 0.f);
- for (unsigned f = 0; f < mesh.faces.size(); ++f)
- {
- float h_inv =
- (vertex_h_inv[mesh.faces[f][0]] +
- vertex_h_inv[mesh.faces[f][1]] +
- vertex_h_inv[mesh.faces[f][2]])
- / 3;
- /* FIXME: This coefficient is used to distinguish small
- curvature values. We should get rid of it as soon as
- labeling::regional_minima works correctly on images of float
- values. */
- face_h_inv[f] = 1000 * h_inv;
- }
-
- /*--------.
- | Graph. |
- `--------*/
-
- /* Build a graph whose vertices correspond to the faces of the mesh,
- whose edges (between two vertices) correspond to edges (between
- two faces) of the mesh. */
-
- /* FIXME: We don't have the required site type yet. Simulate with a
- dummy type (point3d). */
- mln::util::graph<mln::point3d> g;
- // Populate the graph with vertices.
- for (unsigned i = 0; i < mesh.faces.size(); ++i)
- g.add_vertex (mln::point3d(i, i, i));
-
- // Populate the graph with edges.
- mesh.need_across_edge();
- for (unsigned f = 0; f < mesh.faces.size(); ++f)
- for (unsigned e = 0; e < 3; ++e)
- {
- int f_adj = mesh.across_edge[f][e];
- if (f_adj != -1)
- // Add an edge into the graph.
- g.add_edge(f, f_adj);
- }
-
- /*--------------.
- | Graph image. |
- `--------------*/
-
- mln::p_graph<mln::point3d> pg(g);
-
- typedef mln::graph_image<mln::point3d, curv_t> ima_t;
- ima_t g_ima(pg, face_h_inv);
-
- /*-----------------.
- | Simplification. |
- `-----------------*/
-
- typedef mln::graph_elt_neighborhood<mln::point3d> nbh_t;
- nbh_t nbh;
-
- ima_t closed_g_ima = mln::morpho::closing::area(g_ima, nbh, lambda);
-
- /*------------------.
- | Regional minima. |
- `------------------*/
-
- typedef unsigned label_t;
- label_t nlabels;
- typedef mln::graph_image<mln::point3d, label_t> label_ima_t;
- label_ima_t minima =
- mln::labeling::regional_minima(closed_g_ima, nbh, nlabels);
- std::cout << "nlabels = " << nlabels << std::endl;
-
- /*-----------.
- | Skeleton. |
- `-----------*/
-
- // FIXME: To do.
-
- /*---------.
- | Output. |
- `---------*/
-
- /* FIXME We should created a boolean graph_image instead. But as
- we cannot directly save a graph_image as an OFF file now, just
- store the values of this would-be image into an array. */
- // Assign a boolean value to graph vertices (mesh faces).
- std::vector<bool> face_value (minima.domain().nvertices(), true);
- mln_piter_(label_ima_t) pm(minima.domain());
- for_all(pm)
- // FIXME: Use literal::zero.
- if (minima(pm) != 0)
- {
- // The face belongs to a regional minima: ``remove'' it from
- // the mesh by tagging it as false.
- mln_psite_(label_ima_t) pp(pm);
- face_value[pp.id().to_equiv()] = false;
- }
-
- // Taken and adapted from TriMesh_io.cc
- FILE* f_out = fopen(output_filename.c_str(), "wb");
- if (!f_out)
- {
- std::cerr << "Error opening " << output_filename.c_str()
- << " for writing." << std::endl;
- std::exit(2);
- }
- write_off_binary(mesh_ptr, face_value, f_out);
- fclose(f_out);
-
- delete mesh_ptr;
-}
diff --git a/milena/apps/mesh-segm-skel/test-mesh-max-curv.in b/milena/apps/mesh-segm-skel/test-mesh-max-curv.in
deleted file mode 100644
index e5eaf96..0000000
--- a/milena/apps/mesh-segm-skel/test-mesh-max-curv.in
+++ /dev/null
@@ -1,23 +0,0 @@
-#! /bin/sh
-
-# Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE).
-#
-# This file is part of Olena.
-#
-# Olena is free software: you can redistribute it and/or modify it under
-# the terms of the GNU General Public License as published by the Free
-# Software Foundation, version 2 of the License.
-#
-# Olena is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Olena. If not, see <http://www.gnu.org/licenses/>.
-
-set -ex
-
-mesh_dir=@top_srcdir@/milena/mesh
-
-time ./mesh-max-curv $mesh_dir/teapot.off teapot-max-curv.off
diff --git a/milena/apps/mesh-segm-skel/test-mesh-segm.in b/milena/apps/mesh-segm-skel/test-mesh-segm.in
deleted file mode 100755
index e70e63a..0000000
--- a/milena/apps/mesh-segm-skel/test-mesh-segm.in
+++ /dev/null
@@ -1,26 +0,0 @@
-#! /bin/sh
-
-# Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE).
-#
-# This file is part of Olena.
-#
-# Olena is free software: you can redistribute it and/or modify it under
-# the terms of the GNU General Public License as published by the Free
-# Software Foundation, version 2 of the License.
-#
-# Olena is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Olena. If not, see <http://www.gnu.org/licenses/>.
-
-set -ex
-
-mesh_dir=@top_srcdir@/milena/mesh
-
-time ./mesh-segm $mesh_dir/socket.off 25 socket-segm.off
-time ./mesh-segm $mesh_dir/teapot.off 50 teapot-segm.off
-# FIXME: Too long. Should be run with (future) target `check-full'.
-#time ./mesh-segm $mesh_dir/bunny-holefilled.off 500 bunny-holefilled-segm.off
--
1.7.2.5
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Olena, a generic and efficient image processing platform".
The branch exp/khalimsky has been updated
via cbf3fe229ced061e0a6b9aa590593c91fced0d10 (commit)
via be35e3941a0a8bb5ec44a7be4e55a0142c734430 (commit)
from 1cde74522f42b4cfdd260df9e3d2f46c50510eb1 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
cbf3fe2 Improve accu::median_interval.
be35e39 mln/value/intsub.hh: Add more constructors.
-----------------------------------------------------------------------
Summary of changes:
milena/ChangeLog | 12 ++
milena/mln/accu/stat/median_interval.hh | 162 ++++++++++++++++-------
milena/mln/value/intsub.hh | 32 +++++-
milena/tests/accu/stat/median_interval.cc | 210 +++++++++++++++++++++++++++-
4 files changed, 361 insertions(+), 55 deletions(-)
hooks/post-receive
--
Olena, a generic and efficient image processing platform