Skip to content

Commit

Permalink
Add string represantation of a rectangle
Browse files Browse the repository at this point in the history
  • Loading branch information
xJoskiy committed Jan 14, 2025
1 parent 91756a0 commit a597593
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/core/util/kdtree.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ struct Rect {

return true;
}

std::string ToString() const {
std::stringstream ss;
const char open[] {'(', '['};
const char closed[] {')', ']'};
for (size_t i = 0; i < lower_bound_.GetDim(); i++) {
ss << open[lower_bound_type_[i]] << lower_bound_[i].ToString() << ", ";
ss << upper_bound_[i].ToString() << closed[upper_bound_type_[i]] << '\n';
}

return ss.str();
}
};

template <SubscriptableOrder PointType>
Expand Down

0 comments on commit a597593

Please sign in to comment.