-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Kernel_23d: Add a Bbox class with dimension as parameter #8258
base: master
Are you sure you want to change the base?
Conversation
@mglisse I am also wondering why there is no bounding box class in |
Kernel_23/include/CGAL/Bbox.h
Outdated
CGAL_assertion(min_values.size() == 0 || min_values.size() == bbox.min_values.size()); | ||
int dim = bbox.min_values.size(); | ||
for(int i=0; i<dim; ++i) | ||
{ | ||
if(min_values[i] > bbox.min_values[i]) min_values[i] = bbox.min_values[i]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The assertion allows min_values.size() == 0 and dim != 0, but then min_values[i] is read 😕
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's wrong indeed.
min_values.size()==0 happens for a default constructed Bbox with a dynamic dimension, which models an empty bbox. In this case, values should just be copied from bbox to this.
@mbredif do I have to make you collaborator, or is this already the case? |
I remember thinking about it, maybe discussing it, but I don't remember the content...
That may have played a big role 😉 (it doesn't seem to be part of the Kernel_d concept)
If you have a use for it, we probably should. |
this->min_values.resize(d); | ||
this->max_values.resize(d); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems a bit wasteful to use 2 containers of size d instead of one of size 2*d, but that's an implementation detail so it doesn't matter now.
{ | ||
int d = bbox.dimension(); | ||
for(int i=0; i<d; ++i) | ||
out << (bbox.min)(i) << " " << (bbox.max)(i) << " "; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bbox_2/3
first print lower left and then upper right.
enum { D = N }; | ||
public: | ||
inline constexpr int dimension() const { return D; } | ||
Bbox(int d = 0 ) { assert(d==N || d==0); this->init(d ); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find it surprising that for a Bbox with non-dynamic dimension I have to pass parameter d
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that was to offer a common API whatever the dimension dynamics
We also need a constructor taking an iterator range of coordinates. And maybe also for a range of pairs of coordinates. I just realize that this would correspond more to what you do for the I/O operators. But do we want a constructor for a range of low and a second range for high? Seems not intuitive. |
As |
Kernel_23 failing in CGAL-6.0-Ic-284 |
Summary of Changes
For the upcoming Frechet Distance package we need a dD bounding box. We do not have that in
Kernel_d
, and there is such a class in ign's Distributed Delaunay Triangulation package to come (link). This PR copies it to the Kernel package (with the ok of @mbredif), but in theCGAL
namespace.This draft pull request is to get a discussion started.
Bbox_2/3
atypedef
of this new class?Bbox_2
offers additionally.Kernel_d
?Release Management