mirror of https://github.com/CGAL/cgal
Adds some helpers to calculate the span of a Bbox in each dimension.
This commit is contained in:
parent
1a040c8552
commit
69779ebf80
|
|
@ -61,6 +61,8 @@ public:
|
|||
inline double ymin() const;
|
||||
inline double xmax() const;
|
||||
inline double ymax() const;
|
||||
inline double x_span() const;
|
||||
inline double y_span() const;
|
||||
|
||||
inline double max BOOST_PREVENT_MACRO_SUBSTITUTION (int i) const;
|
||||
inline double min BOOST_PREVENT_MACRO_SUBSTITUTION (int i) const;
|
||||
|
|
@ -91,6 +93,14 @@ double
|
|||
Bbox_2::ymax() const
|
||||
{ return rep[3]; }
|
||||
|
||||
inline double Bbox_2::x_span() const {
|
||||
return xmax() - xmin();
|
||||
}
|
||||
|
||||
inline double Bbox_2::y_span() const {
|
||||
return ymax() - ymin();
|
||||
}
|
||||
|
||||
inline
|
||||
bool
|
||||
Bbox_2::operator==(const Bbox_2 &b) const
|
||||
|
|
|
|||
|
|
@ -58,12 +58,15 @@ public:
|
|||
inline bool operator!=(const Bbox_3 &b) const;
|
||||
|
||||
inline int dimension() const;
|
||||
double xmin() const;
|
||||
double ymin() const;
|
||||
double zmin() const;
|
||||
double xmax() const;
|
||||
double ymax() const;
|
||||
double zmax() const;
|
||||
double xmin() const;
|
||||
double ymin() const;
|
||||
double zmin() const;
|
||||
double xmax() const;
|
||||
double ymax() const;
|
||||
double zmax() const;
|
||||
double x_span() const;
|
||||
double y_span() const;
|
||||
double z_span() const;
|
||||
|
||||
inline double min BOOST_PREVENT_MACRO_SUBSTITUTION (int i) const;
|
||||
inline double max BOOST_PREVENT_MACRO_SUBSTITUTION (int i) const;
|
||||
|
|
@ -107,6 +110,18 @@ double
|
|||
Bbox_3::zmax() const
|
||||
{ return rep[5]; }
|
||||
|
||||
inline double Bbox_3::x_span() const {
|
||||
return xmax() - xmin();
|
||||
}
|
||||
|
||||
inline double Bbox_3::y_span() const {
|
||||
return ymax() - ymin();
|
||||
}
|
||||
|
||||
inline double Bbox_3::z_span() const {
|
||||
return zmax() - zmin();
|
||||
}
|
||||
|
||||
inline
|
||||
bool
|
||||
Bbox_3::operator==(const Bbox_3 &b) const
|
||||
|
|
|
|||
|
|
@ -39,6 +39,9 @@ int main()
|
|||
-3000000000000001.,
|
||||
5000000.0000000019,
|
||||
7.0000000000000026e+20) );
|
||||
CGAL::Bbox_2 span{1,2,5,8};
|
||||
assert( span.x_span() == 4);
|
||||
assert( span.y_span() == 6);
|
||||
}
|
||||
|
||||
{
|
||||
|
|
@ -70,5 +73,9 @@ int main()
|
|||
5000000.000000014,
|
||||
7.0000000000000197e+20,
|
||||
15.000000000000027) );
|
||||
CGAL::Bbox_3 span{1,2,3,5,8,11};
|
||||
assert( span.x_span() == 4);
|
||||
assert( span.y_span() == 6);
|
||||
assert( span.z_span() == 8);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue