Commit 4883f7a5 authored by Sylvain Thery's avatar Sylvain Thery

Merge cgogn:~jund/CGoGN

Conflicts:
	Apps/Tuto/tuto5.cpp
	README.TXT
parents 5c96e88a bfd7705b
......@@ -6,12 +6,7 @@ cmake libXi-dev libXmu-dev libglew-dev libxml2-dev libboost-all-dev zlib1g-dev q
Pour compiler CGoGN:
- on compile d'abord les bibliothèques annexes :
cd CGoGN/ThirdParty/build
cmake ..
make (-j x si vous avez x cores)
make install
- aller dans ThirdParty, cd build, taper "cmake .", puis make ( avec -j x si vous avez x core sur votre machine) suivi de make install
On peut fixer certaines option pour ne pas tout compiler (cf le README.TXT dans ThirdParty)
......@@ -54,7 +49,6 @@ install the following packages:
ccmake libXi-dev libXmu-dev libglew-dev libxml2-dev libboost-all-dev zlib1g-dev qt4-designer qt4-dev-tools uuid-dev libgsl0-dev libsuitesparse-dev
To compile CGoGN:
- first compile third-party libraries:
cd CGoGN/ThirdParty/build
......
......@@ -33,6 +33,7 @@ find_package(ZLIB REQUIRED)
find_package(LibXml2 REQUIRED)
find_package(GLEW REQUIRED)
find_package(SuiteSparse REQUIRED)
find_package(QGLViewer REQUIRED)
IF (DEFINED ASSERTON)
add_definitions(-DCGOGN_ASSERT_BOOL=${ASSERTON})
......@@ -63,6 +64,7 @@ SET (COMMON_LIBS
${Boost_REGEX_LIBRARY}
${Boost_THREAD_LIBRARY}
${SUITESPARSE_LIBRARIES}
${QGLVIEWER_LIBRARIES}
)
#optionnal libs
......
......@@ -133,14 +133,13 @@ bool isPointInConvexVolume(typename PFP::MAP& map, Dart d, const VertexAttribute
typedef typename PFP::VEC3 VEC3 ;
typedef typename PFP::REAL REAL;
bool inside = true;
std::list<Dart> visitedFaces; // Faces that are traversed
visitedFaces.push_back(d); // Start with the face of d
std::list<Dart>::iterator face;
VEC3 N;
DartMarkerStore mark(map); // Lock a marker
for (face = visitedFaces.begin(); inside && face != visitedFaces.end(); ++face)
for (face = visitedFaces.begin(); face != visitedFaces.end(); ++face)
{
if (!mark.isMarked(*face))
{
......@@ -149,10 +148,10 @@ bool isPointInConvexVolume(typename PFP::MAP& map, Dart d, const VertexAttribute
if(CCW)
{
if(o3d == Geom::OVER)
inside = false;
return false;
}
else if(o3d == Geom::UNDER)
inside = false;
return false;
Dart dNext = *face ;
do
......@@ -166,8 +165,7 @@ bool isPointInConvexVolume(typename PFP::MAP& map, Dart d, const VertexAttribute
}
}
//if the point is in the volume there is an odd number of intersection with all faces with any direction
return inside;
return true;
}
template <typename PFP>
......@@ -176,8 +174,6 @@ bool isPointInConvexFace(typename PFP::MAP& map, Dart d, const VertexAttribute<t
typedef typename PFP::VEC3 VEC3 ;
typedef typename PFP::REAL REAL;
bool inside = true;
Geom::Plane3D<REAL> pl = Geometry::facePlane<PFP>(map, d, position);
Geom::Orientation3D o3d = pl.orient(point);
if(o3d == Geom::ON)
......@@ -193,12 +189,12 @@ bool isPointInConvexFace(typename PFP::MAP& map, Dart d, const VertexAttribute<t
if(CCW)
{
if(o3d == Geom::UNDER)
inside = false;
return false;
}
else if(o3d == Geom::OVER)
inside = false;
return false;
}
return inside;
return true;
}
return false;
......@@ -212,7 +208,6 @@ bool isPointInConvexFace2D(typename PFP::MAP& map, Dart d, const VertexAttribute
// CGoGNout << "point " << point << "d " << d << "faceDeg " << map.faceDegree(d) << CGoGNendl;
bool convex=true;
Geom::Orientation2D o2d;
Traversor2FV<typename PFP::MAP> tfv(map, d) ;
......@@ -222,13 +217,13 @@ bool isPointInConvexFace2D(typename PFP::MAP& map, Dart d, const VertexAttribute
if(CCW)
{
if(o2d == Geom::RIGHT)
convex= false;
return false;
}
else if(o2d == Geom::LEFT)
return false;
}
return convex;
return true;
}
template <typename PFP>
......
......@@ -105,8 +105,12 @@ template <typename PFP>
void LoopSubdivision(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position) ;
/**
* Cut 1 face of degree n in 2n+1 faces (cut 2 times each edge and "insert" a face in the middle)
* @param size indicates where to cut edges, its value must stay between 0 and 0.5 excluded
*/
template <typename PFP, typename EMBV, typename EMB>
void TwoNPlusOneSubdivision(typename PFP::MAP& map, EMBV& attributs) ;
void TwoNPlusOneSubdivision(typename PFP::MAP& map, EMBV& attributs, float size=1.0f/3.0f) ;
/**
* Doo-Sabin subdivision scheme
......
......@@ -22,6 +22,7 @@
* *
*******************************************************************************/
#include "Algo/Geometry/basic.h"
#include "Algo/Geometry/centroid.h"
#include "Topology/generic/autoAttributeHandler.h"
......@@ -450,16 +451,13 @@ void LoopSubdivision(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>
}
template <typename PFP, typename EMBV, typename EMB>
void TwoNPlusOneSubdivision(typename PFP::MAP& map, EMBV& attributs)
void TwoNPlusOneSubdivision(typename PFP::MAP& map, EMBV& attributs, float size)
{
CellMarker<EDGE> m0(map);
CellMarker<FACE> m1(map);
std::vector<Dart> dOrig;
m0.unmarkAll();
m1.unmarkAll();
//first pass cut edge
for (Dart d = map.begin(); d != map.end(); map.next(d))
{
......@@ -481,9 +479,9 @@ void TwoNPlusOneSubdivision(typename PFP::MAP& map, EMBV& attributs)
EMB e1 = attributs[d];
EMB e2 = attributs[map.phi1(d)];
map.cutEdge(d);
attributs[map.phi1(d)] = e1*2.0f/3.0f+e2/3.0f;
attributs[map.phi1(d)] = e1*(1.0f-size)+e2*size;
map.cutEdge(map.phi1(d));
attributs[map.phi1(map.phi1(d))] = e2*2.0f/3.0f+e1/3.0f;
attributs[map.phi1(map.phi1(d))] = e2*(1.0f-size)+e1*size;
m0.mark(d);
m0.mark(map.phi1(d));
m0.mark(map.template phi<11>(d));
......@@ -496,14 +494,16 @@ void TwoNPlusOneSubdivision(typename PFP::MAP& map, EMBV& attributs)
// //second pass create corner face
for (std::vector<Dart>::iterator it = dOrig.begin(); it != dOrig.end(); ++it)
{
EMB c = Geometry::faceCentroid<PFP>(map,*it,attributs);
// EMB c = Geometry::faceCentroid<PFP>(map,*it,attributs);
Dart dd = *it;
do
{
map.splitFace(map.phi1(dd),map.phi_1(dd));
map.cutEdge(map.phi1(dd));
mCorner.mark(map.phi2(map.phi1(dd)));
attributs[map.template phi<11>(dd)] = c*2.0/3.0f + attributs[dd]/3.0f;
// attributs[map.template phi<11>(dd)] = c*(1.0-size)+ attributs[dd]*size;
attributs[map.template phi<11>(dd)] = attributs[dd] + Geometry::vectorOutOfDart<PFP>(map,dd,attributs)
- Geometry::vectorOutOfDart<PFP>(map,map.phi_1(dd),attributs);
dd = map.phi1(map.phi1(map.phi1(map.phi2(map.phi1(dd)))));
} while(!mCorner.isMarked(dd));
}
......
......@@ -33,9 +33,6 @@ namespace CGoGN
namespace Algo
{
namespace Surface
{
namespace MovingObjects
{
......@@ -82,8 +79,6 @@ public:
} // namespace Algo
}
} // namespace CGoGN
#endif
......@@ -23,13 +23,15 @@ namespace Surface
namespace MovingObjects
{
#ifndef PARTCELL25D_H
enum
{
NO_CROSS, CROSS_EDGE, CROSS_OTHER
} ;
#endif
template <typename PFP>
class ParticleCell2D : public ParticleBase<PFP>
class ParticleCell2D : public Algo::MovingObjects::ParticleBase<PFP>
{
public:
typedef typename PFP::MAP MAP ;
......@@ -110,10 +112,10 @@ public:
}
} ;
}
}
}
}
} //MovingObjects
} //Surface
} //Algo
} //CGoGN
#include "particle_cell_2D.hpp"
......
......@@ -193,7 +193,8 @@ void ParticleCell2D<PFP>::edgeState(const VEC3& goal, Geom::Orientation2D sideOf
else
crossCell = CROSS_OTHER ;
if (sideOfEdge == Geom::ALIGNED) sideOfEdge = getOrientationEdge(goal, d) ;
if (sideOfEdge == Geom::ALIGNED)
sideOfEdge = getOrientationEdge(goal, d) ;
switch (sideOfEdge)
{
......
......@@ -41,7 +41,6 @@ std::vector<Dart> ParticleCell2DMemo<PFP>::move(const VEC3& goal)
if (!Geom::arePointsEquals(goal, this->getPosition()))
{
CellMarkerMemo<FACE> memo_cross(this->m);
memo_cross.mark(this->d);
switch (this->getState())
{
......@@ -55,7 +54,6 @@ std::vector<Dart> ParticleCell2DMemo<PFP>::move(const VEC3& goal)
faceState(goal,memo_cross) ;
break ;
}
return memo_cross.get_markedCells();
}
else
......@@ -69,9 +67,30 @@ std::vector<Dart> ParticleCell2DMemo<PFP>::move(const VEC3& goal)
template <typename PFP>
std::vector<Dart> ParticleCell2DMemo<PFP>::move(const VEC3& goal, CellMarkerMemo<FACE>& memo_cross)
{
memo_cross.mark(this->d);
this->move(goal,memo_cross);
return memo_cross.get_markedCells();
this->crossCell = NO_CROSS ;
if (!Geom::arePointsEquals(goal, this->getPosition()))
{
switch (this->getState())
{
case VERTEX :
vertexState(goal,memo_cross) ;
break ;
case EDGE :
edgeState(goal,memo_cross) ;
break ;
case FACE :
faceState(goal,memo_cross) ;
break ;
}
return memo_cross.get_markedCells();
}
else
this->Algo::MovingObjects::ParticleBase<PFP>::move(goal) ;
std::vector<Dart> res;
res.push_back(this->d);
return res;
}
template <typename PFP>
......
......@@ -58,7 +58,7 @@ std::vector<Dart> ParticleCell2DSecured<PFP>::move(const VEC3& goal)
return memo_cross.get_markedCells();
}
else
this->ParticleBase<PFP>::move(goal) ;
this->Algo::MovingObjects::ParticleBase<PFP>::move(goal) ;
std::vector<Dart> res;
res.push_back(this->d);
......@@ -86,7 +86,7 @@ void ParticleCell2DSecured<PFP>::vertexState(const VEC3& current, CellMarkerMemo
if (Geometry::isPointOnVertex < PFP > (this->m, this->d, this->positionAttribut, current))
{
this->setState(VERTEX) ;
this->ParticleBase<PFP>::move(current) ;
this->Algo::MovingObjects::ParticleBase<PFP>::move(current) ;
return ;
}
else
......@@ -130,7 +130,7 @@ void ParticleCell2DSecured<PFP>::vertexState(const VEC3& current, CellMarkerMemo
this->d = this->m.phi2_1(this->d) ;
} while (this->getOrientationEdge(current, this->m.phi2_1(this->d)) != Geom::RIGHT && dd_vert != this->d) ;
this->ParticleBase<PFP>::move(current) ;
this->Algo::MovingObjects::ParticleBase<PFP>::move(current) ;
this->setState(VERTEX) ;
return ;
}
......@@ -207,7 +207,7 @@ void ParticleCell2DSecured<PFP>::edgeState(const VEC3& current, CellMarkerMemo<F
if (!Geometry::isPointOnHalfEdge < PFP
> (this->m, this->d, this->positionAttribut, current))
{
this->ParticleBase<PFP>::move(this->positionAttribut[this->d]) ;
this->Algo::MovingObjects::ParticleBase<PFP>::move(this->positionAttribut[this->d]) ;
vertexState(current,memo_cross) ;
return ;
}
......@@ -215,12 +215,12 @@ void ParticleCell2DSecured<PFP>::edgeState(const VEC3& current, CellMarkerMemo<F
> (this->m, this->m.phi2(this->d), this->positionAttribut, current))
{
this->d = this->m.phi2(this->d) ;
this->ParticleBase<PFP>::move(this->positionAttribut[this->d]) ;
this->Algo::MovingObjects::ParticleBase<PFP>::move(this->positionAttribut[this->d]) ;
vertexState(current,memo_cross) ;
return ;
}
this->ParticleBase<PFP>::move(current) ;
this->Algo::MovingObjects::ParticleBase<PFP>::move(current) ;
}
}
......
#ifndef PARTCELL_H
#define PARTCELL_H
#ifndef PARTCELL25D_H
#define PARTCELL25D_H
#include "Algo/MovingObjects/particle_base.h"
......@@ -24,15 +24,17 @@ namespace Surface
namespace MovingObjects
{
#ifndef PARTCELL_H
enum
{
NO_CROSS,
CROSS_EDGE,
CROSS_OTHER
};
#endif
template <typename PFP>
class ParticleCell2DAndHalf : public MovingObjects::ParticleBase
class ParticleCell2DAndHalf : public Algo::MovingObjects::ParticleBase<PFP>
{
public :
typedef typename PFP::MAP Map;
......@@ -56,7 +58,7 @@ public :
{}
ParticleCell2DAndHalf(Map& map, Dart belonging_cell, VEC3 pos, const TAB_POS& tabPos) :
ParticleBase(pos), m(map), m_positions(tabPos), d(belonging_cell), lastCrossed(belonging_cell), state(FACE), crossCell(NO_CROSS), distance(0)
Algo::MovingObjects::ParticleBase<PFP>(pos), m(map), m_positions(tabPos), d(belonging_cell), lastCrossed(belonging_cell), state(FACE), crossCell(NO_CROSS), distance(0)
{}
Dart getCell() { return d; }
......@@ -88,7 +90,7 @@ public :
{
distance = 0 ;
crossCell = NO_CROSS ;
if(!Geom::arePointsEquals(newCurrent, m_position))
if(!Geom::arePointsEquals(newCurrent, this->getPosition()))
{
switch(state) {
case VERTEX : vertexState(newCurrent); break;
......@@ -99,7 +101,7 @@ public :
// display();
}
else
m_position = newCurrent;
this->Algo::MovingObjects::ParticleBase<PFP>::move(newCurrent);
}
};
......
......@@ -114,14 +114,14 @@ void ParticleCell2DAndHalf<PFP>::vertexState(VEC3 goal)
#ifdef DEBUG
CGoGNout << "vertexState" << d << CGoGNendl;
#endif
assert(gola.isfinite()) ;
assert(goal.isFinite()) ;
crossCell = CROSS_OTHER;
if(Geometry::isPointOnVertex<PFP>(m,d,m_positions,goal))
{
state = VERTEX;
m_position = goal;
this->Algo::MovingObjects::ParticleBase<PFP>::move(goal) ;
return;
}
else
......@@ -129,7 +129,7 @@ void ParticleCell2DAndHalf<PFP>::vertexState(VEC3 goal)
//orientation step
if(m_positions[d][0] == m_positions[m.phi1(d)][0] && m_positions[d][1] == m_positions[m.phi1(d)][1])
d = m.phi2_1(d);
if(getOrientationEdge(current,m.phi2_1(d)) != Geom::UNDER)
if(getOrientationEdge(this->getPosition(),m.phi2_1(d)) != Geom::UNDER)
{
Dart dd_vert = d;
do
......@@ -137,19 +137,21 @@ void ParticleCell2DAndHalf<PFP>::vertexState(VEC3 goal)
d = m.phi2_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.phi2_1(d);
} while(getOrientationEdge(current, m.phi2_1(d)) != Geom::UNDER && dd_vert != d);
// } while(getOrientationEdge(current, m.phi2_1(d)) != Geom::UNDER && dd_vert != d);
} while(getOrientationEdge(goal, m.phi2_1(d)) != Geom::UNDER && dd_vert != d);
if(dd_vert == d)
{
//orbit with 2 edges : point on one edge
if(m.phi2_1(m.phi2_1(d)) == d)
{
if(!Geometry::isPointOnHalfEdge<PFP>(m,d,m_positions,current))
if(!Geometry::isPointOnHalfEdge<PFP>(m,d,m_positions,goal))
// if(!Geometry::isPointOnHalfEdge<PFP>(m,d,m_positions,current))
d = m.phi2_1(d);
}
else
{
m_position = goal;
this->Algo::MovingObjects::ParticleBase<PFP>::move(goal);
state = VERTEX;
return;
}
......@@ -158,7 +160,8 @@ void ParticleCell2DAndHalf<PFP>::vertexState(VEC3 goal)
else
{
Dart dd_vert = m.phi2_1(d);
while(getOrientationEdge(current, d) == Geom::OVER && dd_vert != d)
while(getOrientationEdge(goal, d) == Geom::OVER && dd_vert != d)
// while(getOrientationEdge(current, d) == Geom::OVER && dd_vert != d)
{
d = m.phi12(d);
if(m_positions[d][0] == m_positions[m.phi1(d)][0] && m_positions[d][1] == m_positions[m.phi1(d)][1])
......@@ -184,7 +187,7 @@ void ParticleCell2DAndHalf<PFP>::edgeState(VEC3 goal, Geom::Orientation3D sideOf
CGoGNout << "edgeState" << d << CGoGNendl;
#endif
assert(goal.isfinite()) ;
assert(goal.isFinite()) ;
// assert(Geometry::isPointOnEdge<PFP>(m,d,m_positions,m_position));
if(crossCell == NO_CROSS)
......@@ -210,7 +213,7 @@ void ParticleCell2DAndHalf<PFP>::edgeState(VEC3 goal, Geom::Orientation3D sideOf
case Geom::OVER:
{
//transform the displacement into the new entered face
VEC3 displ = goal - m_position;
VEC3 displ = goal - this->getPosition();
VEC3 n1 = Geometry::faceNormal<PFP>(m, d, m_positions);
VEC3 n2 = Geometry::faceNormal<PFP>(m, m.phi2(d), m_positions);
......@@ -219,7 +222,7 @@ void ParticleCell2DAndHalf<PFP>::edgeState(VEC3 goal, Geom::Orientation3D sideOf
float angle = Geom::angle(n1, n2) ;
displ = Geom::rotate(axis, angle, displ) ;
goal = m_position + displ;
goal = this->getPosition() + displ;
d = m.phi1(m.phi2(d));
faceState(goal);
......@@ -232,19 +235,19 @@ void ParticleCell2DAndHalf<PFP>::edgeState(VEC3 goal, Geom::Orientation3D sideOf
if(!Geometry::isPointOnHalfEdge<PFP>(m, d, m_positions, goal))
{
m_position = m_positions[d];
this->Algo::MovingObjects::ParticleBase<PFP>::move(m_positions[d]) ;
vertexState(goal);
return;
}
else if(!Geometry::isPointOnHalfEdge<PFP>(m, m.phi2(d), m_positions, goal))
{
d = m.phi2(d);
m_position = m_positions[d];
this->Algo::MovingObjects::ParticleBase<PFP>::move(m_positions[d]) ;
vertexState(goal);
return;
}
m_position = goal;
this->Algo::MovingObjects::ParticleBase<PFP>::move(goal);
}
template <typename PFP>
......@@ -254,32 +257,31 @@ void ParticleCell2DAndHalf<PFP>::faceState(VEC3 goal)
CGoGNout << "faceState" << d << CGoGNendl;
#endif
assert(goal.isfinite()) ;
assert(goal.isFinite()) ;
assert(this->getPosition().isFinite()) ;
// assert(Geometry::isPointInConvexFace2D<PFP>(m,d,m_positions,m_position,true));
//project goal within face plane
VEC3 n1 = Geometry::faceNormal<PFP>(m,d,m_positions);
VEC3 n2 = current - m_position;
VEC3 n2 = goal - this->getPosition();
// n1.normalize();
VEC3 n3 = n1 ^ n2;
n3.normalize();
VEC3 n4 = n3 ^ n1;
current = m_position + (n2 * n4) * n4;
goal = this->getPosition() + (n2 * n4) * n4;
//track new position within map
Dart dd = d;
float wsoe = getOrientationFace(goal, m_position, m.phi1(d));
float wsoe = getOrientationFace(goal, this->getPosition(), m.phi1(d));
// orientation step
if(wsoe != Geom::UNDER)
{
d = m.phi1(d);
wsoe = getOrientationFace(goal, m_position, m.phi1(d));
wsoe = getOrientationFace(goal, this->getPosition(), m.phi1(d));
while(wsoe != Geom::UNDER && dd != d)
{
d = m.phi1(d);
wsoe = getOrientationFace(goal, m_position, m.phi1(d));
wsoe = getOrientationFace(goal, this->getPosition(), m.phi1(d));
}
// source and position to reach are the same : verify if no edge is crossed due to numerical approximation
......@@ -291,20 +293,22 @@ void ParticleCell2DAndHalf<PFP>::faceState(VEC3 goal)
{
case Geom::UNDER: d = m.phi1(d);
break;
case Geom::ON: m_position = current;
// case Geom::ON: this->Algo::MovingObjects::ParticleBase<PFP>::move(current) ;
case Geom::ON: this->Algo::MovingObjects::ParticleBase<PFP>::move(goal) ;
edgeState(goal);
return;
case Geom::OVER:
// CGoGNout << "smthg went bad " << m_position << " " << goal << CGoGNendl;
// CGoGNout << "d1 " << m_positions[d] << " d2 " << m_positions[m.phi1(d)] << CGoGNendl;
m_position = intersectLineEdge(current, m_position, d);
// this->Algo::MovingObjects::ParticleBase<PFP>::move(intersectLineEdge(current, this->getPosition(), d));
this->Algo::MovingObjects::ParticleBase<PFP>::move(intersectLineEdge(goal, this->getPosition(), d));
// CGoGNout << " " << m_position << CGoGNendl;
edgeState(current,Geom::OVER);
edgeState(goal,Geom::OVER);
return;
}
} while(d != dd);
m_position = goal;
this->Algo::MovingObjects::ParticleBase<PFP>::move(goal);
state = FACE;
// m_position = Geometry::faceCentroid<PFP>(m,d,m_positions);
......@@ -317,15 +321,16 @@ void ParticleCell2DAndHalf<PFP>::faceState(VEC3 goal)
return;
}
// take the orientation with d1 : in case we are going through a vertex
wsoe = getOrientationFace(current, m_position, d);
// wsoe = getOrientationFace(current, this->getPosition(), d);
wsoe = getOrientationFace(goal, this->getPosition(), d);
}
else
{
wsoe = getOrientationFace(goal,m_position,d);
wsoe = getOrientationFace(goal,this->getPosition(),d);
while(wsoe == Geom::UNDER && m.phi_1(d) != dd)
{
d = m.phi_1(d);
wsoe = getOrientationFace(goal, m_position, d);
wsoe = getOrientationFace(goal, this->getPosition(), d);
}
// in case of numerical incoherence
......@@ -341,19 +346,21 @@ void ParticleCell2DAndHalf<PFP>::faceState(VEC3 goal)
break;
case Geom::ON :
// CGoGNout << "pic" << CGoGNendl;
m_position = goal;
this->Algo::MovingObjects::ParticleBase<PFP>::move(goal) ;
edgeState(goal);
return;
case Geom::OVER:
// CGoGNout << "smthg went bad(2) " << m_position << CGoGNendl;
m_position = intersectLineEdge(goal, m_position, d);
this->Algo::MovingObjects::ParticleBase<PFP>::move(intersectLineEdge(goal, this->getPosition(), d)) ;
// CGoGNout << " " << m_position << CGoGNendl;
edgeState(current, Geom::OVER);
// edgeState(current, Geom::OVER);
edgeState(goal, Geom::OVER);
return;
}
} while(d != dd);
m_position = goal;
this->Algo::MovingObjects::ParticleBase<PFP>::move(goal);
state = FACE;
return;
}
......@@ -363,8 +370,8 @@ void ParticleCell2DAndHalf<PFP>::faceState(VEC3 goal)
switch (getOrientationEdge(goal, d))
{
case Geom::UNDER :
distance += (goal - m_position).norm();
m_position = goal;
distance += (goal - this->getPosition()).norm();
this->Algo::MovingObjects::ParticleBase<PFP>::move(goal);
state = FACE;
break;
default :
......@@ -381,9 +388,10 @@ void ParticleCell2DAndHalf<PFP>::faceState(VEC3 goal)
// CGoGNout << "wsoe : " << wsoe << CGoGNendl;
// CGoGNout << "current " << current << " " << m_position << CGoGNendl;
// CGoGNout << "d " << d << "d1 " << m_positions[d] << " d2 " << m_positions[m.phi2(d)] << CGoGNendl;
VEC3 isect = intersectLineEdge(current, m_position, d);
distance += (isect - m_position).norm();
m_position = isect;
// VEC3 isect = intersectLineEdge(current, this->getPosition(), d);
VEC3 isect = intersectLineEdge(goal, this->getPosition(), d);
distance += (isect - this->getPosition()).norm();
this->Algo::MovingObjects::ParticleBase<PFP>::move(isect);
// CGoGNout << " inter : " << m_position << CGoGNendl;
edgeState(goal, Geom::OVER);
}
......
......@@ -32,24 +32,26 @@ class ParticleCell2DAndHalfMemo : public ParticleCell2DAndHalf<PFP>
typedef typename PFP::VEC3 VEC3;
typedef VertexAttribute<typename PFP::VEC3> TAB_POS;
std::list<Dart> memo_cross;
bool detect_vertex;