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 const double z1 = std::min( mZmin, mZmax );
73 const double z2 = std::max( mZmin, mZmax );
81 const double zMin = std::max( mZmin, other.mZmin );
82 const double zMax = std::min( mZmax, other.mZmax );
94 if ( !mBounds2d.
intersects( other.mBounds2d ) )
97 const double z1 = ( mZmin > other.mZmin ? mZmin : other.mZmin );
98 const 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 const double dx = std::max( mBounds2d.
xMinimum() - point.x(), std::max( 0., point.x() - mBounds2d.
xMaximum() ) );
124 const double dy = std::max( mBounds2d.
yMinimum() - point.y(), std::max( 0., point.y() - mBounds2d.
yMaximum() ) );
125 const double dz = std::max( mZmin - point.z(), std::max( 0., point.z() - mZmax ) );
126 return sqrt( dx * dx + dy * dy + dz * dz );
132 return mBounds2d == other.mBounds2d &&
bool is3D() const SIP_HOLDGIL
Returns true if the geometry is 3D and contains a z-value.
A 3-dimensional box composed of x, y, z coordinates.
void setXMaximum(double x) SIP_HOLDGIL
Sets the maximum x value.
void setYMaximum(double y) SIP_HOLDGIL
Sets the maximum y value.
bool contains(const QgsBox3d &other) const
Returns true when box contains other box.
double distanceTo(const QVector3D &point) const
Returns the smallest distance between the box and the point point (returns 0 if the point is inside t...
bool is2d() const SIP_HOLDGIL
Returns true if the box can be considered a 2-dimensional box, i.e.
bool operator==(const QgsBox3d &other) const
bool intersects(const QgsBox3d &other) const
Returns true if box intersects with another box.
void setZMinimum(double z) SIP_HOLDGIL
Sets the minimum z value.
QgsBox3d intersect(const QgsBox3d &other) const
Returns the intersection of this box and another 3D box.
void normalize()
Normalize the box so it has non-negative width/height/depth.
void setZMaximum(double z) SIP_HOLDGIL
Sets the maximum z value.
void setYMinimum(double y) SIP_HOLDGIL
Sets the minimum y value.
QgsBox3d(double xmin=0, double ymin=0, double zmin=0, double xmax=0, double ymax=0, double zmax=0) SIP_HOLDGIL
Constructor for QgsBox3D which accepts the ranges of x/y/z coordinates.
void setXMinimum(double x) SIP_HOLDGIL
Sets the minimum x value.
Point geometry type, with support for z-dimension and m-values.
A rectangle specified with double values.
double yMaximum() const SIP_HOLDGIL
Returns the y maximum value (top side of rectangle).
bool intersects(const QgsRectangle &rect) const SIP_HOLDGIL
Returns true when rectangle intersects with other rectangle.
double xMaximum() const SIP_HOLDGIL
Returns the x maximum value (right side of rectangle).
double xMinimum() const SIP_HOLDGIL
Returns the x minimum value (left side of rectangle).
double yMinimum() const SIP_HOLDGIL
Returns the y minimum value (bottom side of rectangle).
void setYMinimum(double y) SIP_HOLDGIL
Set the minimum y value.
void setXMaximum(double x) SIP_HOLDGIL
Set the maximum x value.
void setXMinimum(double x) SIP_HOLDGIL
Set the minimum x value.
void setYMaximum(double y) SIP_HOLDGIL
Set the maximum y value.
void normalize()
Normalize the rectangle so it has non-negative width/height.
QgsRectangle intersect(const QgsRectangle &rect) const
Returns the intersection with the given rectangle.
bool contains(const QgsRectangle &rect) const SIP_HOLDGIL
Returns true when rectangle contains other rectangle.
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)