Add constructor from Bbox_2/3

This commit is contained in:
Andreas Fabri 2024-12-18 11:06:04 +00:00
parent bad04a6c68
commit 99f514122b
1 changed files with 21 additions and 0 deletions

View File

@ -19,6 +19,8 @@
#include <iostream>
#include <iterator>
#include <CGAL/use.h>
#include <CGAL/Bbox_2.h>
#include <CGAL/Bbox_3.h>
#include <CGAL/assertions.h>
#include <CGAL/Dimension.h>
#include <CGAL/Concatenate_iterator.h>
@ -153,6 +155,22 @@ protected:
max_values[i] = (*b).second;
}
}
void init(const Bbox_2& bb){
min_values[0] = bb.xmin();
min_values[1] = bb.ymin();
max_values[0] = bb.xmax();
max_values[1] = bb.ymax();
}
void init(const Bbox_3& bb){
min_values[0] = bb.xmin();
min_values[1] = bb.ymin();
min_values[2] = bb.zmin();
max_values[0] = bb.xmax();
max_values[1] = bb.ymax();
max_values[2] = bb.zmax();
}
};
}
@ -175,6 +193,9 @@ public:
template <typename I>
Bbox(int d, I b, I e) { CGAL_assertion(d==N || d==0); this->init(d, b, e); }
Bbox(const Bbox_2& bb2){ this->init(bb2);}
Bbox(const Bbox_3& bb3){ this->init(bb3);}
Cartesian_const_iterator cartesian_begin() const
{
return Cartesian_const_iterator(this->min_values.end(), this->max_values.begin(), this->min_values.begin());