Skip to content

Commit

Permalink
strip useless code (#22)
Browse files Browse the repository at this point in the history
* fix

* not good

---------

Co-authored-by: TANG ZHIXIONG <[email protected]>
  • Loading branch information
district10 and zhixiong-tang authored Jan 5, 2024
1 parent b67c38e commit da45d02
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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="[email protected]",
url="https://concave-hull.readthedocs.io",
Expand Down
16 changes: 3 additions & 13 deletions src/concaveman.h
Original file line number Diff line number Diff line change
Expand Up @@ -561,12 +561,9 @@ concaveman(const std::vector<std::array<T, 2>> &points,

// index the points with an R-tree
rtree<T, 2, MAX_CHILDREN, point_type> tree;
std::map<std::array<T, 2>, 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<std::array<T, 2>, int>(points[index], index));
}

// for (auto &p : points)
Expand All @@ -581,7 +578,7 @@ concaveman(const std::vector<std::array<T, 2>> &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);
Expand Down Expand Up @@ -698,7 +695,6 @@ std::vector<int> concaveman_indexes(
// further
T lengthThreshold = 0)
{

typedef Node<T> node_type;
typedef std::array<T, 3> point_type;
typedef CircularElement<node_type> circ_elem_type;
Expand All @@ -716,17 +712,11 @@ std::vector<int> concaveman_indexes(

// index the points with an R-tree
rtree<T, 2, MAX_CHILDREN, point_type> tree;
std::map<std::array<T, 2>, 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<std::array<T, 2>, 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;

Expand All @@ -736,7 +726,7 @@ std::vector<int> 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);
Expand Down

0 comments on commit da45d02

Please sign in to comment.