22 QgsBox3d::QgsBox3d(
double xmin,
double ymin,
double zmin,
double xmax,
double ymax,
double zmax )
23 : mBounds2d( xmin, ymin, xmax, ymax )
29 : mBounds2d( p1.x(), p1.y(), p2.x(), p2.y() )
30 , mZmin( std::min( p1.z(), p2.z() ) )
31 , mZmax( std::max( p1.z(), p2.z() ) )
73 double z1 = std::min( mZmin, mZmax );
74 double z2 = std::max( mZmin, mZmax );
82 double zMin = std::max( mZmin, other.mZmin );
83 double zMax = std::min( mZmax, other.mZmax );
95 if ( !mBounds2d.
intersects( other.mBounds2d ) )
98 double z1 = ( mZmin > other.mZmin ? mZmin : other.mZmin );
99 double z2 = ( mZmax < other.mZmax ? mZmax : other.mZmax );
105 if ( !mBounds2d.
contains( other.mBounds2d ) )
108 return ( other.mZmin >= mZmin && other.mZmax <= mZmax );
117 return mZmin <= p.
z() && p.
z() <= mZmax;
124 return mBounds2d == other.mBounds2d &&
bool intersects(const QgsRectangle &rect) const
Returns true when rectangle intersects with 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.
double yMaximum() const
Returns the y maximum value (top side of rectangle).
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)
bool contains(const QgsRectangle &rect) const
Returns true when rectangle contains other rectangle.
bool operator==(const QgsBox3d &other) const
void setXMaximum(double x)
Sets the maximum x value.
A 3-dimensional box composed of x, y, z coordinates.
bool intersects(const QgsBox3d &other) const
Returns true if box intersects with another box.
void setYMaximum(double y)
Sets the maximum y value.
double yMinimum() const
Returns the y minimum value (bottom side of rectangle).
bool contains(const QgsBox3d &other) const
Returns true when box contains other box.
double xMaximum() const
Returns the x maximum value (right side of rectangle).
void setYMinimum(double y)
Set the minimum y value.
Point geometry type, with support for z-dimension and m-values.
QgsRectangle intersect(const QgsRectangle &rect) const
Returns the intersection with the given rectangle.
void setZMinimum(double z)
Sets the minimum z value.
void setYMinimum(double y)
Sets the minimum y value.
void setYMaximum(double y)
Set the maximum y value.
bool is2d() const
Returns true if the box can be considered a 2-dimensional box, i.e.
bool is3D() const
Returns true if the geometry is 3D and contains a z-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.
void normalize()
Normalize the rectangle so it has non-negative width/height.
double xMinimum() const
Returns the x minimum value (left side of rectangle).
void setXMinimum(double x)
Set the minimum x value.
QgsBox3d intersect(const QgsBox3d &other) const
Returns the intersection of this box and another 3D box.
void setZMaximum(double z)
Sets the maximum z value.
void normalize()
Normalize the box so it has non-negative width/height/depth.