diff options
author | salinasd <salinasd@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2015-01-27 12:01:58 +0000 |
---|---|---|
committer | salinasd <salinasd@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2015-01-27 12:01:58 +0000 |
commit | 6a3d2ddd53e852dee84e6efc70f6d511798bef9c (patch) | |
tree | fad69b214afcf23de9a11937d0714f84d47ef3cb /src/GudhUI/utils/Edge_contractor.h | |
parent | a160f39457e8dc0947dc5d6865c020a285a50df6 (diff) |
correct problem priority contraction
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@430 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: 16f49b81d6aa01bbfb6e11afa579ac574a87bdaa
Diffstat (limited to 'src/GudhUI/utils/Edge_contractor.h')
-rw-r--r-- | src/GudhUI/utils/Edge_contractor.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/GudhUI/utils/Edge_contractor.h b/src/GudhUI/utils/Edge_contractor.h index c7a86e0b..d0a1f866 100644 --- a/src/GudhUI/utils/Edge_contractor.h +++ b/src/GudhUI/utils/Edge_contractor.h @@ -37,6 +37,23 @@ private: } }; + + /** + * @brief return a cost corresponding to the squared length of the edge + */ + template< typename EdgeProfile> class Middle_placement : public contraction::Placement_policy<EdgeProfile>{ + public: + typedef typename contraction::Placement_policy<EdgeProfile>::Placement_type Placement_type; + typedef typename EdgeProfile::Point Point; + Placement_type operator()(const EdgeProfile& profile) const override{ + std::vector<double> mid_coords(profile.p0().dimension(),0); + for (size_t i = 0; i < profile.p0().dimension(); ++i){ + mid_coords[i] = (profile.p0()[i] + profile.p1()[i]) / 2.; + } + return Point(profile.p0().dimension(),mid_coords.begin(), mid_coords.end()); + } + }; + public: typedef typename SkBlComplex::Vertex_handle Vertex_handle; typedef typename SkBlComplex::Edge_handle Edge_handle; @@ -53,7 +70,7 @@ private: contraction::Skeleton_blocker_contractor<Complex> contractor( complex_, new Length_cost<contraction::Edge_profile<Complex>>(), - contraction::make_first_vertex_placement<Profile>(), + new Middle_placement<contraction::Edge_profile<Complex>>(), contraction::make_link_valid_contraction<Profile>(), contraction::make_remove_popable_blockers_visitor<Profile>() ); |