Commit f9dac96f authored by Thomas's avatar Thomas
Browse files

ajout fctions g-cartes

parent 750381ca
...@@ -167,10 +167,10 @@ void ParticleCell2DAndHalf<PFP>::edgeState(VEC3 current, Geom::Orientation3D sid ...@@ -167,10 +167,10 @@ void ParticleCell2DAndHalf<PFP>::edgeState(VEC3 current, Geom::Orientation3D sid
faceState(current); faceState(current);
return; return;
case Geom::OVER: case Geom::OVER:
{
//transform the displacement into the new entered face //transform the displacement into the new entered face
VEC3 displ = current-m_position; VEC3 displ = current-m_position;
VEC3 edge = Algo::Geom::vectorOutOfDart<PFP>(m,m.phi2(d),m_positions); VEC3 edge = Algo::Geometry::vectorOutOfDart<PFP>(m,m.phi2(d),m_positions);
edge.normalize(); edge.normalize();
VEC3 n = Algo::Geometry::faceNormal<PFP>(m,m.phi2(d),m_positions); VEC3 n = Algo::Geometry::faceNormal<PFP>(m,m.phi2(d),m_positions);
current = m_position+((displ^n)*displ.norm()); current = m_position+((displ^n)*displ.norm());
...@@ -178,6 +178,7 @@ void ParticleCell2DAndHalf<PFP>::edgeState(VEC3 current, Geom::Orientation3D sid ...@@ -178,6 +178,7 @@ void ParticleCell2DAndHalf<PFP>::edgeState(VEC3 current, Geom::Orientation3D sid
d = m.phi1(m.phi2(d)); d = m.phi1(m.phi2(d));
faceState(current); faceState(current);
return; return;
}
default : default :
state = EDGE; state = EDGE;
} }
...@@ -311,12 +312,13 @@ void ParticleCell2DAndHalf<PFP>::faceState(VEC3 current) ...@@ -311,12 +312,13 @@ void ParticleCell2DAndHalf<PFP>::faceState(VEC3 current)
default : default :
if(wsoe == Geom::ON) if(wsoe == Geom::ON)
{ {
d = m.phi1(d); //to check std::cout << __FILE__ << " to uncomment and check" << std::endl;
m_position = m_positions[d]; // d = m.phi1(d); //to check
// m_position = m_positions[d];
vertexState(current); //
// vertexState(current);
} }
else // else
{ {
// CGoGNout << "wsoe : " << wsoe << CGoGNendl; // CGoGNout << "wsoe : " << wsoe << CGoGNendl;
// CGoGNout << "current " << current << " " << m_position << CGoGNendl; // CGoGNout << "current " << current << " " << m_position << CGoGNendl;
......
...@@ -246,12 +246,28 @@ public: ...@@ -246,12 +246,28 @@ public:
* Return or set various topological information * Return or set various topological information
*************************************************************************/ *************************************************************************/
//! Test if dart d and e belong to the same oriented vertex
/*! @param d a dart
* @param e a dart
*/
bool sameOrientedVertex(Dart d, Dart e);
//! Test if dart d and e belong to the same vertex //! Test if dart d and e belong to the same vertex
/*! @param d a dart /*! @param d a dart
* @param e a dart * @param e a dart
*/ */
bool sameVertex(Dart d, Dart e); bool sameVertex(Dart d, Dart e);
//! Test if dart d and e belong to the same oriented volume
/*! @param d a dart
* @param e a dart
*/
bool sameOrientedVolume(Dart d, Dart e);
//! Test if dart d and e belong to the same volume
/*! @param d a dart
* @param e a dart
*/
bool sameVolume(Dart d, Dart e); bool sameVolume(Dart d, Dart e);
/** /**
......
...@@ -426,6 +426,19 @@ void GMap2::closeMap(DartMarker& marker) ...@@ -426,6 +426,19 @@ void GMap2::closeMap(DartMarker& marker)
* Return or set various topological information * Return or set various topological information
*************************************************************************/ *************************************************************************/
bool GMap2::sameOrientedVertex(Dart d, Dart e)
{
Dart dNext = d; // Foreach dart dNext in the vertex of d
do
{
if (dNext == e) // Test equality with e
return true;
dNext = alpha1(dNext);
} while (dNext != d);
return false; // None is equal to e => vertices are distinct
}
bool GMap2::sameVertex(Dart d, Dart e) bool GMap2::sameVertex(Dart d, Dart e)
{ {
Dart dNext = d; // Foreach dart dNext in the vertex of d Dart dNext = d; // Foreach dart dNext in the vertex of d
...@@ -438,6 +451,37 @@ bool GMap2::sameVertex(Dart d, Dart e) ...@@ -438,6 +451,37 @@ bool GMap2::sameVertex(Dart d, Dart e)
return false; // None is equal to e => vertices are distinct return false; // None is equal to e => vertices are distinct
} }
bool GMap2::sameOrientedVolume(Dart d, Dart e)
{
DartMarkerStore mark(*this); // Lock a marker
bool found = false; // Last functor return value
std::list<Dart> visitedFaces; // Faces that are traversed
visitedFaces.push_back(d); // Start with the face of d
std::list<Dart>::iterator face;
// For every face added to the list
for (face = visitedFaces.begin(); !found && face != visitedFaces.end(); ++face)
{
if (!mark.isMarked(*face)) // Face has not been visited yet
{
Dart dNext = *face ;
do
{
if(dNext==e)
return true;
mark.mark(dNext); // Mark
Dart adj = phi2(dNext); // Get adjacent face
if (adj != dNext && !mark.isMarked(adj))
visitedFaces.push_back(adj); // Add it
dNext = phi1(dNext);
} while(dNext != *face);
}
}
return false;
}
bool GMap2::sameVolume(Dart d, Dart e) bool GMap2::sameVolume(Dart d, Dart e)
{ {
DartMarkerStore mark(*this); // Lock a marker DartMarkerStore mark(*this); // Lock a marker
......
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