Commit ea955ff5 authored by Sylvain Thery's avatar Sylvain Thery

Merge cgogn:~cgogn/CGoGN into CGoGN_MT

Conflicts:
	include/Topology/generic/cellmarker.h
	include/Topology/generic/genericmap.hpp
parents 28febb3c 44019bb7
......@@ -165,7 +165,9 @@ void coarsenFace(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position)
unsigned int cur = map.getCurrentLevel() ;
map.setCurrentLevel(cur + 1) ;
map.deleteVertex(map.phi1(map.phi1(d))) ;
Dart cv = map.phi1(map.phi1(d)) ;
map.setCurrentLevel(map.getMaxLevel()) ;
map.deleteVertex(cv) ;
map.setCurrentLevel(cur) ;
Dart fit = d ;
do
......
......@@ -40,6 +40,8 @@ class ParticleCell2D : public ParticleBase
DartMarker& obstacle;
bool changeCell ;
ParticleCell2D() {}
ParticleCell2D(Map& map, Dart belonging_cell, VEC3 pos, TAB_POS tabPos, DartMarker& obst) : ParticleBase(pos), m(map), d(belonging_cell), m_positions(tabPos), obstacle(obst)
......@@ -71,6 +73,7 @@ class ParticleCell2D : public ParticleBase
void move(const VEC3& newCurrent)
{
changeCell = false ;
if(!Geom::arePointsEquals(newCurrent, m_position)) {
prevPos = m_position;
......@@ -88,7 +91,6 @@ class ParticleCell2D : public ParticleBase
};
#include "particle_cell_2D.hpp"
//namespace
}
......
......@@ -69,6 +69,7 @@ void ParticleCell2D<PFP>::vertexState(const VEC3& current)
#endif
assert(std::isfinite(current[0]) && std::isfinite(current[1]) && std::isfinite(current[2]));
changeCell = true;
if(Algo::Geometry::isPointOnVertex<PFP>(m,d,m_positions,current)) {
state = VERTEX_ORBIT;
return;
......@@ -88,23 +89,20 @@ void ParticleCell2D<PFP>::vertexState(const VEC3& current)
if(dd_vert==d) {
//orbit with 2 edges : point on one edge
if(m.alpha1(m.alpha1(d))==d) {
if(!Algo::Geometry::isPointOnHalfEdge<PFP>(m,d,m_positions,current)) {
d = m.alpha1(d);
}
if(!Algo::Geometry::isPointOnHalfEdge<PFP>(m,d,m_positions,current)) {
d = m.alpha1(d);
}
}
else {
state = VERTEX_ORBIT;
state = VERTEX_ORBIT;
return;
}
}
}
else {
std::cout << "ploc" << std::endl;
Dart dd_vert = m.alpha1(d);
while(getOrientationEdge(current,d)==Geom::RIGHT && dd_vert!=d) {
std::cout << "tourne" << std::endl;
d = m.alpha_1(d);
if(m_positions[d][0]==m_positions[m.phi1(d)][0] && m_positions[d][1]==m_positions[m.phi1(d)][1]) {
d=m.alpha_1(d);
}
......@@ -114,7 +112,6 @@ void ParticleCell2D<PFP>::vertexState(const VEC3& current)
//displacement step
// if(!obstacle.isMarked(d)) {
if(getOrientationEdge(current,d)==Geom::ALIGNED && Algo::Geometry::isPointOnHalfEdge<PFP>(m,d,m_positions,current)) {
std::cout << m.vertexDegree(d) << std::endl;
edgeState(current);
}
else {
......@@ -135,6 +132,7 @@ void ParticleCell2D<PFP>::edgeState(const VEC3& current, Geom::Orientation2D sid
assert(std::isfinite(current[0]) && std::isfinite(current[1]) && std::isfinite(current[2]));
// assert(Algo::Geometry::isPointOnEdge<PFP>(m,d,m_positions,m_position));
changeCell = true;
if(sideOfEdge==Geom::ALIGNED)
sideOfEdge = getOrientationEdge(current,d);
......
......@@ -33,6 +33,10 @@ namespace CGoGN
class AttribMap : public GenericMap
{
friend class CellMarker ;
friend class CellMarkerStore ;
friend class CellMarkerNoUnmark ;
template<typename T> friend class AutoAttributeHandler ;
public:
......
......@@ -26,7 +26,7 @@
#define __CELL_MARKER__
#include "Topology/generic/marker.h"
#include "Topology/generic/genericmap.h"
#include "Topology/generic/attribmap.h"
#define VERTEX_CELL VERTEX_ORBIT
#define EDGE_CELL EDGE_ORBIT
......@@ -45,8 +45,9 @@ class CellMarker
{
protected:
Marker m_marker;
GenericMap& m_map;
AttribMap& m_map;
unsigned int m_thread;
public:
/**
* constructor
......@@ -54,12 +55,15 @@ public:
* @param cell the type of cell we want to mark VERTEX_CELL, EDGE_CELL,...
* \pre the cell is embedded in the map
*/
CellMarker(GenericMap& map, unsigned int cell): m_map(map), m_thread(0)
CellMarker(AttribMap& map, unsigned int cell): m_map(map), m_thread(0)
{
if(!map.isOrbitEmbedded(cell))
map.addEmbedding(cell) ;
m_marker = map.getNewMarker(cell);
}
CellMarker(GenericMap& map, unsigned int cell, unsigned int thread): m_map(map), m_thread(thread)
CellMarker(AttribMap& map, unsigned int cell, unsigned int thread): m_map(map), m_thread(thread)
{
m_marker = map.getNewMarker(cell,thread);
}
......@@ -173,10 +177,10 @@ public:
* @param cell the type of cell we want to mark VERTEX_CELL, EDGE_CELL,...
* \pre the cell is embedded in the map
*/
CellMarkerStore(GenericMap& map, unsigned int cell): CellMarker(map, cell)
CellMarkerStore(AttribMap& map, unsigned int cell): CellMarker(map, cell)
{}
CellMarkerStore(GenericMap& map, unsigned int cell, unsigned int thread): CellMarker(map, cell,thread)
CellMarkerStore(AttribMap& map, unsigned int cell, unsigned int thread): CellMarker(map, cell,thread)
{}
protected:
......@@ -226,11 +230,11 @@ public:
* @param cell the type of cell we want to mark VERTEX_CELL, EDGE_CELL,...
* \pre the cell is embedded in the map
*/
CellMarkerNoUnmark(GenericMap& map, unsigned int cell): CellMarker(map, cell)
CellMarkerNoUnmark(AttribMap& map, unsigned int cell): CellMarker(map, cell)
{}
CellMarkerNoUnmark(GenericMap& map, unsigned int cell, unsigned int thread): CellMarker(map, cell,thread)
CellMarkerNoUnmark(AttribMap& map, unsigned int cell, unsigned int thread): CellMarker(map, cell,thread)
{}
~CellMarkerNoUnmark()
......
......@@ -186,7 +186,7 @@ bool EmbeddedMap2<MAP2>::edgeCanCollapse(Dart d)
template <typename MAP2>
void EmbeddedMap2<MAP2>::collapseEdge(Dart d, bool delDegenerateFaces)
{
Dart dPrev = MAP2::phi_1(d) ;
Dart dPrev2 = MAP2::phi2(MAP2::phi_1(d)) ;
unsigned int vEmb = EMBNULL ;
if (MAP2::isOrbitEmbedded(VERTEX_ORBIT))
......@@ -198,9 +198,7 @@ void EmbeddedMap2<MAP2>::collapseEdge(Dart d, bool delDegenerateFaces)
if (MAP2::isOrbitEmbedded(VERTEX_ORBIT))
{
Dart dPrev2 = MAP2::phi2(dPrev) ;
if(dPrev2 != dPrev)
MAP2::embedOrbit(VERTEX_ORBIT, dPrev2, vEmb) ;
MAP2::embedOrbit(VERTEX_ORBIT, dPrev2, vEmb) ;
}
}
......
......@@ -76,10 +76,6 @@ class GenericMap : public MapBrowser
friend class DartMarkerStore ;
friend class DartMarkerNoUnmark ;
friend class CellMarker ;
friend class CellMarkerStore ;
friend class CellMarkerNoUnmark ;
template<typename T> friend class AutoAttributeHandler ;
protected:
......
......@@ -243,7 +243,6 @@ inline AttribMultiVectGen& GenericMap::getMultiVec(unsigned int idAttr)
inline AttribContainer& GenericMap::getAttributeContainer(unsigned int orbit)
{
// assert(isOrbitEmbedded(orbit) || !"Invalid parameter: orbit not embedded");
return m_attribs[orbit] ;
}
......@@ -253,7 +252,8 @@ inline AttribContainer& GenericMap::getAttributeContainer(unsigned int orbit)
inline Marker GenericMap::getNewMarker(unsigned int cell, unsigned int thread)
{
assert(isOrbitEmbedded(cell) || !"Try to get a marker on non embedded cell! ") ;
// assert(isOrbitEmbedded(cell) || !"Try to get a marker on non embedded cell! ") ;
return m_orbMarker[cell][thread].getNewMarker(cell) ;
}
......
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