Add utility class to better debug algorithms

This commit is contained in:
wmayer
2012-08-11 15:09:08 +02:00
parent 40a997217b
commit 4c92ec056d
6 changed files with 176 additions and 0 deletions

View File

@@ -255,6 +255,17 @@ float MeshAlgorithm::GetAverageEdgeLength() const
return fLen;
}
Base::Vector3f MeshAlgorithm::GetGravityPoint() const
{
Base::Vector3f center;
MeshPointIterator cP(_rclMesh);
for (cP.Init(); cP.More(); cP.Next()) {
center += *cP;
}
return center / (float)_rclMesh.CountPoints();
}
void MeshAlgorithm::GetMeshBorders (std::list<std::vector<Base::Vector3f> > &rclBorders) const
{
std::vector<unsigned long> aulAllFacets(_rclMesh.CountFacets());

View File

@@ -115,6 +115,10 @@ public:
* Calculates the average length of edges.
*/
float GetAverageEdgeLength() const;
/**
* Calculates the gravity point of the mesh.
*/
Base::Vector3f GetGravityPoint() const;
/**
* Returns all boundaries of the mesh.
*/