summaryrefslogtreecommitdiff
path: root/src/GudhUI
diff options
context:
space:
mode:
authorsalinasd <salinasd@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-01-27 12:01:58 +0000
committersalinasd <salinasd@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-01-27 12:01:58 +0000
commit6a3d2ddd53e852dee84e6efc70f6d511798bef9c (patch)
treefad69b214afcf23de9a11937d0714f84d47ef3cb /src/GudhUI
parenta160f39457e8dc0947dc5d6865c020a285a50df6 (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')
-rw-r--r--src/GudhUI/model/Model.h5
-rw-r--r--src/GudhUI/utils/Edge_contractor.h19
2 files changed, 23 insertions, 1 deletions
diff --git a/src/GudhUI/model/Model.h b/src/GudhUI/model/Model.h
index abb2fd6a..ab92d0cf 100644
--- a/src/GudhUI/model/Model.h
+++ b/src/GudhUI/model/Model.h
@@ -234,9 +234,13 @@ public:
void show_homology_group(){
+#ifndef _WIN32
+ std::cout << "Works only on linux for the moment\n";
+#else
Clock clock;
run_chomp();
clock.end();
+#endif
}
void show_euler_characteristic(){
@@ -263,6 +267,7 @@ public:
private:
void run_chomp(){
save_complex_in_file_for_chomp();
+ std::cout << "Call CHOMP library\n";
system("../src/utils/homsimpl chomp.sim");
}
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>()
);