21 QgsBox3d::QgsBox3d(
double xmin,
double ymin,
double zmin,
double xmax,
double ymax,
double zmax )
22 : mBounds2d( xmin, ymin, xmax, ymax )
28 : mBounds2d( p1.x(), p1.y(), p2.x(), p2.y() )
29 , mZmin( std::min( p1.z(), p2.z() ) )
30 , mZmax( std::max( p1.z(), p2.z() ) )
72 double z1 = std::min( mZmin, mZmax );
73 double z2 = std::max( mZmin, mZmax );
81 double zMin = std::max( mZmin, other.mZmin );
82 double zMax = std::min( mZmax, other.mZmax );
94 if ( !mBounds2d.
intersects( other.mBounds2d ) )
97 double z1 = ( mZmin > other.mZmin ? mZmin : other.mZmin );
98 double z2 = ( mZmax < other.mZmax ? mZmax : other.mZmax );
104 if ( !mBounds2d.
contains( other.mBounds2d ) )
107 return ( other.mZmin >= mZmin && other.mZmax <= mZmax );
116 return mZmin <= p.
z() && p.
z() <= mZmax;
123 return mBounds2d == other.mBounds2d &&
bool contains(const QgsRectangle &rect) const
Returns true when rectangle contains other rectangle.
A rectangle specified with double values.
void setXMinimum(double x)
Sets the minimum x value.
void setXMaximum(double x)
Set the maximum x value.
bool intersects(const QgsBox3d &other) const
Returns true if box intersects with another box.
A class to represent a 2D point.
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
void setXMaximum(double x)
Sets the maximum x value.
A 3-dimensional box composed of x, y, z coordinates.
void setYMaximum(double y)
Sets the maximum y value.
bool contains(const QgsBox3d &other) const
Returns true when box contains other box.
QgsBox3d intersect(const QgsBox3d &other) const
Returns the intersection of this box and another 3D box.
bool operator==(const QgsBox3d &other) const
void setYMinimum(double y)
Set the minimum y value.
QgsRectangle intersect(const QgsRectangle &rect) const
Returns the intersection with the given rectangle.
Point geometry type, with support for z-dimension and m-values.
void setZMinimum(double z)
Sets the minimum z value.
double yMinimum() const
Returns the y minimum value (bottom side of rectangle).
double xMaximum() const
Returns the x maximum value (right side of rectangle).
void setYMinimum(double y)
Sets the minimum y value.
void setYMaximum(double y)
Set the maximum y value.
QgsBox3d(double xmin=0, double ymin=0, double zmin=0, double xmax=0, double ymax=0, double zmax=0)
Constructor for QgsBox3D which accepts the ranges of x/y/z coordinates.
double xMinimum() const
Returns the x minimum value (left side of rectangle).
double yMaximum() const
Returns the y maximum value (top side of rectangle).
void normalize()
Normalize the rectangle so it has non-negative width/height.
bool intersects(const QgsRectangle &rect) const
Returns true when rectangle intersects with other rectangle.
bool is3D() const
Returns true if the geometry is 3D and contains a z-value.
void setXMinimum(double x)
Set the minimum x value.
bool is2d() const
Returns true if the box can be considered a 2-dimensional box, i.e.
void setZMaximum(double z)
Sets the maximum z value.
void normalize()
Normalize the box so it has non-negative width/height/depth.