Commit f9dac96f authored by Thomas's avatar Thomas

ajout fctions g-cartes

parent 750381ca
......@@ -167,10 +167,10 @@ void ParticleCell2DAndHalf<PFP>::edgeState(VEC3 current, Geom::Orientation3D sid
faceState(current);
return;
case Geom::OVER:
{
//transform the displacement into the new entered face
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();
VEC3 n = Algo::Geometry::faceNormal<PFP>(m,m.phi2(d),m_positions);
current = m_position+((displ^n)*displ.norm());
......@@ -178,6 +178,7 @@ void ParticleCell2DAndHalf<PFP>::edgeState(VEC3 current, Geom::Orientation3D sid
d = m.phi1(m.phi2(d));
faceState(current);
return;
}
default :
state = EDGE;
}
......@@ -311,12 +312,13 @@ void ParticleCell2DAndHalf<PFP>::faceState(VEC3 current)
default :
if(wsoe == Geom::ON)
{
d = m.phi1(d); //to check
m_position = m_positions[d];
vertexState(current);
std::cout << __FILE__ << " to uncomment and check" << std::endl;
// d = m.phi1(d); //to check
// m_position = m_positions[d];
//
// vertexState(current);
}
else
// else
{
// CGoGNout << "wsoe : " << wsoe << CGoGNendl;
// CGoGNout << "current " << current << " " << m_position << CGoGNendl;
......
......@@ -246,12 +246,28 @@ public:
* 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
/*! @param d a dart
* @param e a dart
*/
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);
/**
......
......@@ -426,6 +426,19 @@ void GMap2::closeMap(DartMarker& marker)
* 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)
{
Dart dNext = d; // Foreach dart dNext in the vertex of d
......@@ -438,6 +451,37 @@ bool GMap2::sameVertex(Dart d, Dart e)
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)
{
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