Commit 6b80a81e authored by Sylvain Thery's avatar Sylvain Thery

add checkXXXDegree functions (more efficient than XXXDegree == deg)

parent 56927cbd
......@@ -180,6 +180,13 @@ public:
*/
unsigned int cycleDegree(Dart d);
//! Check the Length of a cycle (its number of oriented edges)
/*! @param d a dart of the cycle
* @param le the length to compare
* @return negative/null/positive if face degree is less/equal/greater than given degree
*/
int checkCycleDegree(Dart d, unsigned int le) ;
/**
* check if the face of d is a triangle
* @return a boolean indicating if the face is a triangle
......
......@@ -286,6 +286,20 @@ inline unsigned int GMap1::cycleDegree(Dart d)
return count ;
}
inline int GMap1::checkCycleDegree(Dart d, unsigned int degree)
{
unsigned int count = 0 ;
Dart it = d ;
do
{
++count ;
it = phi1(it) ;
} while ((count<=degree) && (it != d)) ;
return count-degree;
}
inline bool GMap1::isCycleTriangle(Dart d)
{
return (phi1(d) != d) && (phi1(phi1(phi1(d))) == d) ;
......
......@@ -287,6 +287,13 @@ public:
*/
unsigned int vertexDegree(Dart d) ;
//! Check number of edges of the vertex of d with given parameter
/*! @param d a dart
* @param vd degree to compare with
* @return negative/null/positive if vertex degree is less/equal/greater than given degree
*/
int checkVertexDegree(Dart d, unsigned int vd);
//! tell if the vertex of d is on the boundary of the map
/*! @param d a dart
*/
......@@ -326,6 +333,13 @@ public:
*/
unsigned int faceDegree(Dart d) ;
//! Check number of edges of the face of d with given parameter
/*! @param d a dart
* @param vd degree to compare with
* @return negative/null/positive if vertex degree is less/equal/greater than given degree
*/
int checkFaceDegree(Dart d, unsigned int le);
/**
* tell if the face of d is on the boundary of the map
*/
......@@ -348,6 +362,13 @@ public:
*/
unsigned int volumeDegree(Dart d);
//! Check number of faces of the volume of d with given parameter
/*! @param d a dart
* @param vd degree to compare with
* @return negative/null/positive if volume degree is less/equal/greater than given degree
*/
int checkVolumeDegree(Dart d, unsigned int volDeg);
// TODO a mettre en algo
/**
* check if the mesh is triangular or not
......
......@@ -187,6 +187,12 @@ inline unsigned int GMap2::faceDegree(Dart d)
return GMap1::cycleDegree(d) ;
}
inline int GMap2::checkFaceDegree(Dart d, unsigned int le)
{
return GMap1::checkCycleDegree(d,le) ;
}
inline bool GMap2::sameVolume(Dart d, Dart e)
{
return sameOrientedVolume(d, e) || sameOrientedVolume(beta2(d), e) ;
......
......@@ -214,6 +214,15 @@ public:
*/
unsigned int vertexDegree(Dart d) ;
//! Check number of edges of the vertex of d with given parameter
/*! @param d a dart
* @param vd degree to compare with
* @return negative/null/positive if vertex degree is less/equal/greater than given degree
*/
int checkVertexDegree(Dart d, unsigned int vd);
//! Tell if the vertex of d is on the boundary
/*! @param d a dart
*/
......
......@@ -189,6 +189,13 @@ public:
*/
unsigned int cycleDegree(Dart d) ;
//! Check the Length of a cycle (its number of oriented edges)
/*! @param d a dart of the cycle
* @param degree the length to compare
* @return negative/null/positive if face degree is less/equal/greater than given degree
*/
int checkCycleDegree(Dart d, unsigned int degree) ;
/**
* check if the cycle of d is a triangle
* @return a boolean indicating if the cycle is a triangle
......
......@@ -231,6 +231,21 @@ inline unsigned int Map1::cycleDegree(Dart d)
return count ;
}
inline int Map1::checkCycleDegree(Dart d, unsigned int degree)
{
unsigned int count = 0 ;
Dart it = d ;
do
{
++count ;
it = phi1(it) ;
} while ((count<=degree) && (it != d)) ;
return count-degree;
}
inline bool Map1::isCycleTriangle(Dart d)
{
return (phi1(d) != d) && (phi1(phi1(phi1(d))) == d) ;
......
......@@ -333,6 +333,13 @@ public:
*/
unsigned int vertexDegree(Dart d) ;
//! Check number of edges of the vertex of d with given parameter
/*! @param d a dart
* @param vd degree to compare with
* @return negative/null/positive if vertex degree is less/equal/greater than given degree
*/
int checkVertexDegree(Dart d, unsigned int vd);
//! Tell if the vertex of d is on the boundary of the map
/*! @param d a dart
*/
......@@ -378,6 +385,13 @@ public:
*/
unsigned int faceDegree(Dart d) ;
//! Check number of edges of the face of d with given parameter
/*! @param d a dart
* @param vd degree to compare with
* @return negative/null/positive if vertex degree is less/equal/greater than given degree
*/
int checkFaceDegree(Dart d, unsigned int le);
/**
* tell if the face of d is on the boundary of the map
*/
......@@ -400,6 +414,13 @@ public:
*/
unsigned int volumeDegree(Dart d);
//! Check number of faces of the volume of d with given parameter
/*! @param d a dart
* @param vd degree to compare with
* @return negative/null/positive if volume degree is less/equal/greater than given degree
*/
int checkVolumeDegree(Dart d, unsigned int volDeg);
// TODO a mettre en algo
/**
* check if the mesh is triangular or not
......
......@@ -184,6 +184,13 @@ inline unsigned int Map2::faceDegree(Dart d)
return Map1::cycleDegree(d) ;
}
inline int Map2::checkFaceDegree(Dart d, unsigned int le)
{
return Map1::checkCycleDegree(d,le) ;
}
inline bool Map2::sameVolume(Dart d, Dart e)
{
return sameOrientedVolume(d, e) ;
......
......@@ -301,6 +301,15 @@ public:
*/
unsigned int vertexDegree(Dart d) ;
//! Check number of edges of the vertex of d with given parameter
/*! @param d a dart
* @param vd degree to compare with
* @return negative/null/positive if vertex degree is less/equal/greater than given degree
*/
int checkVertexDegree(Dart d, unsigned int vd);
//! Compute the number of edges of the vertex of d on the boundary
/*! @param d a dart
*/
......
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