Commit 3235b80c authored by Sylvain Thery's avatar Sylvain Thery

Merge branch 'develop' of cgogn:~kraemer/CGoGN into develop

parents 068bbeba 2f294c4b
......@@ -376,7 +376,10 @@ void Viewer::importMesh(std::string& filename)
if(!normal.isValid())
normal = myMap.addAttribute<VEC3, VERTEX>("normal") ;
Utils::Chrono c;
c.start();
Algo::Surface::Geometry::computeNormalVertices<PFP>(myMap, position, normal) ;
std::cout << "compute normals -> " << c.elapsed() << std::endl;
m_positionVBO->updateData(position) ;
m_normalVBO->updateData(normal) ;
......@@ -385,8 +388,6 @@ void Viewer::importMesh(std::string& filename)
updateGLMatrices() ;
std::cout << "#vertices -> " << Algo::Topo::getNbOrbits<VERTEX>(myMap) << std::endl;
Vertex v(myMap.begin());
unsigned int e = myMap.getEmbedding(v);
}
void Viewer::exportMesh(std::string& filename, bool askExportMode)
......
......@@ -187,12 +187,12 @@ void Surface_Deformation_Plugin::mouseMove(View* view, QMouseEvent* event)
MapHandlerGen* mh = m_schnapps->getSelectedMap();
MapParameters& p = h_parameterSet[mh];
const std::vector<Dart>& handle = p.handleSelector->getSelectedCells();
const std::vector<Vertex>& handle = p.handleSelector->getSelectedCells();
if(!m_draginit)
{
m_dragZ = 0;
for(std::vector<Dart>::const_iterator it = handle.begin(); it != handle.end(); ++it)
for(std::vector<Vertex>::const_iterator it = handle.begin(); it != handle.end(); ++it)
{
const PFP2::VEC3& pp = p.positionAttribute[*it];
qglviewer::Vec q = view->camera()->projectedCoordinatesOf(qglviewer::Vec(pp[0],pp[1],pp[2]));
......@@ -212,7 +212,7 @@ void Surface_Deformation_Plugin::mouseMove(View* view, QMouseEvent* event)
qglviewer::Vec vec = qq - m_dragPrevious;
PFP2::VEC3 t(vec.x, vec.y, vec.z);
for(std::vector<Dart>::const_iterator it = handle.begin(); it != handle.end(); ++it)
for(std::vector<Vertex>::const_iterator it = handle.begin(); it != handle.end(); ++it)
p.positionAttribute[*it] += t;
m_dragPrevious = qq;
......
......@@ -279,8 +279,8 @@ void Surface_Modelisation_Plugin::mergeVolumes(MapHandlerGen* mhg)
if(p.edgeSelector && !p.edgeSelector->getSelectedCells().empty() && (p.edgeSelector->getSelectedCells().size() == 2) &&
p.faceSelector && !p.faceSelector->getSelectedCells().empty() && (p.faceSelector->getSelectedCells().size() == 2))
{
const std::vector<Dart>& selectedDarts = p.edgeSelector->getSelectedCells();
const std::vector<Dart>& selectedFaces = p.faceSelector->getSelectedCells();
const std::vector<Edge>& selectedDarts = p.edgeSelector->getSelectedCells();
const std::vector<Face>& selectedFaces = p.faceSelector->getSelectedCells();
Dart d1 = selectedDarts[0];
Dart d2 = selectedDarts[1];
......@@ -342,8 +342,11 @@ void Surface_Modelisation_Plugin::splitSurface(MapHandlerGen* mhg)
MapParameters& p = h_parameterSet[mhg];
if(p.edgeSelector && !p.edgeSelector->getSelectedCells().empty())
{
std::vector<Dart> selectedDarts = p.edgeSelector->getSelectedCells();
std::vector<Dart> path = selectedDarts;
std::vector<Edge> selectedDarts = p.edgeSelector->getSelectedCells();
std::vector<Dart> path;
for (std::vector<Edge>::iterator it = selectedDarts.begin(); it != selectedDarts.end(); ++it)
path.push_back((*it).dart);
bool isPath = true;
unsigned int i = 0;
......@@ -403,7 +406,7 @@ void Surface_Modelisation_Plugin::extrudeRegion(MapHandlerGen *mhg)
MapParameters& p = h_parameterSet[mhg];
if(p.faceSelector && !p.faceSelector->getSelectedCells().empty())
{
const std::vector<Dart>& selectedDarts = p.faceSelector->getSelectedCells();
const std::vector<Face>& selectedDarts = p.faceSelector->getSelectedCells();
Algo::Surface::Modelisation::extrudeRegion<PFP2>(*map, p.positionAttribute, selectedDarts[0], p.faceSelector->getMarker());
mh->notifyConnectivityModification();
......@@ -422,13 +425,13 @@ void Surface_Modelisation_Plugin::splitVertex(MapHandlerGen *mhg)
MapParameters& p = h_parameterSet[mhg];
if(p.edgeSelector && !p.edgeSelector->getSelectedCells().empty() && (p.edgeSelector->getSelectedCells().size() == 2))
{
const std::vector<Dart>& selectedEdges = p.edgeSelector->getSelectedCells();
const std::vector<Edge>& selectedEdges = p.edgeSelector->getSelectedCells();
Dart d0, d1;
unsigned int v00 = map->getEmbedding<VERTEX>(selectedEdges[0]);
unsigned int v01 = map->getEmbedding<VERTEX>(map->phi2(selectedEdges[0]));
unsigned int v10 = map->getEmbedding<VERTEX>(selectedEdges[1]);
unsigned int v11 = map->getEmbedding<VERTEX>(map->phi2(selectedEdges[1]));
unsigned int v00 = map->getEmbedding<VERTEX>(selectedEdges[0].dart);
unsigned int v01 = map->getEmbedding<VERTEX>(map->phi2(selectedEdges[0].dart));
unsigned int v10 = map->getEmbedding<VERTEX>(selectedEdges[1].dart);
unsigned int v11 = map->getEmbedding<VERTEX>(map->phi2(selectedEdges[1].dart));
if (v00 == v10)
{
......@@ -497,7 +500,7 @@ void Surface_Modelisation_Plugin::deleteVertex(MapHandlerGen *mhg)
const MapParameters& p = h_parameterSet[mhg];
if(p.vertexSelector && !p.vertexSelector->getSelectedCells().empty())
{
const std::vector<Dart>& darts = p.vertexSelector->getSelectedCells();
const std::vector<Vertex>& darts = p.vertexSelector->getSelectedCells();
map->deleteVertex(darts[0]);
mh->notifyAttributeModification(p.positionAttribute);
mh->notifyConnectivityModification();
......@@ -514,10 +517,10 @@ void Surface_Modelisation_Plugin::cutEdge(MapHandlerGen *mhg)
MapParameters& p = h_parameterSet[mhg];
if(p.edgeSelector && !p.edgeSelector->getSelectedCells().empty())
{
const std::vector<Dart>& edge = p.edgeSelector->getSelectedCells();
const std::vector<Edge>& edge = p.edgeSelector->getSelectedCells();
map->cutEdge(edge[0]);
p.positionAttribute[map->phi1(edge[0])] = (p.positionAttribute[edge[0]] + p.positionAttribute[map->phi1(map->phi1(edge[0]))]) / 2;
p.positionAttribute[map->phi1(edge[0].dart)] = (p.positionAttribute[edge[0].dart] + p.positionAttribute[map->phi1(map->phi1(edge[0].dart))]) / 2;
mh->notifyAttributeModification(p.positionAttribute);
mh->notifyConnectivityModification();
}
......@@ -531,7 +534,7 @@ void Surface_Modelisation_Plugin::uncutEdge(MapHandlerGen *mhg)
const MapParameters& p = h_parameterSet[mhg];
if(p.edgeSelector && !p.edgeSelector->getSelectedCells().empty())
{
const std::vector<Dart>& edge = p.edgeSelector->getSelectedCells();
const std::vector<Edge>& edge = p.edgeSelector->getSelectedCells();
if (!map->uncutEdge(edge[0]))
map->uncutEdge(map->phi2(edge[0]));
mh->notifyAttributeModification(p.positionAttribute);
......@@ -547,7 +550,7 @@ void Surface_Modelisation_Plugin::collapseEdge(MapHandlerGen *mhg)
const MapParameters& p = h_parameterSet[mhg];
if(p.edgeSelector && !p.edgeSelector->getSelectedCells().empty())
{
const std::vector<Dart>& edge = p.edgeSelector->getSelectedCells();
const std::vector<Edge>& edge = p.edgeSelector->getSelectedCells();
map->collapseEdge(edge[0]);
mh->notifyAttributeModification(p.positionAttribute);
mh->notifyConnectivityModification();
......@@ -562,7 +565,7 @@ void Surface_Modelisation_Plugin::flipEdge(MapHandlerGen *mhg)
const MapParameters& p = h_parameterSet[mhg];
if(p.edgeSelector && !p.edgeSelector->getSelectedCells().empty())
{
const std::vector<Dart>& edge = p.edgeSelector->getSelectedCells();
const std::vector<Edge>& edge = p.edgeSelector->getSelectedCells();
map->flipEdge(edge[0]);
mh->notifyConnectivityModification();
}
......@@ -576,7 +579,7 @@ void Surface_Modelisation_Plugin::flipBackEdge(MapHandlerGen *mhg)
const MapParameters& p = h_parameterSet[mhg];
if(p.edgeSelector && !p.edgeSelector->getSelectedCells().empty())
{
const std::vector<Dart>& edge = p.edgeSelector->getSelectedCells();
const std::vector<Edge>& edge = p.edgeSelector->getSelectedCells();
map->flipBackEdge(edge[0]);
mh->notifyConnectivityModification();
}
......@@ -592,7 +595,7 @@ void Surface_Modelisation_Plugin::splitFace(MapHandlerGen *mhg)
const MapParameters& p = h_parameterSet[mhg];
if(p.vertexSelector && !p.vertexSelector->getSelectedCells().empty() && (p.vertexSelector->getSelectedCells().size() == 2))
{
const std::vector<Dart>& selectedDarts = p.vertexSelector->getSelectedCells();
const std::vector<Vertex>& selectedDarts = p.vertexSelector->getSelectedCells();
bool sameFace = false;
Dart d = selectedDarts[0];
......@@ -633,7 +636,7 @@ void Surface_Modelisation_Plugin::mergeFaces(MapHandlerGen *mhg)
const MapParameters& p = h_parameterSet[mhg];
if(p.edgeSelector && !p.edgeSelector->getSelectedCells().empty())
{
const std::vector<Dart>& edge = p.edgeSelector->getSelectedCells();
const std::vector<Edge>& edge = p.edgeSelector->getSelectedCells();
map->mergeFaces(edge[0]);
mh->notifyConnectivityModification();
}
......@@ -647,7 +650,7 @@ void Surface_Modelisation_Plugin::deleteFace(MapHandlerGen *mhg)
const MapParameters& p = h_parameterSet[mhg];
if(p.faceSelector && !p.faceSelector->getSelectedCells().empty())
{
const std::vector<Dart>& dart = p.faceSelector->getSelectedCells();
const std::vector<Face>& dart = p.faceSelector->getSelectedCells();
map->deleteFace(dart[0]);
mh->notifyConnectivityModification();
}
......@@ -661,7 +664,7 @@ void Surface_Modelisation_Plugin::sewFaces(MapHandlerGen *mhg)
const MapParameters& p = h_parameterSet[mhg];
if(p.edgeSelector && !p.edgeSelector->getSelectedCells().empty() && (p.edgeSelector->getSelectedCells().size() == 2))
{
const std::vector<Dart>& selectedDarts = p.edgeSelector->getSelectedCells();
const std::vector<Edge>& selectedDarts = p.edgeSelector->getSelectedCells();
Dart d = selectedDarts[0];
Dart e = selectedDarts[1];
......@@ -683,7 +686,7 @@ void Surface_Modelisation_Plugin::unsewFaces(MapHandlerGen *mhg)
MapParameters& p = h_parameterSet[mhg];
if(p.edgeSelector && !p.edgeSelector->getSelectedCells().empty())
{
const std::vector<Dart>& dart = p.edgeSelector->getSelectedCells();
const std::vector<Edge>& dart = p.edgeSelector->getSelectedCells();
if (!map->isBoundaryEdge(dart[0]))
{
Dart d = dart[0];
......@@ -713,7 +716,7 @@ void Surface_Modelisation_Plugin::extrudeFace(MapHandlerGen *mhg)
MapParameters& p = h_parameterSet[mhg];
if(p.faceSelector && !p.faceSelector->getSelectedCells().empty())
{
const std::vector<Dart>& selectedDart = p.faceSelector->getSelectedCells();
const std::vector<Face>& selectedDart = p.faceSelector->getSelectedCells();
Dart d = selectedDart[0];
PFP2::REAL dist = 0;
......@@ -743,7 +746,7 @@ void Surface_Modelisation_Plugin::pathExtrudeFace(MapHandlerGen *mhg)
VertexAttribute<PFP2::VEC3, PFP2::MAP::IMPL>& position = p.positionAttribute;
if(p.faceSelector && !p.faceSelector->getSelectedCells().empty())
{
const std::vector<Dart>& selectedDart = p.faceSelector->getSelectedCells();
const std::vector<Face>& selectedDart = p.faceSelector->getSelectedCells();
Dart d = selectedDart[0];
for (unsigned int i = 0; i < collectedVertices.size(); i++)
{
......
......@@ -83,9 +83,9 @@ protected:
bool m_selecting;
// cell under the mouse when selecting
Dart m_selectingVertex;
Dart m_selectingEdge;
Dart m_selectingFace;
Vertex m_selectingVertex;
Edge m_selectingEdge;
Face m_selectingFace;
// selecting & selected cells drawing
Utils::PointSprite* m_pointSprite;
......
......@@ -28,48 +28,12 @@ public:
inline const QString& getName() { return m_name; }
inline const std::vector<Dart>& getSelectedCells() { return m_cells; }
virtual inline unsigned int getOrbit() const = 0;
virtual unsigned int getOrbit() = 0;
virtual void select(Dart d, bool emitSignal = true) = 0;
virtual void unselect(Dart d, bool emitSignal = true) = 0;
inline void select(const std::vector<Dart>& d)
{
for(unsigned int i = 0; i < d.size(); ++i)
select(d[i], false);
checkChange();
if(m_isMutuallyExclusive && !m_mutuallyExclusive.empty())
{
foreach(CellSelectorGen* cs, m_mutuallyExclusive)
cs->checkChange();
}
}
inline void unselect(const std::vector<Dart>& d)
{
for(unsigned int i = 0; i < d.size(); ++i)
unselect(d[i], false);
checkChange();
}
virtual bool isSelected(Dart d) = 0;
virtual inline unsigned int getNbSelectedCells() const = 0;
virtual void rebuild() = 0;
inline void setMutuallyExclusive(bool b) { m_isMutuallyExclusive = b; }
inline bool isMutuallyExclusive() const { return m_isMutuallyExclusive; }
inline void setMutuallyExclusiveSet(const QList<CellSelectorGen*>& mex)
{
m_mutuallyExclusive.clear();
foreach(CellSelectorGen* cs, mex)
{
if(cs != this)
m_mutuallyExclusive.append(cs);
}
}
inline void checkChange()
{
if(m_selectionChanged)
......@@ -79,22 +43,25 @@ public:
}
}
inline void setMutuallyExclusive(bool b) { m_isMutuallyExclusive = b; }
inline bool isMutuallyExclusive() const { return m_isMutuallyExclusive; }
virtual inline void setMutuallyExclusiveSet(const QList<CellSelectorGen*>& mex) = 0;
signals:
void selectedCellsChanged();
protected:
QString m_name;
std::vector<Dart> m_cells;
bool m_selectionChanged;
bool m_isMutuallyExclusive;
QList<CellSelectorGen*> m_mutuallyExclusive;
bool m_selectionChanged;
};
template <typename MAP, unsigned int ORBIT>
class CellSelector : public CellSelectorGen
{
typedef Cell<ORBIT> CELL;
typedef CellSelector<MAP, ORBIT> SELECTOR;
public:
CellSelector(MAP& map, const QString& name, unsigned int thread = 0) :
CellSelectorGen(name),
......@@ -105,20 +72,24 @@ public:
~CellSelector()
{}
inline unsigned int getOrbit() { return ORBIT; }
inline unsigned int getOrbit() const { return ORBIT; }
inline const CellMarker<MAP, ORBIT>& getMarker() { return m_cm; }
inline void select(Dart d, bool emitSignal = true)
inline const std::vector<CELL>& getSelectedCells() { return m_cells; }
inline unsigned int getNbSelectedCells() const { return m_cells.size(); }
inline void select(CELL c, bool emitSignal = true)
{
if(!m_cm.isMarked(d))
if(!m_cm.isMarked(c))
{
m_cm.mark(d);
m_cells.push_back(d);
m_cm.mark(c);
m_cells.push_back(c);
if(m_isMutuallyExclusive && !m_mutuallyExclusive.empty())
{
foreach(CellSelectorGen* cs, m_mutuallyExclusive)
cs->unselect(d, emitSignal);
foreach(SELECTOR* cs, m_mutuallyExclusive)
cs->unselect(c, emitSignal);
}
if(emitSignal)
emit(selectedCellsChanged());
......@@ -127,16 +98,28 @@ public:
}
}
inline void unselect(Dart d, bool emitSignal = true)
inline void select(const std::vector<CELL>& c)
{
if(m_cm.isMarked(d))
for(unsigned int i = 0; i < c.size(); ++i)
select(c[i], false);
checkChange();
if(m_isMutuallyExclusive && !m_mutuallyExclusive.empty())
{
unsigned int v = m_map.template getEmbedding<ORBIT>(d);
foreach(SELECTOR* cs, m_mutuallyExclusive)
cs->checkChange();
}
}
inline void unselect(CELL c, bool emitSignal = true)
{
if(m_cm.isMarked(c))
{
unsigned int emb = m_map.getEmbedding(c);
bool found = false;
unsigned int i;
for(i = 0; i < m_cells.size() && !found; ++i)
{
if(m_map.template getEmbedding<ORBIT>(m_cells[i]) == v)
if(m_map.template getEmbedding<ORBIT>(m_cells[i]) == emb)
found = true ;
}
if(found)
......@@ -152,26 +135,50 @@ public:
}
}
inline bool isSelected(Dart d)
inline void unselect(const std::vector<CELL>& c)
{
for(unsigned int i = 0; i < c.size(); ++i)
unselect(c[i], false);
checkChange();
}
inline bool isSelected(CELL c)
{
return m_cm.isMarked(d);
return m_cm.isMarked(c);
}
void rebuild()
{
m_cells.clear();
TraversorCell<MAP, ORBIT> t(m_map, true);
for(Dart d = t.begin(); d != t.end(); d = t.next())
foreach_cell<ORBIT>(m_map, [&] (CELL c)
{
if(m_cm.isMarked(d))
m_cells.push_back(d);
}
if(m_cm.isMarked(c))
m_cells.push_back(c);
});
emit(selectedCellsChanged());
}
inline void setMutuallyExclusiveSet(const QList<CellSelectorGen*>& mex)
{
m_mutuallyExclusive.clear();
foreach(CellSelectorGen* cs, mex)
{
if(cs != this)
{
SELECTOR* s = dynamic_cast<SELECTOR*>(cs);
if (s)
m_mutuallyExclusive.append(s);
}
}
}
private:
MAP& m_map;
CellMarker<MAP, ORBIT> m_cm;
std::vector<CELL> m_cells;
QList<SELECTOR*> m_mutuallyExclusive;
};
} // namespace SCHNApps
......
......@@ -10,8 +10,8 @@ unsigned int CellSelectorGen::selectorCount = 0;
CellSelectorGen::CellSelectorGen(const QString& name) :
m_name(name),
m_selectionChanged(false),
m_isMutuallyExclusive(false)
m_isMutuallyExclusive(false),
m_selectionChanged(false)
{
++selectorCount;
}
......
......@@ -63,7 +63,7 @@ void computeCurvatureVertices_QuadraticFitting(
template <typename PFP>
void computeCurvatureVertex_QuadraticFitting(
typename PFP::MAP& map,
Dart dart,
Vertex v,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal,
VertexAttribute<typename PFP::REAL, typename PFP::MAP::IMPL>& kmax,
......@@ -74,7 +74,7 @@ void computeCurvatureVertex_QuadraticFitting(
template <typename PFP>
void vertexQuadraticFitting(
typename PFP::MAP& map,
Dart dart,
Vertex v,
typename PFP::MATRIX33& localFrame,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal,
......@@ -104,7 +104,8 @@ template <typename PFP>
void cubicFittingAddVertexNormal(typename PFP::VEC3& v, typename PFP::VEC3& n, typename PFP::VEC3& p, typename PFP::MATRIX33& localFrame) ;
*/
/* normal cycles by [ACDLD03] : useful for parallel computing*/
/* normal cycles by [ACDLD03] : useful for parallel computing */
template <typename PFP>
void computeCurvatureVertices_NormalCycles(
typename PFP::MAP& map,
......@@ -122,7 +123,7 @@ void computeCurvatureVertices_NormalCycles(
template <typename PFP>
void computeCurvatureVertex_NormalCycles(
typename PFP::MAP& map,
Dart dart,
Vertex v,
typename PFP::REAL radius,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal,
......@@ -174,7 +175,7 @@ void computeCurvatureVertices_NormalCycles_Projected(
template <typename PFP>
void computeCurvatureVertex_NormalCycles_Projected(
typename PFP::MAP& map,
Dart dart,
Vertex v,
typename PFP::REAL radius,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal,
......@@ -204,8 +205,7 @@ void computeCurvatureVertices_NormalCycles(
template <typename PFP>
void computeCurvatureVertex_NormalCycles(
typename PFP::MAP& map,
Dart dart,
Vertex v,
Algo::Surface::Selection::Collector<PFP> & neigh,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal,
......@@ -233,8 +233,7 @@ void computeCurvatureVertices_NormalCycles_Projected(
template <typename PFP>
void computeCurvatureVertex_NormalCycles_Projected(
typename PFP::MAP& map,
Dart dart,
Vertex v,
Algo::Surface::Selection::Collector<PFP> & neigh,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal,
......
This diff is collapsed.
......@@ -41,19 +41,19 @@ namespace Geometry
{
template<typename PFP, typename V_ATT>
typename V_ATT::DATA_TYPE triangleNormal(typename PFP::MAP& map, Dart d, const V_ATT& position) ;
typename V_ATT::DATA_TYPE triangleNormal(typename PFP::MAP& map, Face f, const V_ATT& position) ;
template<typename PFP, typename V_ATT>
typename V_ATT::DATA_TYPE newellNormal(typename PFP::MAP& map, Dart d, const V_ATT& position);
typename V_ATT::DATA_TYPE newellNormal(typename PFP::MAP& map, Face f, const V_ATT& position);
template<typename PFP, typename V_ATT>
typename V_ATT::DATA_TYPE faceNormal(typename PFP::MAP& map, Dart d, const V_ATT& position) ;
typename V_ATT::DATA_TYPE faceNormal(typename PFP::MAP& map, Face f, const V_ATT& position) ;
template<typename PFP, typename V_ATT>
typename V_ATT::DATA_TYPE vertexNormal(typename PFP::MAP& map, Dart d, const V_ATT& position) ;
typename V_ATT::DATA_TYPE vertexNormal(typename PFP::MAP& map, Vertex v, const V_ATT& position) ;
template<typename PFP, typename V_ATT>
typename V_ATT::DATA_TYPE vertexBorderNormal(typename PFP::MAP& map, Dart d, const V_ATT& position) ;
typename V_ATT::DATA_TYPE vertexBorderNormal(typename PFP::MAP& map, Vertex v, const V_ATT& position) ;
template <typename PFP, typename V_ATT, typename F_ATT>
void computeNormalFaces(typename PFP::MAP& map, const V_ATT& position, F_ATT& face_normal, unsigned int thread = 0) ;
......@@ -79,6 +79,9 @@ void computeNormalVertices(typename PFP::MAP& map, const V_ATT& position, V_ATT&
template <typename PFP, typename V_ATT, typename F_ATT>
void computeNormalFaces(typename PFP::MAP& map, const V_ATT& position, F_ATT& face_normal, unsigned int nbth = 0) ;
template <typename PFP, typename V_ATT, typename E_ATT>
void computeAnglesBetweenNormalsOnEdges(typename PFP::MAP& map, const V_ATT& position, E_ATT& angles, unsigned int nbth = 0) ;
}
......
This diff is collapsed.
......@@ -175,7 +175,7 @@ void ExplodeVolumeRender::updateSmooth(typename PFP::MAP& map, const V_ATT& posi
{
// compute normals
VEC3 centerFace = Algo::Surface::Geometry::faceCentroidELW<PFP>(map, d.dart, positions);
VEC3 centerNormalFace = Algo::Surface::Geometry::newellNormal<PFP>(map,d,positions);
VEC3 centerNormalFace = Algo::Surface::Geometry::newellNormal<PFP>(map, d.dart, positions);
computeFace<PFP>(map,d,positions,centerFace,centerNormalFace,vertices,normals);
......
......@@ -67,9 +67,9 @@ protected:
bool isInsideCollected;
std::vector<Dart> insideVertices;
std::vector<Dart> insideEdges;
std::vector<Dart> insideFaces;
std::vector<Vertex> insideVertices;
std::vector<Edge> insideEdges;
std::vector<Face> insideFaces;
std::vector<Dart> border;
public:
......@@ -105,9 +105,9 @@ public:
inline Dart getCenterDart() const { return centerDart; }
inline const std::vector<Dart>& getInsideVertices() const { assert(isInsideCollected || !"getInsideVertices: inside cells have not been collected.") ; return insideVertices; }
inline const std::vector<Dart>& getInsideEdges() const { assert(isInsideCollected || !"getInsideEdges: inside cells have not been collected.") ; return insideEdges; }
inline const std::vector<Dart>& getInsideFaces() const { assert(isInsideCollected || !"getInsideFaces: inside cells have not been collected.") ; return insideFaces; }
inline const std::vector<Vertex>& getInsideVertices() const { assert(isInsideCollected || !"getInsideVertices: inside cells have not been collected.") ; return insideVertices; }
inline const std::vector<Edge>& getInsideEdges() const { assert(isInsideCollected || !"getInsideEdges: inside cells have not been collected.") ; return insideEdges; }
inline const std::vector<Face>& getInsideFaces() const { assert(isInsideCollected || !"getInsideFaces: inside cells have not been collected.") ; return insideFaces; }
inline const std::vector<Dart>& getBorder() const { return border; }
inline unsigned int getNbInsideVertices() const { assert(isInsideCollected || !"getNbInsideVertices: inside cells have not been collected.") ; return insideVertices.size(); }
......@@ -118,12 +118,19 @@ public:
template <typename PPFP>
friend std::ostream& operator<<(std::ostream &out, const Collector<PPFP>& c);
virtual REAL computeArea (const VertexAttribute<VEC3, MAP_IMPL>& /*pos*/) {
virtual REAL computeArea (const VertexAttribute<VEC3, MAP_IMPL>& /*pos*/)
{
assert(!"Warning: Collector<PFP>::computeArea() should be overloaded in non-virtual derived classes");
return 0.0;
}
virtual void computeNormalCyclesTensor (const VertexAttribute<VEC3, MAP_IMPL>& /*pos*/, const EdgeAttribute<REAL, MAP_IMPL>& /*edgeangle*/, typename PFP::MATRIX33&) {assert(!"Warning: Collector<PFP>::computeNormalCyclesTensor() should be overloaded in non-virtual derived classes"); }
virtual void computeNormalCyclesTensor (const VertexAttribute<VEC3, MAP_IMPL>& /*pos*/, typename PFP::MATRIX33&) {assert(!"Warning: Collector<PFP>::computeNormalCyclesTensor() should be overloaded in non-virtual derived classes"); }