From ae4311d28ea3261ce5647097daa0eae67922a150 Mon Sep 17 00:00:00 2001 From: Jiri Vlasak Date: Wed, 11 Sep 2019 07:44:25 +0200 Subject: [PATCH] Split cost to build and search --- api/rrts.h | 1 - src/rrts.cc | 9 ++++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/api/rrts.h b/api/rrts.h index 47e6ea5..58f6ad8 100644 --- a/api/rrts.h +++ b/api/rrts.h @@ -69,7 +69,6 @@ class RRTS { collide_steered_from(RRTNode &f); std::tuple collide_two_nodes(RRTNode &f, RRTNode &t); - double cost(RRTNode &f, RRTNode &t); double cost_build(RRTNode &f, RRTNode &t); double cost_search(RRTNode &f, RRTNode &t); void sample(); diff --git a/src/rrts.cc b/src/rrts.cc index c486742..5c24608 100644 --- a/src/rrts.cc +++ b/src/rrts.cc @@ -68,7 +68,14 @@ RRTS::collide_two_nodes(RRTNode &f, RRTNode &t) return this->collide(p); } -double RRTS::cost(RRTNode &f, RRTNode &t) +double RRTS::cost_build(RRTNode &f, RRTNode &t) +{ + double cost = 0; + cost = sqrt(pow(t.y() - f.y(), 2) + pow(t.x() - f.x(), 2)); + return cost; +} + +double RRTS::cost_search(RRTNode &f, RRTNode &t) { double cost = 0; cost = sqrt(pow(t.y() - f.y(), 2) + pow(t.x() - f.x(), 2)); -- 2.39.2