From 7d85bfe855cb4864f0f6376894a6734085819aec Mon Sep 17 00:00:00 2001 From: TANG ZHIXIONG Date: Fri, 5 Jan 2024 19:19:01 +0800 Subject: [PATCH 1/2] fix --- src/concaveman.h | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/concaveman.h b/src/concaveman.h index a7fd81d..85ee23f 100644 --- a/src/concaveman.h +++ b/src/concaveman.h @@ -561,12 +561,9 @@ concaveman(const std::vector> &points, // index the points with an R-tree rtree tree; - std::map, int> points_index; for (int index = 0; index < int(points.size()); index++) { - point_type p{points[index][0], points[index][1], index}; + point_type p{points[index][0], points[index][1], (T)index}; tree.insert(p, {p[0], p[1], p[0], p[1]}); - points_index.insert( - std::pair, int>(points[index], index)); } // for (auto &p : points) @@ -581,7 +578,7 @@ concaveman(const std::vector> &points, // queue with the nodes for (auto &idx : hull) { auto &pp = points[idx]; - point_type p{pp[0], pp[1], points_index[pp]}; + point_type p{pp[0], pp[1], (T)idx}; tree.erase(p, {p[0], p[1], p[0], p[1]}); last = circList.insert(last, p); queue.push_back(last); @@ -716,17 +713,11 @@ std::vector concaveman_indexes( // index the points with an R-tree rtree tree; - std::map, int> points_index; for (int index = 0; index < int(points.size()); index++) { point_type p{points[index][0], points[index][1], (T)index}; tree.insert(p, {p[0], p[1], p[0], p[1]}); - points_index.insert( - std::pair, int>(points[index], index)); } - // for (auto &p : points) - // tree.insert(p, { p[0], p[1], p[0], p[1] }); - circ_list_type circList; circ_elem_ptr_type last = nullptr; @@ -736,7 +727,7 @@ std::vector concaveman_indexes( // queue with the nodes for (auto &idx : hull) { auto &pp = points[idx]; - point_type p{pp[0], pp[1], (T)points_index[pp]}; + point_type p{pp[0], pp[1], (T)idx}; tree.erase(p, {p[0], p[1], p[0], p[1]}); last = circList.insert(last, p); queue.push_back(last); From def9b1b4f5e7fad7f00d232dd2e6768794dab179 Mon Sep 17 00:00:00 2001 From: TANG ZHIXIONG Date: Fri, 5 Jan 2024 19:22:31 +0800 Subject: [PATCH 2/2] not good --- setup.py | 2 +- src/concaveman.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/setup.py b/setup.py index fcce77e..54862ad 100644 --- a/setup.py +++ b/setup.py @@ -122,7 +122,7 @@ def build_extension(self, ext): # logic and declaration, and simpler if you include description/version in a file. setup( name="concave_hull", - version="0.0.6", + version="0.0.7", author="tzx", author_email="dvorak4tzx@gmail.com", url="https://concave-hull.readthedocs.io", diff --git a/src/concaveman.h b/src/concaveman.h index 85ee23f..d8adf51 100644 --- a/src/concaveman.h +++ b/src/concaveman.h @@ -695,7 +695,6 @@ std::vector concaveman_indexes( // further T lengthThreshold = 0) { - typedef Node node_type; typedef std::array point_type; typedef CircularElement circ_elem_type;