QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
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 &&
140 double centerX, centerY, centerZ;
143 centerX = center.
x();
144 centerY = center.
y();
145 centerZ = center.
z();
153 scale( scaleFactor, centerX, centerY, centerZ );
156 void QgsBox3d::scale(
double scaleFactor,
double centerX,
double centerY,
double centerZ )
bool intersects(const QgsRectangle &rect) const SIP_HOLDGIL
Returns true when rectangle intersects with other rectangle.
double xMaximum() const SIP_HOLDGIL
Returns the maximum x value.
void setZMaximum(double z) SIP_HOLDGIL
Sets the maximum z value.
Point geometry type, with support for z-dimension and m-values.
void setZMinimum(double z) SIP_HOLDGIL
Sets the minimum z value.
double yMinimum() const SIP_HOLDGIL
Returns the y minimum value (bottom side of rectangle).
bool operator==(const QgsBox3d &other) const
void normalize()
Normalize the box so it has non-negative width/height/depth.
void setYMaximum(double y) SIP_HOLDGIL
Sets the maximum y value.
bool intersects(const QgsBox3d &other) const
Returns true if box intersects with another 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 contains(const QgsBox3d &other) const
Returns true when box contains other box.
QgsRectangle intersect(const QgsRectangle &rect) const
Returns the intersection with the given rectangle.
double zMaximum() const SIP_HOLDGIL
Returns the maximum z value.
A rectangle specified with double values.
double zMinimum() const SIP_HOLDGIL
Returns the minimum z value.
void normalize()
Normalize the rectangle so it has non-negative width/height.
double xMaximum() const SIP_HOLDGIL
Returns the x maximum value (right side of rectangle).
void scale(double scaleFactor, const QgsPoint ¢er=QgsPoint())
Scale the rectangle around a center QgsPoint.
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.
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) SIP_HOLDGIL
Sets the maximum x value.
bool contains(const QgsRectangle &rect) const SIP_HOLDGIL
Returns true when rectangle contains other rectangle.
void setXMinimum(double x) SIP_HOLDGIL
Set the minimum x value.
double xMinimum() const SIP_HOLDGIL
Returns the x minimum value (left side of rectangle).
double yMinimum() const SIP_HOLDGIL
Returns the minimum y value.
void setXMaximum(double x) SIP_HOLDGIL
Set the maximum x value.
void setYMinimum(double y) SIP_HOLDGIL
Sets the minimum y value.
bool is3D() const SIP_HOLDGIL
Returns true if the geometry is 3D and contains a z-value.
bool is2d() const SIP_HOLDGIL
Returns true if the box can be considered a 2-dimensional box, i.e.
void setYMaximum(double y) SIP_HOLDGIL
Set the maximum y value.
double yMaximum() const SIP_HOLDGIL
Returns the y maximum value (top side of rectangle).
void setYMinimum(double y) SIP_HOLDGIL
Set the minimum y value.
double yMaximum() const SIP_HOLDGIL
Returns the maximum y value.
QgsBox3d intersect(const QgsBox3d &other) const
Returns the intersection of this box and another 3D box.
void setXMinimum(double x) SIP_HOLDGIL
Sets the minimum x value.
A 3-dimensional box composed of x, y, z coordinates.
bool isEmpty() const override SIP_HOLDGIL
Returns true if the geometry is empty.
double xMinimum() const SIP_HOLDGIL
Returns the minimum x value.