Commit beed0290 authored by pitiot's avatar pitiot

up

parent 8a731776
No preview for this file type
No preview for this file type
......@@ -38,9 +38,8 @@ CHOLMOD_INCLUDE_DIR:PATH=/usr/include/suitesparse
//Path to a program.
CMAKE_AR:FILEPATH=/usr/bin/ar
//Choose the type of build, options are: None(CMAKE_CXX_FLAGS or
// CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.
CMAKE_BUILD_TYPE:STRING=
//options are: Debug Release RelWithDebInfo MinSizeRel.
CMAKE_BUILD_TYPE:STRING=Release
//Enable/Disable color output during build.
CMAKE_COLOR_MAKEFILE:BOOL=ON
......
......@@ -16,7 +16,6 @@ SET(CMAKE_TARGET_DEFINITIONS
"CGOGN_ASSERT_BOOL=false"
"QT_CORE_LIB"
"QT_GUI_LIB"
"QT_NO_DEBUG"
"QT_OPENGL_LIB"
"QT_SVG_LIB"
"QT_XML_LIB"
......
......@@ -161,34 +161,34 @@ VolusionD_OBJECTS = \
# External object files for target VolusionD
VolusionD_EXTERNAL_OBJECTS =
../bin/VolusionD: Debug/CMakeFiles/VolusionD.dir/__/src/viewer.cpp.o
../bin/VolusionD: Debug/CMakeFiles/VolusionD.dir/__/src/env_map.cpp.o
../bin/VolusionD: Debug/CMakeFiles/VolusionD.dir/__/src/simulator.cpp.o
../bin/VolusionD: Debug/CMakeFiles/VolusionD.dir/__/include/moc_viewer.cxx.o
../bin/VolusionD: Debug/CMakeFiles/VolusionD.dir/build.make
../bin/VolusionD: /usr/lib/x86_64-linux-gnu/libGLU.so
../bin/VolusionD: /usr/lib/x86_64-linux-gnu/libGL.so
../bin/VolusionD: /usr/lib/x86_64-linux-gnu/libSM.so
../bin/VolusionD: /usr/lib/x86_64-linux-gnu/libICE.so
../bin/VolusionD: /usr/lib/x86_64-linux-gnu/libX11.so
../bin/VolusionD: /usr/lib/x86_64-linux-gnu/libXext.so
../bin/VolusionD: /usr/lib/x86_64-linux-gnu/libGLEW.so
../bin/VolusionD: /usr/lib/x86_64-linux-gnu/libz.so
../bin/VolusionD: /usr/lib/x86_64-linux-gnu/libxml2.so
../bin/VolusionD: /usr/lib/x86_64-linux-gnu/libboost_regex.so
../bin/VolusionD: /usr/lib/x86_64-linux-gnu/libQtOpenGL.so
../bin/VolusionD: /usr/lib/x86_64-linux-gnu/libQtSvg.so
../bin/VolusionD: /usr/lib/x86_64-linux-gnu/libQtGui.so
../bin/VolusionD: /usr/lib/x86_64-linux-gnu/libQtXml.so
../bin/VolusionD: /usr/lib/x86_64-linux-gnu/libQtCore.so
../bin/VolusionD: /usr/lib/x86_64-linux-gnu/libQGLViewer.so
../bin/VolusionD: /usr/lib/x86_64-linux-gnu/libQGLViewer.so
../bin/VolusionD: Debug/CMakeFiles/VolusionD.dir/link.txt
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --red --bold "Linking CXX executable ../../bin/VolusionD"
../bin/Release/VolusionD: Debug/CMakeFiles/VolusionD.dir/__/src/viewer.cpp.o
../bin/Release/VolusionD: Debug/CMakeFiles/VolusionD.dir/__/src/env_map.cpp.o
../bin/Release/VolusionD: Debug/CMakeFiles/VolusionD.dir/__/src/simulator.cpp.o
../bin/Release/VolusionD: Debug/CMakeFiles/VolusionD.dir/__/include/moc_viewer.cxx.o
../bin/Release/VolusionD: Debug/CMakeFiles/VolusionD.dir/build.make
../bin/Release/VolusionD: /usr/lib/x86_64-linux-gnu/libGLU.so
../bin/Release/VolusionD: /usr/lib/x86_64-linux-gnu/libGL.so
../bin/Release/VolusionD: /usr/lib/x86_64-linux-gnu/libSM.so
../bin/Release/VolusionD: /usr/lib/x86_64-linux-gnu/libICE.so
../bin/Release/VolusionD: /usr/lib/x86_64-linux-gnu/libX11.so
../bin/Release/VolusionD: /usr/lib/x86_64-linux-gnu/libXext.so
../bin/Release/VolusionD: /usr/lib/x86_64-linux-gnu/libGLEW.so
../bin/Release/VolusionD: /usr/lib/x86_64-linux-gnu/libz.so
../bin/Release/VolusionD: /usr/lib/x86_64-linux-gnu/libxml2.so
../bin/Release/VolusionD: /usr/lib/x86_64-linux-gnu/libboost_regex.so
../bin/Release/VolusionD: /usr/lib/x86_64-linux-gnu/libQtOpenGL.so
../bin/Release/VolusionD: /usr/lib/x86_64-linux-gnu/libQtSvg.so
../bin/Release/VolusionD: /usr/lib/x86_64-linux-gnu/libQtGui.so
../bin/Release/VolusionD: /usr/lib/x86_64-linux-gnu/libQtXml.so
../bin/Release/VolusionD: /usr/lib/x86_64-linux-gnu/libQtCore.so
../bin/Release/VolusionD: /usr/lib/x86_64-linux-gnu/libQGLViewer.so
../bin/Release/VolusionD: /usr/lib/x86_64-linux-gnu/libQGLViewer.so
../bin/Release/VolusionD: Debug/CMakeFiles/VolusionD.dir/link.txt
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --red --bold "Linking CXX executable ../../bin/Release/VolusionD"
cd /home/pitiot/CGoGN_Apps/Volusion/build/Debug && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/VolusionD.dir/link.txt --verbose=$(VERBOSE)
# Rule to build all files generated by this target.
Debug/CMakeFiles/VolusionD.dir/build: ../bin/VolusionD
Debug/CMakeFiles/VolusionD.dir/build: ../bin/Release/VolusionD
.PHONY : Debug/CMakeFiles/VolusionD.dir/build
Debug/CMakeFiles/VolusionD.dir/requires: Debug/CMakeFiles/VolusionD.dir/__/src/viewer.cpp.o.requires
......
......@@ -5,8 +5,8 @@ FILE(REMOVE_RECURSE
"CMakeFiles/VolusionD.dir/__/src/env_map.cpp.o"
"CMakeFiles/VolusionD.dir/__/src/simulator.cpp.o"
"CMakeFiles/VolusionD.dir/__/include/moc_viewer.cxx.o"
"../../bin/VolusionD.pdb"
"../../bin/VolusionD"
"../../bin/Release/VolusionD.pdb"
"../../bin/Release/VolusionD"
)
# Per-language clean rules from dependency scanning.
......
......@@ -4,5 +4,5 @@
# compile CXX with /usr/bin/c++
CXX_FLAGS = -g -DQGLVIEWER_FOUND -Wall -Wextra -fPIC -std=c++11 -Wno-unused-local-typedefs -g -isystem /usr/include/qt4 -isystem /usr/include/qt4/QtOpenGL -isystem /usr/include/qt4/QtSvg -isystem /usr/include/qt4/QtGui -isystem /usr/include/qt4/QtXml -isystem /usr/include/qt4/QtCore -I/home/pitiot/CGoGN_Apps/Volusion/build/Debug -I/home/pitiot/CGoGN_Apps/Volusion/Debug/Debug -I/home/pitiot/CGoGN_Apps/Volusion/Debug/../include -I/home/pitiot/CGoGN_Apps/Volusion/../../CGoGN/include -I/home/pitiot/CGoGN_Apps/Volusion/../../CGoGN/ThirdParty/include -I/usr/include/libxml2 -I/usr/include/suitesparse
CXX_DEFINES = -DCGOGN_ASSERT_BOOL=false -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_SVG_LIB -DQT_XML_LIB -DSHADERPATH=\"/home/pitiot/CGoGN_Apps/Volusion/../../CGoGN/lib/Shaders/\" -DWITH_ASSIMP -DWITH_QT -DWITH_ZINRI
CXX_DEFINES = -DCGOGN_ASSERT_BOOL=false -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_SVG_LIB -DQT_XML_LIB -DSHADERPATH=\"/home/pitiot/CGoGN_Apps/Volusion/../../CGoGN/lib/Shaders/\" -DWITH_ASSIMP -DWITH_QT -DWITH_ZINRI
/usr/bin/c++ -g -DQGLVIEWER_FOUND -Wall -Wextra -fPIC -std=c++11 -Wno-unused-local-typedefs -g -pg CMakeFiles/VolusionD.dir/__/src/viewer.cpp.o CMakeFiles/VolusionD.dir/__/src/env_map.cpp.o CMakeFiles/VolusionD.dir/__/src/simulator.cpp.o CMakeFiles/VolusionD.dir/__/include/moc_viewer.cxx.o -o ../../bin/VolusionD -L/home/pitiot/CGoGN_Apps/Volusion/../../CGoGN/lib/Debug -L/home/pitiot/CGoGN_Apps/Volusion/../../CGoGN/lib/Release -rdynamic -lalgoD -ltopologyD -lcontainerD -lutilsD -lnl -lGLU -lGL -lSM -lICE -lX11 -lXext -lGLEW -lz -lxml2 -lboost_regex -lamd -lbtf -lcamd -lccolamd -lcholmod -lcolamd -lcxsparse -lklu -lumfpack -lspqr -lassimp -lZinri -lQtOpenGL -lQtSvg -lQtGui -lQtXml -lQtCore -lQGLViewer -lQGLViewer -Wl,-rpath,/home/pitiot/CGoGN_Apps/Volusion/../../CGoGN/lib/Debug:/home/pitiot/CGoGN_Apps/Volusion/../../CGoGN/lib/Release
/usr/bin/c++ -g -DQGLVIEWER_FOUND -Wall -Wextra -fPIC -std=c++11 -Wno-unused-local-typedefs -g -pg CMakeFiles/VolusionD.dir/__/src/viewer.cpp.o CMakeFiles/VolusionD.dir/__/src/env_map.cpp.o CMakeFiles/VolusionD.dir/__/src/simulator.cpp.o CMakeFiles/VolusionD.dir/__/include/moc_viewer.cxx.o -o ../../bin/Release/VolusionD -L/home/pitiot/CGoGN_Apps/Volusion/../../CGoGN/lib/Release -L/home/pitiot/CGoGN_Apps/Volusion/../../CGoGN/lib/Debug -rdynamic -lamd -lbtf -lcamd -lccolamd -lcholmod -lcolamd -lcxsparse -lklu -lumfpack -lspqr -llapack -lblas -lnl -lGLU -lGL -lSM -lICE -lX11 -lXext -lGLEW -lz -lxml2 -lboost_regex -lassimp -lZinri -lQtOpenGL -lQtSvg -lQtGui -lQtXml -lQtCore -lQGLViewer -lQGLViewer -Wl,-rpath,/home/pitiot/CGoGN_Apps/Volusion/../../CGoGN/lib/Release:/home/pitiot/CGoGN_Apps/Volusion/../../CGoGN/lib/Debug
......@@ -8,7 +8,6 @@ SET(CMAKE_TARGET_DEFINITIONS
"CGOGN_ASSERT_BOOL=false"
"QT_CORE_LIB"
"QT_GUI_LIB"
"QT_NO_DEBUG"
"QT_OPENGL_LIB"
"QT_SVG_LIB"
"QT_XML_LIB"
......
......@@ -22,7 +22,6 @@
-DWITH_ASSIMP
-DWITH_ZINRI
-DWITH_QT
-DQT_NO_DEBUG
-DQT_OPENGL_LIB
-DQT_SVG_LIB
-DQT_GUI_LIB
......
......@@ -161,34 +161,34 @@ Volusion_OBJECTS = \
# External object files for target Volusion
Volusion_EXTERNAL_OBJECTS =
../bin/Volusion: Release/CMakeFiles/Volusion.dir/__/src/viewer.cpp.o
../bin/Volusion: Release/CMakeFiles/Volusion.dir/__/src/env_map.cpp.o
../bin/Volusion: Release/CMakeFiles/Volusion.dir/__/src/simulator.cpp.o
../bin/Volusion: Release/CMakeFiles/Volusion.dir/__/include/moc_viewer.cxx.o
../bin/Volusion: Release/CMakeFiles/Volusion.dir/build.make
../bin/Volusion: /usr/lib/x86_64-linux-gnu/libGLU.so
../bin/Volusion: /usr/lib/x86_64-linux-gnu/libGL.so
../bin/Volusion: /usr/lib/x86_64-linux-gnu/libSM.so
../bin/Volusion: /usr/lib/x86_64-linux-gnu/libICE.so
../bin/Volusion: /usr/lib/x86_64-linux-gnu/libX11.so
../bin/Volusion: /usr/lib/x86_64-linux-gnu/libXext.so
../bin/Volusion: /usr/lib/x86_64-linux-gnu/libGLEW.so
../bin/Volusion: /usr/lib/x86_64-linux-gnu/libz.so
../bin/Volusion: /usr/lib/x86_64-linux-gnu/libxml2.so
../bin/Volusion: /usr/lib/x86_64-linux-gnu/libboost_regex.so
../bin/Volusion: /usr/lib/x86_64-linux-gnu/libQtOpenGL.so
../bin/Volusion: /usr/lib/x86_64-linux-gnu/libQtSvg.so
../bin/Volusion: /usr/lib/x86_64-linux-gnu/libQtGui.so
../bin/Volusion: /usr/lib/x86_64-linux-gnu/libQtXml.so
../bin/Volusion: /usr/lib/x86_64-linux-gnu/libQtCore.so
../bin/Volusion: /usr/lib/x86_64-linux-gnu/libQGLViewer.so
../bin/Volusion: /usr/lib/x86_64-linux-gnu/libQGLViewer.so
../bin/Volusion: Release/CMakeFiles/Volusion.dir/link.txt
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --red --bold "Linking CXX executable ../../bin/Volusion"
../bin/Release/Volusion: Release/CMakeFiles/Volusion.dir/__/src/viewer.cpp.o
../bin/Release/Volusion: Release/CMakeFiles/Volusion.dir/__/src/env_map.cpp.o
../bin/Release/Volusion: Release/CMakeFiles/Volusion.dir/__/src/simulator.cpp.o
../bin/Release/Volusion: Release/CMakeFiles/Volusion.dir/__/include/moc_viewer.cxx.o
../bin/Release/Volusion: Release/CMakeFiles/Volusion.dir/build.make
../bin/Release/Volusion: /usr/lib/x86_64-linux-gnu/libGLU.so
../bin/Release/Volusion: /usr/lib/x86_64-linux-gnu/libGL.so
../bin/Release/Volusion: /usr/lib/x86_64-linux-gnu/libSM.so
../bin/Release/Volusion: /usr/lib/x86_64-linux-gnu/libICE.so
../bin/Release/Volusion: /usr/lib/x86_64-linux-gnu/libX11.so
../bin/Release/Volusion: /usr/lib/x86_64-linux-gnu/libXext.so
../bin/Release/Volusion: /usr/lib/x86_64-linux-gnu/libGLEW.so
../bin/Release/Volusion: /usr/lib/x86_64-linux-gnu/libz.so
../bin/Release/Volusion: /usr/lib/x86_64-linux-gnu/libxml2.so
../bin/Release/Volusion: /usr/lib/x86_64-linux-gnu/libboost_regex.so
../bin/Release/Volusion: /usr/lib/x86_64-linux-gnu/libQtOpenGL.so
../bin/Release/Volusion: /usr/lib/x86_64-linux-gnu/libQtSvg.so
../bin/Release/Volusion: /usr/lib/x86_64-linux-gnu/libQtGui.so
../bin/Release/Volusion: /usr/lib/x86_64-linux-gnu/libQtXml.so
../bin/Release/Volusion: /usr/lib/x86_64-linux-gnu/libQtCore.so
../bin/Release/Volusion: /usr/lib/x86_64-linux-gnu/libQGLViewer.so
../bin/Release/Volusion: /usr/lib/x86_64-linux-gnu/libQGLViewer.so
../bin/Release/Volusion: Release/CMakeFiles/Volusion.dir/link.txt
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --red --bold "Linking CXX executable ../../bin/Release/Volusion"
cd /home/pitiot/CGoGN_Apps/Volusion/build/Release && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/Volusion.dir/link.txt --verbose=$(VERBOSE)
# Rule to build all files generated by this target.
Release/CMakeFiles/Volusion.dir/build: ../bin/Volusion
Release/CMakeFiles/Volusion.dir/build: ../bin/Release/Volusion
.PHONY : Release/CMakeFiles/Volusion.dir/build
Release/CMakeFiles/Volusion.dir/requires: Release/CMakeFiles/Volusion.dir/__/src/viewer.cpp.o.requires
......
......@@ -5,8 +5,8 @@ FILE(REMOVE_RECURSE
"CMakeFiles/Volusion.dir/__/src/env_map.cpp.o"
"CMakeFiles/Volusion.dir/__/src/simulator.cpp.o"
"CMakeFiles/Volusion.dir/__/include/moc_viewer.cxx.o"
"../../bin/Volusion.pdb"
"../../bin/Volusion"
"../../bin/Release/Volusion.pdb"
"../../bin/Release/Volusion"
)
# Per-language clean rules from dependency scanning.
......
/usr/bin/c++ -g -DQGLVIEWER_FOUND -Wall -Wextra -fPIC -std=c++11 -Wno-unused-local-typedefs -O3 -DNDEBUG -pg CMakeFiles/Volusion.dir/__/src/viewer.cpp.o CMakeFiles/Volusion.dir/__/src/env_map.cpp.o CMakeFiles/Volusion.dir/__/src/simulator.cpp.o CMakeFiles/Volusion.dir/__/include/moc_viewer.cxx.o -o ../../bin/Volusion -L/home/pitiot/CGoGN_Apps/Volusion/../../CGoGN/lib/Debug -L/home/pitiot/CGoGN_Apps/Volusion/../../CGoGN/lib/Release -rdynamic -lalgo -ltopology -lcontainer -lutils -lnl -lGLU -lGL -lSM -lICE -lX11 -lXext -lGLEW -lz -lxml2 -lboost_regex -lamd -lbtf -lcamd -lccolamd -lcholmod -lcolamd -lcxsparse -lklu -lumfpack -lspqr -lassimp -lZinri -lQtOpenGL -lQtSvg -lQtGui -lQtXml -lQtCore -lQGLViewer -lQGLViewer -Wl,-rpath,/home/pitiot/CGoGN_Apps/Volusion/../../CGoGN/lib/Debug:/home/pitiot/CGoGN_Apps/Volusion/../../CGoGN/lib/Release
/usr/bin/c++ -g -DQGLVIEWER_FOUND -Wall -Wextra -fPIC -std=c++11 -Wno-unused-local-typedefs -O3 -DNDEBUG -pg CMakeFiles/Volusion.dir/__/src/viewer.cpp.o CMakeFiles/Volusion.dir/__/src/env_map.cpp.o CMakeFiles/Volusion.dir/__/src/simulator.cpp.o CMakeFiles/Volusion.dir/__/include/moc_viewer.cxx.o -o ../../bin/Release/Volusion -L/home/pitiot/CGoGN_Apps/Volusion/../../CGoGN/lib/Release -rdynamic -lamd -lbtf -lcamd -lccolamd -lcholmod -lcolamd -lcxsparse -lklu -lumfpack -lspqr -llapack -lblas -lnl -lGLU -lGL -lSM -lICE -lX11 -lXext -lGLEW -lz -lxml2 -lboost_regex -lassimp -lZinri -lQtOpenGL -lQtSvg -lQtGui -lQtXml -lQtCore -lQGLViewer -lQGLViewer -Wl,-rpath,/home/pitiot/CGoGN_Apps/Volusion/../../CGoGN/lib/Release
......@@ -22,7 +22,6 @@
-DWITH_ASSIMP
-DWITH_ZINRI
-DWITH_QT
-DQT_NO_DEBUG
-DQT_OPENGL_LIB
-DQT_SVG_LIB
-DQT_GUI_LIB
......
......@@ -12,7 +12,7 @@ IF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
STRING(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
ELSE(BUILD_TYPE)
SET(CMAKE_INSTALL_CONFIG_NAME "")
SET(CMAKE_INSTALL_CONFIG_NAME "Release")
ENDIF(BUILD_TYPE)
MESSAGE(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
ENDIF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
......
No preview for this file type
#ifndef __RIGIDXFCOMPUTATION_09122008__
#define __RIGIDXFCOMPUTATION_09122008__
#include "Geometry/matrix.h"
#include "Geometry/vector_gen.h"
using namespace CGoGN;
/** two ways to compute the minimal linear transformation between 2 sets of points*/
class RigidComputation
{
public :
/** SVD decomposition */
//Thanks to Frederic Larue
// extern gmtl::Matrix44f getRigidTransform( std::vector<Geom::Vec3f> from,std::vector<Geom::Vec3f> to, float time);
/** Jacobian rotation : to use with the covariance matrix*/
// http://books.google.com/books?id=weYj75E_t6MC&pg=PA263&lpg=PA263&dq=diagonalize+matrix+Jacobi+rotation+method&source=web&ots=LPY0V-udrx&sig=0mBoM5L9nH3KAdiunJKuGeVDW0s&hl=en&sa=X&oi=book_result&resnum=5&ct=result#PPA266,M1
// rotate a throught beta in pq-plane to set a[p][q]=0
// rotation stored in r whose columns are eigenvectors of a
void rotate(Geom::Matrix33f &a,Geom::Matrix33f &r, int p, int q);
float maxoffdiag(Geom::Matrix33f &a,int &p, int &q);
//final a is diagonal matrix of eigenvalues
//final r has eigenvectors in rows
void jacrot(Geom::Matrix33f &a, Geom::Matrix33f &r);
static int jacobiDiagonalization( Geom::Matrix33f& A, Geom::Matrix33f& V );
};
#endif
#ifndef SHAPEMATCHING_H
#define SHAPEMATCHING_H
#include "Geometry/matrix.h"
#include "Geometry/vector_gen.h"
#include "env_map.h"
using namespace CGoGN;
template <typename PFP>
class ShapeMatchingGen
{
public:
ShapeMatchingGen(typename PFP::MAP& map, VertexAttribute<VEC3>& position,std::vector<Dart> v_darts, typename PFP::REAL beta):
m_map(map),
m_position(position),
m_darts(v_darts),
m_beta(beta)
{
this->goal = this->m_map.template addAttribute<VEC3, VERTEX>("");
}
~ShapeMatchingGen()
{
if(goal.isValid())
this->m_map.template removeAttribute<VEC3, VERTEX>(this->goal);
}
virtual void initialize()=0;
virtual void animate()=0;
void computeAqqMatrix()
{
this->aqq.zero();
for(unsigned int i = 0 ; i < this->q.size() ; i++)
{
this->aqq(0,0)+=this->q[i][0]*this->q[i][0]; this->aqq(1,0)+=this->q[i][0]*this->q[i][1]; this->aqq(2,0)+=this->q[i][0]*this->q[i][2];
this->aqq(0,1)+=this->q[i][1]*this->q[i][0]; this->aqq(1,1)+=this->q[i][1]*this->q[i][1]; this->aqq(2,1)+=this->q[i][1]*this->q[i][2];
this->aqq(0,2)+=this->q[i][2]*this->q[i][0]; this->aqq(1,2)+=this->q[i][2]*this->q[i][1]; this->aqq(2,2)+=this->q[i][2]*this->q[i][2];
}
this->aqq.invert(this->aqq);
}
VEC3 computeBarycenterDarts()
{
VEC3 b(0);
for(std::vector<Dart>::iterator it = this->m_darts.begin() ; it != this->m_darts.end() ; ++it)
b += this->m_position[*it];
b /= this->m_darts.size();
return b;
}
typename PFP::REAL computeDeterminant(const Geom::Matrix33f& a)
{
return a(0,0)*a(1,1)*a(2,2)+a(0,2)*a(1,0)*a(2,1)+a(0,1)*a(1,2)*a(2,0)-a(0,2)*a(1,1)*a(2,0)-a(0,0)*a(1,2)*a(2,1)-a(0,1)*a(1,0)*a(2,2);
}
// LIST_MAT m_lm;
//
typename PFP::MAP& m_map;
VertexAttribute<VEC3>& m_position;
std::vector<Dart> m_darts;
VertexAttribute<VEC3> goal;
Geom::Matrix33f aqq;
std::vector<Geom::Vec3f> q;
typename PFP::REAL m_beta;
};
#endif
#ifndef SHAPEMATCHING_LINEAR_H
#define SHAPEMATCHING_LINEAR_H
#include "shapeMatching.h"
using namespace CGoGN;
template <typename PFP>
class ShapeMatchingLinear : public ShapeMatchingGen<PFP>
{
public:
ShapeMatchingLinear(typename PFP::MAP& map, VertexAttribute<VEC3>& position,std::vector<Dart> v_darts, typename PFP::REAL beta);
~ShapeMatchingLinear();
void initialize();
void animate();
protected:
VertexAttribute<VEC3> vecToBary;
};
#include "shapeMatchingLinear.hpp"
#endif
#include "rigidXfComputation.h"
//******************************************************************************
template <typename PFP>
ShapeMatchingLinear<PFP>::ShapeMatchingLinear(typename PFP::MAP& map, VertexAttribute<VEC3>& position,std::vector<Dart> v_darts, typename PFP::REAL beta) :
ShapeMatchingGen<PFP>(map,position,v_darts,beta)
{
this->vecToBary = this->m_map.template addAttribute<VEC3, VERTEX>("");
}
//******************************************************************************
template <typename PFP>
ShapeMatchingLinear<PFP>::~ShapeMatchingLinear()
{
std::cout << "delete SM" << std::endl;
if(this->vecToBary.isValid())
this->m_map.template removeAttribute<VEC3, VERTEX>(this->vecToBary);
}
template <typename PFP>
void ShapeMatchingLinear<PFP>::initialize()
{
assert(this->m_darts.size()>0);
typedef typename PFP::VEC3 VEC3;
typedef typename PFP::REAL REAL;
//********************* first compute the data for the MATS***********************************************************
//barycenter
VEC3 x0cm = this->computeBarycenterDarts();
this->q.reserve(this->m_darts.size());
for (std::vector<Dart>::iterator it = this->m_darts.begin(); it != this->m_darts.end(); ++it)
{
VEC3 myQ(this->m_position[*it]-x0cm);
this->q.push_back(myQ);
}
this->computeAqqMatrix();
//********************* then compute the vector to barycenter for the map***********************************************************
//compute barycenter
// VEC3 b = this->computeBarycenterDarts();
for(std::vector<Dart>::iterator it = this->m_darts.begin() ; it != this->m_darts.end() ; ++it)
this->vecToBary[*it] = this->m_position[*it] - x0cm;
}
template <typename PFP>
void ShapeMatchingLinear<PFP>::animate()
{
typedef typename PFP::VEC3 VEC3;
//initialize(nfe,frame_prec);
unsigned int n = this->m_darts.size();
VEC3 xcm = this->computeBarycenterDarts();
std::vector<VEC3> p;
p.reserve( n );
for(std::vector<Dart>::iterator it = this->m_darts.begin(); it != this->m_darts.end(); ++it)
p.push_back(this->m_position[*it]-xcm);
Geom::Matrix33f apq;
apq.zero();
for(unsigned int i=0;i<p.size();++i)
for(unsigned int x=0;x<3;++x)
for(unsigned int y=0;y<3;++y)
apq(x,y) += p[i][x]*this->q[i][y];
Geom::Matrix33f s = apq.transposed()*apq;
Geom::Matrix33f sr;
RigidComputation::jacobiDiagonalization(s,sr);
s(0,0) = 1.0f/sqrt(s(0,0));
s(1,1) = 1.0f/sqrt(s(1,1));
s(2,2) = 1.0f/sqrt(s(2,2));
s = sr*s*sr.transposed();
Geom::Matrix33f r = apq*s;
Geom::Matrix33f a = apq*this->aqq;
typename PFP::REAL det = this->computeDeterminant(a);
typename PFP::REAL detAInv = 1.0f/powf(det,1.0f/3.0f);
if(std::isfinite(detAInv))
{
for(unsigned int x=0;x<3;++x)
for(unsigned int y=0;y<3;++y)
r(x,y) = this->m_beta*a(x,y)*detAInv+(1.0f-this->m_beta)*r(x,y);
}
else
{
std::cout << "no linear deformation (planar config ?), applying identity" << std::endl;
r.identity();
}
//once the transformation computed : move the vertices of the map
//compute barycenter
// VEC3 b = this->computeBarycenterDarts();
//move the vertices
for(std::vector<Dart>::iterator it = this->m_darts.begin() ; it != this->m_darts.end() ; ++it)
{
this->goal[*it] = r*this->vecToBary[*it]+xcm;
}
}
#ifndef SHAPEMATCHING_QUAD_H
#define SHAPEMATCHING_QUAD_H
#include "shapeMatching.h"
#include "Geometry/vector_gen.h"
using namespace CGoGN;
template <typename PFP>
class ShapeMatchingQuadratic : public ShapeMatchingGen<PFP>
{
public:
ShapeMatchingQuadratic(typename PFP::MAP& map, VertexAttribute<VEC3>& position,std::vector<Dart> v_darts, typename PFP::REAL beta);
~ShapeMatchingQuadratic();
void initialize();
void animate();
protected:
Geom::Matrix<9,9,typename PFP::REAL> aqqQuad;
//vectors to barycenter
std::vector<Geom::Vector<9,typename PFP::REAL> > qQuad;
VertexAttribute<Geom::Vector<9,typename PFP::REAL> > vecQuad ;
};
#include "shapeMatchingQuadratic.hpp"
#endif
#include "rigidXfComputation.h"
using namespace CGoGN;
//******************************************************************************
template <typename PFP>
ShapeMatchingQuadratic<PFP>::ShapeMatchingQuadratic(typename PFP::MAP& map, VertexAttribute<VEC3>& position,std::vector<Dart> v_darts, typename PFP::REAL beta) :
ShapeMatchingGen<PFP>(map,position,v_darts,beta)
{
this->vecQuad = this->m_map.template addAttribute<Geom::Vector<9,typename PFP::REAL>,VERTEX >("");
}
//******************************************************************************
template <typename PFP>
ShapeMatchingQuadratic<PFP>::~ShapeMatchingQuadratic()
{
if(this->vecQuad.isValid())
this->m_map.template removeAttribute<Geom::Vector<9,typename PFP::REAL> >(this->vecQuad);
}
template <typename PFP>
void ShapeMatchingQuadratic<PFP>::initialize()
{
assert(this->m_darts.size()>0);
typedef typename PFP::VEC3 VEC3;
typedef typename PFP::REAL REAL;
//********************* first compute the data for the MATS***********************************************************
//barycenter
VEC3 x0cm = this->computeBarycenterDarts();
this->q.reserve(this->m_darts.size());
for (std::vector<Dart>::iterator it = this->m_darts.begin(); it != this->m_darts.end(); ++it)
{
VEC3 myQ(this->m_position[*it]-x0cm);
this->q.push_back(myQ);
Geom::Vector<9,typename PFP::REAL> myQQuad;
myQQuad[0] = myQ[0];
myQQuad[1] = myQ[1];
myQQuad[2] = myQ[2];
myQQuad[3] = myQ[0]*myQ[0];
myQQuad[4] = myQ[1]*myQ[1];
myQQuad[5] = myQ[2]*myQ[2];
myQQuad[6] = myQ[0]*myQ[1];
myQQuad[7] = myQ[1]*myQ[2];
myQQuad[8] = myQ[2]*myQ[0];
qQuad.push_back(myQQuad);
}
this->computeAqqMatrix();
aqqQuad.zero();
for(unsigned int i = 0; i < this->q.size(); ++i)
for(int x=0;x<9;++x)
for(int y=0;y<9;++y)
aqqQuad(x,y)+= qQuad[i][x]*qQuad[i][y];
aqqQuad.invert(aqqQuad);
//********************* then compute the vector to barycenter for the map***********************************************************
//compute barycenter
// VEC3 b = this->computeBarycenterDarts();
for(std::vector<Dart>::iterator it = this->m_darts.begin() ; it != this->m_darts.end() ; ++it)
{
VEC3 toBary = this->m_position[*it] - x0cm;
Geom::Vector<9,typename PFP::REAL> myQQuad;
myQQuad[0] = toBary[0];
myQQuad[1] = toBary[1];
myQQuad[2] = toBary[2];
myQQuad[3] = toBary[0]*toBary[0];
myQQuad[4] = toBary[1]*toBary[1];
myQQuad[5] = toBary[2]*toBary[2];
myQQuad[6] = toBary[0]*toBary[1];
myQQuad[7] = toBary[1]*toBary[2];
myQQuad[8] = toBary[2]*toBary[0];
this->vecQuad[*it] = myQQuad;
}
}
template <typename PFP>
void ShapeMatchingQuadratic<PFP>::animate()
{
typedef typename PFP::VEC3 VEC3;
unsigned int n = this->m_darts.size();
VEC3 xcm = this->computeBarycenterDarts();