Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strip useless code #22

Merged
merged 2 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading