From e1fb5617ffdd8c67ae4f98321cec8ba14441929c Mon Sep 17 00:00:00 2001 From: cignoni Date: Thu, 8 Nov 2012 18:37:10 +0000 Subject: [PATCH] assert -> throw exception --- vcg/complex/algorithms/geodesic.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/vcg/complex/algorithms/geodesic.h b/vcg/complex/algorithms/geodesic.h index acd7bd26..9bf48748 100644 --- a/vcg/complex/algorithms/geodesic.h +++ b/vcg/complex/algorithms/geodesic.h @@ -162,7 +162,7 @@ wrapping function. VertexPointer farthest=0,pw,pw1; //Requirements - assert(HasPerVertexVFAdjacency(m) && HasPerFaceVFAdjacency(m)); + if(!HasVFAdjacency(m)) throw vcg::MissingComponentException("VFAdjacency"); assert(!seedVec.empty()); TempDataType TD(m.vert, std::numeric_limits::max()); @@ -194,7 +194,7 @@ wrapping function. frontier.pop_back(); assert(TD[curr].d <= d_heap); - if(TD[curr].d < d_heap )// a vertex whose distance has been improved after it was inserted in the queue + if(TD[curr].d < d_heap ) // a vertex whose distance has been improved after it was inserted in the queue continue; assert(TD[curr].d == d_heap); @@ -288,6 +288,10 @@ To allocate the attributes: typename MeshType::template PerVertexAttributeHandle parentHandle; parentHandle = tri::Allocator::AddPerVertexAttribute (m,"parent"); \endcode + +It requires VF adjacency relation (e.g. vertex::VFAdj and face::VFAdj components) + + \warning that this function has ALWAYS at least a linear cost (it use additional attributes that have a linear initialization) \todo make it O(output) by using incremental mark and persistent attributes. */ @@ -309,8 +313,10 @@ To allocate the attributes: return true; } - /* - Assigns to each vertex of the mesh its distance to the closest vertex on the border + /* \brief Assigns to each vertex of the mesh its distance to the closest vertex on the boundary + +It is just a simple wrapper of the basic Compute() + Note: update the field Q() of the vertices Note: it needs the border bit set. */