Commit d08027e1 authored by untereiner's avatar untereiner

Merge cgogn:~kraemer/CGoGN

parents e59858fd b216aa33
#ifndef _COMPUTECURVATURE_DIALOG_H_
#define _COMPUTECURVATURE_DIALOG_H_
#include "ui_computeCurvatureDialog.h"
namespace CGoGN
{
namespace SCHNApps
{
class Window;
class ComputeCurvatureDialog : public QDialog, public Ui::ComputeCurvatureDialog
{
Q_OBJECT
public:
ComputeCurvatureDialog(Window* w);
void init();
public slots:
void cb_selectedMapChanged();
private:
Window* m_window;
};
} // namespace SCHNApps
} // namespace CGoGN
#endif
#include "computeCurvatureDialog.h"
#include "differentialProperties.h"
#include "window.h"
#include "mapHandler.h"
namespace CGoGN
{
namespace SCHNApps
{
ComputeCurvatureDialog::ComputeCurvatureDialog(Window* w) : m_window(w)
{
setupUi(this);
connect(mapList, SIGNAL(itemSelectionChanged()), this, SLOT(cb_selectedMapChanged()));
}
void ComputeCurvatureDialog::init()
{
mapList->clear();
combo_positionAttribute->clear();
combo_normalAttribute->clear();
combo_KmaxAttribute->clear();
combo_kmaxAttribute->clear();
combo_KminAttribute->clear();
combo_kminAttribute->clear();
combo_KnormalAttribute->clear();
KmaxAttributeName->setText("Kmax");
kmaxAttributeName->setText("kmax");
KminAttributeName->setText("Kmin");
kminAttributeName->setText("kmin");
KnormalAttributeName->setText("Knormal");
const QList<MapHandlerGen*>& maps = m_window->getMapsList();
foreach(MapHandlerGen* map, maps)
mapList->addItem(map->getName());
}
void ComputeCurvatureDialog::cb_selectedMapChanged()
{
QList<QListWidgetItem*> currentItems = mapList->selectedItems();
if(!currentItems.empty())
{
combo_positionAttribute->clear();
combo_normalAttribute->clear();
const QString& mapname = currentItems[0]->text();
MapHandlerGen* mh = m_window->getMap(mapname);
GenericMap* map = mh->getGenericMap();
AttributeContainer& cont = map->getAttributeContainer<VERTEX>();
std::vector<std::string> names;
std::vector<std::string> types;
cont.getAttributesNames(names);
cont.getAttributesTypes(types);
std::string vec3TypeName = nameOfType(VEC3());
std::string realTypeName = nameOfType(REAL());
unsigned int j = 0;
unsigned int k = 0;
for(unsigned int i = 0; i < names.size(); ++i)
{
if(types[i] == vec3TypeName)
{
combo_positionAttribute->addItem(QString::fromStdString(names[i]));
if(names[i] == "position") // try to select a position attribute named "position"
combo_positionAttribute->setCurrentIndex(j);
combo_normalAttribute->addItem(QString::fromStdString(names[i]));
if(names[i] == "normal") // try to select a normal attribute named "normal"
combo_normalAttribute->setCurrentIndex(j);
combo_KmaxAttribute->addItem(QString::fromStdString(names[i]));
if(names[i] == "Kmax") // try to select a normal attribute named "Kmax"
combo_KmaxAttribute->setCurrentIndex(j);
combo_KminAttribute->addItem(QString::fromStdString(names[i]));
if(names[i] == "Kmin") // try to select a normal attribute named "Kmin"
combo_KminAttribute->setCurrentIndex(j);
combo_KnormalAttribute->addItem(QString::fromStdString(names[i]));
if(names[i] == "Knormal") // try to select a normal attribute named "Knormal"
combo_KnormalAttribute->setCurrentIndex(j);
++j;
}
else if(types[i] == realTypeName)
{
combo_kmaxAttribute->addItem(QString::fromStdString(names[i]));
if(names[i] == "kmax") // try to select a normal attribute named "kmax"
combo_kmaxAttribute->setCurrentIndex(k);
combo_kminAttribute->addItem(QString::fromStdString(names[i]));
if(names[i] == "kmin") // try to select a normal attribute named "kmin"
combo_kminAttribute->setCurrentIndex(k);
++k;
}
}
}
}
} // namespace SCHNApps
} // namespace CGoGN
......@@ -43,7 +43,7 @@ void ComputeNormalDialog::cb_selectedMapChanged()
std::vector<std::string> types;
cont.getAttributesNames(names);
cont.getAttributesTypes(types);
std::string vec3TypeName = VEC3::CGoGNnameOfType();
std::string vec3TypeName = nameOfType(VEC3());
unsigned int j = 0;
for(unsigned int i = 0; i < names.size(); ++i)
{
......
......@@ -138,9 +138,9 @@ void DifferentialPropertiesPlugin::cb_computeCurvature()
EdgeAttribute<REAL> edgeAngle = map->getAttribute<REAL, EDGE>("edgeAngle");
if(!edgeAngle.isValid())
edgeAngle = map->addAttribute<REAL, EDGE>("edgeAngle");
Algo::Geometry::computeAnglesBetweenNormalsOnEdges<PFP>(*map, position, edgeAngle);
Algo::Surface::Geometry::computeAnglesBetweenNormalsOnEdges<PFP>(*map, position, edgeAngle);
Algo::Geometry::computeCurvatureVertices_NormalCycles_Projected<PFP>(*map, 0.01f * mh->getBBdiagSize(), position, normal, edgeAngle, kmax, kmin, Kmax, Kmin, Knormal);
Algo::Surface::Geometry::computeCurvatureVertices_NormalCycles_Projected<PFP>(*map, 0.01f * mh->getBBdiagSize(), position, normal, edgeAngle, kmax, kmin, Kmax, Kmin, Knormal);
if(m_computeCurvatureDialog->check_KmaxCreateVBO->checkState() == Qt::Checked)
mh->createVBO(Kmax);
......
......@@ -17,7 +17,7 @@ bool ImportSurfacePlugin::enable()
void ImportSurfacePlugin::cb_import()
{
QString fileName = QFileDialog::getOpenFileName(m_window, "Import file", m_window->getAppPath(), "Mesh Files (*.ply *.off)");
QString fileName = QFileDialog::getOpenFileName(m_window, "Import file", m_window->getAppPath(), "Mesh Files (*.ply *.off *.trian)");
QFileInfo fi(fileName);
if(fi.exists())
......
......@@ -215,7 +215,6 @@ void RenderVectorDockTab::refreshUI(ParameterSet* params)
PerMapParameterSet& p = params->perMap[map->getName()];
// QList<Utils::VBO*> vbos = map->getVBOList(nameOfType(VEC3()));
QList<Utils::VBO*> vbos = map->getVBOList();
for(int i = 0; i < vbos.count(); ++i)
{
......
......@@ -112,7 +112,8 @@ void computeCurvatureVertices_NormalCycles(
VertexAttribute<typename PFP::VEC3>& Kmax,
VertexAttribute<typename PFP::VEC3>& Kmin,
VertexAttribute<typename PFP::VEC3>& Knormal,
const FunctorSelect& select = allDarts, unsigned int thread=0) ;
const FunctorSelect& select = allDarts,
unsigned int thread = 0) ;
template <typename PFP>
void computeCurvatureVertex_NormalCycles(
......@@ -126,7 +127,8 @@ void computeCurvatureVertex_NormalCycles(
VertexAttribute<typename PFP::REAL>& kmin,
VertexAttribute<typename PFP::VEC3>& Kmax,
VertexAttribute<typename PFP::VEC3>& Kmin,
VertexAttribute<typename PFP::VEC3>& Knormal, unsigned int thread=0) ;
VertexAttribute<typename PFP::VEC3>& Knormal,
unsigned int thread = 0) ;
template <typename PFP>
void normalCycles_SortAndSetEigenComponents(
......@@ -138,13 +140,13 @@ void normalCycles_SortAndSetEigenComponents(
typename PFP::VEC3& Kmin,
typename PFP::VEC3& Knormal,
const typename PFP::VEC3& normal,
unsigned int thread=0) ;
unsigned int thread = 0) ;
template <typename PFP>
void normalCycles_SortTensor( Geom::Matrix<3,3,typename PFP::REAL> & tensor, unsigned int thread=0) ;
void normalCycles_SortTensor( Geom::Matrix<3,3,typename PFP::REAL> & tensor, unsigned int thread = 0) ;
template <typename PFP>
void normalCycles_ProjectTensor( Geom::Matrix<3,3,typename PFP::REAL> & tensor, const typename PFP::VEC3& normal_vector, unsigned int thread=0) ;
void normalCycles_ProjectTensor( Geom::Matrix<3,3,typename PFP::REAL> & tensor, const typename PFP::VEC3& normal_vector, unsigned int thread = 0) ;
template <typename PFP>
void computeCurvatureVertices_NormalCycles_Projected(
......@@ -158,7 +160,8 @@ void computeCurvatureVertices_NormalCycles_Projected(
VertexAttribute<typename PFP::VEC3>& Kmax,
VertexAttribute<typename PFP::VEC3>& Kmin,
VertexAttribute<typename PFP::VEC3>& Knormal,
const FunctorSelect& select = allDarts, unsigned int thread=0) ;
const FunctorSelect& select = allDarts,
unsigned int thread = 0) ;
template <typename PFP>
void computeCurvatureVertex_NormalCycles_Projected(
......@@ -172,7 +175,8 @@ void computeCurvatureVertex_NormalCycles_Projected(
VertexAttribute<typename PFP::REAL>& kmin,
VertexAttribute<typename PFP::VEC3>& Kmax,
VertexAttribute<typename PFP::VEC3>& Kmin,
VertexAttribute<typename PFP::VEC3>& Knormal, unsigned int thread=0) ;
VertexAttribute<typename PFP::VEC3>& Knormal,
unsigned int thread = 0) ;
......@@ -190,7 +194,8 @@ void computeCurvatureVertices_NormalCycles(
VertexAttribute<typename PFP::VEC3>& Kmax,
VertexAttribute<typename PFP::VEC3>& Kmin,
VertexAttribute<typename PFP::VEC3>& Knormal,
const FunctorSelect& select = allDarts, unsigned int thread=0) ;
const FunctorSelect& select = allDarts,
unsigned int thread = 0) ;
template <typename PFP>
void computeCurvatureVertex_NormalCycles(
......@@ -204,7 +209,8 @@ void computeCurvatureVertex_NormalCycles(
VertexAttribute<typename PFP::REAL>& kmin,
VertexAttribute<typename PFP::VEC3>& Kmax,
VertexAttribute<typename PFP::VEC3>& Kmin,
VertexAttribute<typename PFP::VEC3>& Knormal, unsigned int thread=0) ;
VertexAttribute<typename PFP::VEC3>& Knormal,
unsigned int thread = 0) ;
template <typename PFP>
void computeCurvatureVertices_NormalCycles_Projected(
......@@ -218,7 +224,8 @@ void computeCurvatureVertices_NormalCycles_Projected(
VertexAttribute<typename PFP::VEC3>& Kmax,
VertexAttribute<typename PFP::VEC3>& Kmin,
VertexAttribute<typename PFP::VEC3>& Knormal,
const FunctorSelect& select = allDarts, unsigned int thread=0) ;
const FunctorSelect& select = allDarts,
unsigned int thread = 0) ;
template <typename PFP>
void computeCurvatureVertex_NormalCycles_Projected(
......@@ -232,7 +239,8 @@ void computeCurvatureVertex_NormalCycles_Projected(
VertexAttribute<typename PFP::REAL>& kmin,
VertexAttribute<typename PFP::VEC3>& Kmax,
VertexAttribute<typename PFP::VEC3>& Kmin,
VertexAttribute<typename PFP::VEC3>& Knormal, unsigned int thread=0) ;
VertexAttribute<typename PFP::VEC3>& Knormal,
unsigned int thread = 0) ;
namespace Parallel
......@@ -249,7 +257,8 @@ void computeCurvatureVertices_NormalCycles(
VertexAttribute<typename PFP::VEC3>& Kmax,
VertexAttribute<typename PFP::VEC3>& Kmin,
VertexAttribute<typename PFP::VEC3>& Knormal,
const FunctorSelect& select = allDarts, unsigned int nbth = 0) ;
const FunctorSelect& select = allDarts,
unsigned int nbth = 0) ;
template <typename PFP>
void computeCurvatureVertices_QuadraticFitting(
......@@ -260,7 +269,8 @@ void computeCurvatureVertices_QuadraticFitting(
VertexAttribute<typename PFP::REAL>& kmin,
VertexAttribute<typename PFP::VEC3>& Kmax,
VertexAttribute<typename PFP::VEC3>& Kmin,
const FunctorSelect& select = allDarts, unsigned int nbth=0);
const FunctorSelect& select = allDarts,
unsigned int nbth = 0);
} // namespace Parallel
......
......@@ -27,14 +27,6 @@
#include "Topology/generic/traversorCell.h"
#include "Topology/generic/traversor2.h"
extern "C"
{
#include "C_BLAS_LAPACK/INCLUDE/f2c.h"
#include "C_BLAS_LAPACK/INCLUDE/clapack.h"
}
#undef max
#undef min
namespace CGoGN
{
......@@ -291,7 +283,8 @@ void computeCurvatureVertices_NormalCycles(
VertexAttribute<typename PFP::VEC3>& Kmax,
VertexAttribute<typename PFP::VEC3>& Kmin,
VertexAttribute<typename PFP::VEC3>& Knormal,
const FunctorSelect& select, unsigned int thread)
const FunctorSelect& select,
unsigned int thread)
{
TraversorV<typename PFP::MAP> t(map, select) ;
for(Dart d = t.begin(); d != t.end(); d = t.next())
......@@ -310,7 +303,8 @@ void computeCurvatureVertex_NormalCycles(
VertexAttribute<typename PFP::REAL>& kmin,
VertexAttribute<typename PFP::VEC3>& Kmax,
VertexAttribute<typename PFP::VEC3>& Kmin,
VertexAttribute<typename PFP::VEC3>& Knormal, unsigned int thread)
VertexAttribute<typename PFP::VEC3>& Knormal,
unsigned int thread)
{
typedef typename PFP::REAL REAL ;
typedef typename PFP::VEC3 VEC3 ;
......@@ -355,7 +349,8 @@ void computeCurvatureVertices_NormalCycles_Projected(
VertexAttribute<typename PFP::VEC3>& Kmax,
VertexAttribute<typename PFP::VEC3>& Kmin,
VertexAttribute<typename PFP::VEC3>& Knormal,
const FunctorSelect& select, unsigned int thread)
const FunctorSelect& select,
unsigned int thread)
{
TraversorV<typename PFP::MAP> t(map, select) ;
for(Dart d = t.begin(); d != t.end(); d = t.next())
......@@ -374,7 +369,8 @@ void computeCurvatureVertex_NormalCycles_Projected(
VertexAttribute<typename PFP::REAL>& kmin,
VertexAttribute<typename PFP::VEC3>& Kmax,
VertexAttribute<typename PFP::VEC3>& Kmin,
VertexAttribute<typename PFP::VEC3>& Knormal, unsigned int thread)
VertexAttribute<typename PFP::VEC3>& Knormal,
unsigned int thread)
{
typedef typename PFP::REAL REAL ;
typedef typename PFP::VEC3 VEC3 ;
......@@ -412,7 +408,8 @@ void computeCurvatureVertices_NormalCycles(
VertexAttribute<typename PFP::VEC3>& Kmax,
VertexAttribute<typename PFP::VEC3>& Kmin,
VertexAttribute<typename PFP::VEC3>& Knormal,
const FunctorSelect& select, unsigned int thread)
const FunctorSelect& select,
unsigned int thread)
{
TraversorV<typename PFP::MAP> t(map, select) ;
for(Dart d = t.begin(); d != t.end(); d = t.next())
......@@ -431,7 +428,8 @@ void computeCurvatureVertex_NormalCycles(
VertexAttribute<typename PFP::REAL>& kmin,
VertexAttribute<typename PFP::VEC3>& Kmax,
VertexAttribute<typename PFP::VEC3>& Kmin,
VertexAttribute<typename PFP::VEC3>& Knormal, unsigned int thread)
VertexAttribute<typename PFP::VEC3>& Knormal,
unsigned int thread)
{
typedef typename PFP::REAL REAL ;
typedef typename PFP::VEC3 VEC3 ;
......@@ -465,7 +463,8 @@ void computeCurvatureVertices_NormalCycles_Projected(
VertexAttribute<typename PFP::VEC3>& Kmax,
VertexAttribute<typename PFP::VEC3>& Kmin,
VertexAttribute<typename PFP::VEC3>& Knormal,
const FunctorSelect& select, unsigned int thread)
const FunctorSelect& select,
unsigned int thread)
{
TraversorV<typename PFP::MAP> t(map, select) ;
for(Dart d = t.begin(); d != t.end(); d = t.next())
......@@ -484,7 +483,8 @@ void computeCurvatureVertex_NormalCycles_Projected(
VertexAttribute<typename PFP::REAL>& kmin,
VertexAttribute<typename PFP::VEC3>& Kmax,
VertexAttribute<typename PFP::VEC3>& Kmin,
VertexAttribute<typename PFP::VEC3>& Knormal, unsigned int thread)
VertexAttribute<typename PFP::VEC3>& Knormal,
unsigned int thread)
{
typedef typename PFP::REAL REAL ;
typedef typename PFP::VEC3 VEC3 ;
......@@ -519,7 +519,7 @@ void normalCycles_SortAndSetEigenComponents(
typename PFP::VEC3& Kmin,
typename PFP::VEC3& Knormal,
const typename PFP::VEC3& normal,
unsigned int thread=0)
unsigned int thread)
{
// sort eigen components : ev[inormal] has minimal absolute value ; kmin = ev[imin] <= ev[imax] = kmax
int inormal=0, imin, imax ;
......@@ -549,7 +549,7 @@ void normalCycles_SortAndSetEigenComponents(
}
template <typename PFP>
void normalCycles_SortTensor( Geom::Matrix<3,3,typename PFP::REAL> & tensor, unsigned int thread=0)
void normalCycles_SortTensor(Geom::Matrix<3,3,typename PFP::REAL> & tensor, unsigned int thread)
{
typedef typename PFP::REAL REAL ;
typedef typename PFP::VEC3 VEC3 ;
......@@ -582,7 +582,7 @@ void normalCycles_SortTensor( Geom::Matrix<3,3,typename PFP::REAL> & tensor, uns
}
template <typename PFP>
void normalCycles_ProjectTensor( Geom::Matrix<3,3,typename PFP::REAL> & tensor, const typename PFP::VEC3& normal_vector, unsigned int thread=0)
void normalCycles_ProjectTensor(Geom::Matrix<3,3,typename PFP::REAL> & tensor, const typename PFP::VEC3& normal_vector, unsigned int thread)
{
Geom::Matrix<3,3,typename PFP::REAL> proj;
proj.identity();
......@@ -647,7 +647,8 @@ void computeCurvatureVertices_NormalCycles(
VertexAttribute<typename PFP::VEC3>& Kmax,
VertexAttribute<typename PFP::VEC3>& Kmin,
VertexAttribute<typename PFP::VEC3>& Knormal,
const FunctorSelect& select, unsigned int nbth)
const FunctorSelect& select,
unsigned int nbth)
{
// WAHOO BIG PROBLEM WITH LAZZY EMBEDDING !!!
if (!map. template isOrbitEmbedded<VERTEX>())
......@@ -714,7 +715,8 @@ void computeCurvatureVertices_QuadraticFitting(
VertexAttribute<typename PFP::REAL>& kmin,
VertexAttribute<typename PFP::VEC3>& Kmax,
VertexAttribute<typename PFP::VEC3>& Kmin,
const FunctorSelect& select, unsigned int nbth)
const FunctorSelect& select,
unsigned int nbth)
{
FunctorComputeCurvatureVertices_QuadraticFitting<PFP> funct(map, position, normal, kmax, kmin, Kmax, Kmin);
Algo::Parallel::foreach_cell<typename PFP::MAP,VERTEX>(map, funct, nbth, true, select);
......
......@@ -173,7 +173,7 @@ void Collector_OneRing<PFP>::computeNormalCyclesTensor (const VertexAttribute<VE
// TODO : not boundary safe
for (std::vector<Dart>::const_iterator it = this->border.begin(); it != this->border.end(); ++it)
{
const VEC3 e = Algo::Geometry::vectorOutOfDart<PFP>(this->map, *it, pos) ;
const VEC3 e = Algo::Surface::Geometry::vectorOutOfDart<PFP>(this->map, *it, pos) ;
tensor += Geom::transposed_vectors_mult(e,e) * edgeangle[*it] * (1 / e.norm()) ;
}
......@@ -199,8 +199,8 @@ void Collector_OneRing<PFP>::computeNormalCyclesTensor (const VertexAttribute<VE
// TODO : not boundary safe
for (std::vector<Dart>::const_iterator it = this->border.begin(); it != this->border.end(); ++it)
{
const VEC3 e = Algo::Geometry::vectorOutOfDart<PFP>(this->map, *it, pos) ;
const REAL edgeangle = Algo::Geometry::computeAngleBetweenNormalsOnEdge<PFP>(this->map, *it, pos) ;
const VEC3 e = Algo::Surface::Geometry::vectorOutOfDart<PFP>(this->map, *it, pos) ;
const REAL edgeangle = Algo::Surface::Geometry::computeAngleBetweenNormalsOnEdge<PFP>(this->map, *it, pos) ;
tensor += Geom::transposed_vectors_mult(e,e) * edgeangle * (1 / e.norm()) ;
}
......@@ -298,7 +298,7 @@ void Collector_OneRing_AroundEdge<PFP>::computeNormalCyclesTensor (const VertexA
// TODO : not boundary safe
for (std::vector<Dart>::const_iterator it = this->border.begin(); it != this->border.end(); ++it)
{
const VEC3 e = Algo::Geometry::vectorOutOfDart<PFP>(this->map, *it, pos) ;
const VEC3 e = Algo::Surface::Geometry::vectorOutOfDart<PFP>(this->map, *it, pos) ;
tensor += Geom::transposed_vectors_mult(e,e) * edgeangle[*it] * (1 / e.norm()) ;
}
......@@ -324,8 +324,8 @@ void Collector_OneRing_AroundEdge<PFP>::computeNormalCyclesTensor (const VertexA
// TODO : not boundary safe
for (std::vector<Dart>::const_iterator it = this->border.begin(); it != this->border.end(); ++it)
{
const VEC3 e = Algo::Geometry::vectorOutOfDart<PFP>(this->map, *it, pos) ;
const REAL edgeangle = Algo::Geometry::computeAngleBetweenNormalsOnEdge<PFP>(this->map, *it, pos) ;
const VEC3 e = Algo::Surface::Geometry::vectorOutOfDart<PFP>(this->map, *it, pos) ;
const REAL edgeangle = Algo::Surface::Geometry::computeAngleBetweenNormalsOnEdge<PFP>(this->map, *it, pos) ;
tensor += Geom::transposed_vectors_mult(e,e) * edgeangle * (1 / e.norm()) ;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment