QGIS API Documentation 3.41.0-Master (af5edcb665c)
|
A 3-dimensional box composed of x, y, z coordinates. More...
#include <qgsbox3d.h>
Public Member Functions | |
QgsBox3D (const QgsPoint &p1, const QgsPoint &p2, bool normalize=true) | |
Constructs a QgsBox3D from two points representing opposite corners of the box. | |
QgsBox3D (const QgsRectangle &rect, double zMin=std::numeric_limits< double >::quiet_NaN(), double zMax=std::numeric_limits< double >::quiet_NaN(), bool normalize=true) | |
Constructs a QgsBox3D from a rectangle. | |
QgsBox3D (const QgsVector3D &corner1, const QgsVector3D &corner2, bool normalize=true) | |
Constructs a QgsBox3D from two 3D vectors representing opposite corners of the box. | |
QgsBox3D (double xmin=std::numeric_limits< double >::quiet_NaN(), double ymin=std::numeric_limits< double >::quiet_NaN(), double zmin=std::numeric_limits< double >::quiet_NaN(), double xmax=std::numeric_limits< double >::quiet_NaN(), double ymax=std::numeric_limits< double >::quiet_NaN(), double zmax=std::numeric_limits< double >::quiet_NaN(), bool normalize=true) | |
Constructor for QgsBox3D which accepts the ranges of x/y/z coordinates. | |
double | area () const |
Returns the area of the box. | |
QgsVector3D | center () const |
Returns the center of the box as a vector. | |
void | combineWith (const QgsBox3D &box) |
Expands the bbox so that it covers both the original rectangle and the given rectangle. | |
void | combineWith (double x, double y, double z) |
Expands the bbox so that it covers both the original rectangle and the given point. | |
bool | contains (const QgsBox3D &other) const |
Returns true when box contains other box. | |
bool | contains (const QgsPoint &point) const |
Returns true when box contains a point. | |
bool | contains (double x, double y, double z) const |
Returns true when box contains a point (x, y, z). | |
QVector< QgsVector3D > | corners () const |
Returns an array of all box corners as 3D vectors. | |
double | depth () const |
Returns the depth of the 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 the box) | |
void | grow (double delta) |
Grows the box in place by the specified amount in all dimensions. | |
double | height () const |
Returns the height of the box. | |
QgsBox3D | intersect (const QgsBox3D &other) const |
Returns the intersection of this box and another 3D box. | |
bool | intersects (const QgsBox3D &other) const |
Returns true if box intersects with another box. | |
bool | is2d () const |
Returns true if the box can be considered a 2-dimensional box, i.e. | |
bool | is3D () const |
Returns true if the box can be considered a 3-dimensional box, i.e. | |
bool | isEmpty () const |
Returns true if the box is empty. | |
bool | isNull () const |
Test if the box is null (holding no spatial information). | |
void | normalize () |
Normalize the box so it has non-negative width/height/depth. | |
QgsBox3D | operator+ (const QgsVector3D &v) const |
Returns a box offset from this one in the direction of the vector. | |
QgsBox3D & | operator+= (const QgsVector3D &v) |
Moves this box in the direction of the vector. | |
QgsBox3D | operator- (const QgsVector3D &v) const |
Returns a box offset from this one in the direction of the reversed vector. | |
QgsBox3D & | operator-= (const QgsVector3D &v) |
Moves this box in the direction of the reversed vector. | |
bool | operator== (const QgsBox3D &other) const |
void | scale (double scaleFactor, const QgsPoint ¢er=QgsPoint()) |
Scale the rectangle around a center QgsPoint. | |
void | scale (double scaleFactor, double centerX, double centerY, double centerZ) |
Scale the rectangle around a center coordinates. | |
void | set (double xMin, double yMin, double zMin, double xMax, double yMax, double zMax, bool normalize=true) |
Sets the box from a set of (x,y,z) minimum and maximum coordinates. | |
void | setNull () |
Mark a box as being null (holding no spatial information). | |
void | setXMaximum (double x) |
Sets the maximum x value. | |
void | setXMinimum (double x) |
Sets the minimum x value. | |
void | setYMaximum (double y) |
Sets the maximum y value. | |
void | setYMinimum (double y) |
Sets the minimum y value. | |
void | setZMaximum (double z) |
Sets the maximum z value. | |
void | setZMinimum (double z) |
Sets the minimum z value. | |
QgsRectangle | toRectangle () const |
Converts the box to a 2D rectangle. | |
QString | toString (int precision=16) const |
Returns a string representation of form xmin,ymin,zmin : xmax,ymax,zmax Coordinates will be truncated to the specified precision. | |
double | volume () const |
Returns the volume of the box. | |
double | width () const |
Returns the width of the box. | |
double | xMaximum () const |
Returns the maximum x value. | |
double | xMinimum () const |
Returns the minimum x value. | |
double | yMaximum () const |
Returns the maximum y value. | |
double | yMinimum () const |
Returns the minimum y value. | |
double | zMaximum () const |
Returns the maximum z value. | |
double | zMinimum () const |
Returns the minimum z value. | |
A 3-dimensional box composed of x, y, z coordinates.
A box composed of x/y/z minimum and maximum values. It is often used to return the 3D extent of a geometry or collection of geometries.
Definition at line 42 of file qgsbox3d.h.
QgsBox3D::QgsBox3D | ( | double | xmin = std::numeric_limits<double>::quiet_NaN() , |
double | ymin = std::numeric_limits<double>::quiet_NaN() , |
||
double | zmin = std::numeric_limits<double>::quiet_NaN() , |
||
double | xmax = std::numeric_limits<double>::quiet_NaN() , |
||
double | ymax = std::numeric_limits<double>::quiet_NaN() , |
||
double | zmax = std::numeric_limits<double>::quiet_NaN() , |
||
bool | normalize = true |
||
) |
Constructor for QgsBox3D which accepts the ranges of x/y/z coordinates.
If normalize is false
then the normalization step will not be applied automatically.
Definition at line 24 of file qgsbox3d.cpp.
Constructs a QgsBox3D from two points representing opposite corners of the box.
The box is normalized after construction. If normalize is false
then the normalization step will not be applied automatically.
Definition at line 35 of file qgsbox3d.cpp.
QgsBox3D::QgsBox3D | ( | const QgsVector3D & | corner1, |
const QgsVector3D & | corner2, | ||
bool | normalize = true |
||
) |
Constructs a QgsBox3D from two 3D vectors representing opposite corners of the box.
The box is normalized after construction. If normalize is false
then the normalization step will not be applied automatically.
Definition at line 57 of file qgsbox3d.cpp.
QgsBox3D::QgsBox3D | ( | const QgsRectangle & | rect, |
double | zMin = std::numeric_limits<double>::quiet_NaN() , |
||
double | zMax = std::numeric_limits<double>::quiet_NaN() , |
||
bool | normalize = true |
||
) |
Constructs a QgsBox3D from a rectangle.
If normalize is false
then the normalization step will not be applied automatically.
Definition at line 46 of file qgsbox3d.cpp.
|
inline |
QgsVector3D QgsBox3D::center | ( | ) | const |
Returns the center of the box as a vector.
Definition at line 118 of file qgsbox3d.cpp.
void QgsBox3D::combineWith | ( | const QgsBox3D & | box | ) |
Expands the bbox so that it covers both the original rectangle and the given rectangle.
Definition at line 208 of file qgsbox3d.cpp.
void QgsBox3D::combineWith | ( | double | x, |
double | y, | ||
double | z | ||
) |
Expands the bbox so that it covers both the original rectangle and the given point.
Definition at line 230 of file qgsbox3d.cpp.
bool QgsBox3D::contains | ( | const QgsBox3D & | other | ) | const |
Returns true
when box contains other box.
Definition at line 161 of file qgsbox3d.cpp.
bool QgsBox3D::contains | ( | const QgsPoint & | point | ) | const |
Returns true
when box contains a point.
If the point is a 2D point (no z-coordinate), then the containment test will be performed on the x/y extent of the box only.
Definition at line 176 of file qgsbox3d.cpp.
bool QgsBox3D::contains | ( | double | x, |
double | y, | ||
double | z | ||
) | const |
Returns true
when box contains a point (x, y, z).
A point on the border of the box will also return true
If the point is a 2D point (no z-coordinate), then the containment test will be performed on the x/y extent of the box only.
Definition at line 188 of file qgsbox3d.cpp.
QVector< QgsVector3D > QgsBox3D::corners | ( | ) | const |
Returns an array of all box corners as 3D vectors.
Definition at line 359 of file qgsbox3d.cpp.
|
inline |
double QgsBox3D::distanceTo | ( | const QVector3D & | point | ) | const |
Returns the smallest distance between the box and the point point (returns 0 if the point is inside the box)
Definition at line 248 of file qgsbox3d.cpp.
void QgsBox3D::grow | ( | double | delta | ) |
Grows the box in place by the specified amount in all dimensions.
Definition at line 301 of file qgsbox3d.cpp.
|
inline |
Returns the intersection of this box and another 3D box.
Definition at line 125 of file qgsbox3d.cpp.
bool QgsBox3D::intersects | ( | const QgsBox3D & | other | ) | const |
Returns true
if box intersects with another box.
Definition at line 144 of file qgsbox3d.cpp.
bool QgsBox3D::is2d | ( | ) | const |
Returns true
if the box can be considered a 2-dimensional box, i.e.
it has equal minimum and maximum z values.
Definition at line 134 of file qgsbox3d.cpp.
bool QgsBox3D::is3D | ( | ) | const |
Returns true
if the box can be considered a 3-dimensional box, i.e.
it has valid minimum and maximum z values. If the box is not normalized, this returns false
.
Definition at line 139 of file qgsbox3d.cpp.
bool QgsBox3D::isEmpty | ( | ) | const |
Returns true
if the box is empty.
An empty box may still be non-null if it contains valid spatial information (e.g. bounding box of a point or of a vertical or horizontal segment).
Definition at line 320 of file qgsbox3d.cpp.
bool QgsBox3D::isNull | ( | ) | const |
Test if the box is null (holding no spatial information).
A null box is also an empty box.
Definition at line 310 of file qgsbox3d.cpp.
void QgsBox3D::normalize | ( | ) |
Normalize the box so it has non-negative width/height/depth.
Definition at line 109 of file qgsbox3d.cpp.
QgsBox3D QgsBox3D::operator+ | ( | const QgsVector3D & | v | ) | const |
Returns a box offset from this one in the direction of the vector.
Definition at line 381 of file qgsbox3d.cpp.
QgsBox3D & QgsBox3D::operator+= | ( | const QgsVector3D & | v | ) |
Moves this box in the direction of the vector.
Definition at line 396 of file qgsbox3d.cpp.
QgsBox3D QgsBox3D::operator- | ( | const QgsVector3D & | v | ) | const |
Returns a box offset from this one in the direction of the reversed vector.
Definition at line 375 of file qgsbox3d.cpp.
QgsBox3D & QgsBox3D::operator-= | ( | const QgsVector3D & | v | ) |
Moves this box in the direction of the reversed vector.
Definition at line 387 of file qgsbox3d.cpp.
bool QgsBox3D::operator== | ( | const QgsBox3D & | other | ) | const |
Definition at line 263 of file qgsbox3d.cpp.
Scale the rectangle around a center QgsPoint.
If no center point is specified then the current center of the box will be used.
Definition at line 270 of file qgsbox3d.cpp.
void QgsBox3D::scale | ( | double | scaleFactor, |
double | centerX, | ||
double | centerY, | ||
double | centerZ | ||
) |
Scale the rectangle around a center coordinates.
Definition at line 289 of file qgsbox3d.cpp.
|
inline |
Sets the box from a set of (x,y,z) minimum and maximum coordinates.
Definition at line 181 of file qgsbox3d.h.
void QgsBox3D::setNull | ( | ) |
Mark a box as being null (holding no spatial information).
Set a rectangle so that min corner is at max and max corner is at min.
It is NOT normalized.
Definition at line 102 of file qgsbox3d.cpp.
void QgsBox3D::setXMaximum | ( | double | x | ) |
Sets the maximum x value.
Definition at line 73 of file qgsbox3d.cpp.
void QgsBox3D::setXMinimum | ( | double | x | ) |
Sets the minimum x value.
Definition at line 68 of file qgsbox3d.cpp.
void QgsBox3D::setYMaximum | ( | double | y | ) |
Sets the maximum y value.
Definition at line 83 of file qgsbox3d.cpp.
void QgsBox3D::setYMinimum | ( | double | y | ) |
Sets the minimum y value.
Definition at line 78 of file qgsbox3d.cpp.
void QgsBox3D::setZMaximum | ( | double | z | ) |
Sets the maximum z value.
Definition at line 93 of file qgsbox3d.cpp.
void QgsBox3D::setZMinimum | ( | double | z | ) |
Sets the minimum z value.
Definition at line 88 of file qgsbox3d.cpp.
|
inline |
Converts the box to a 2D rectangle.
Definition at line 394 of file qgsbox3d.h.
QString QgsBox3D::toString | ( | int | precision = 16 | ) | const |
Returns a string representation of form xmin,ymin,zmin : xmax,ymax,zmax Coordinates will be truncated to the specified precision.
If the specified precision is less than 0, a suitable minimum precision is used.
Definition at line 325 of file qgsbox3d.cpp.
|
inline |
Returns the volume of the box.
Definition at line 326 of file qgsbox3d.h.
|
inline |
|
inline |
Returns the maximum x value.
Definition at line 218 of file qgsbox3d.h.
|
inline |
Returns the minimum x value.
Definition at line 211 of file qgsbox3d.h.
|
inline |
Returns the maximum y value.
Definition at line 246 of file qgsbox3d.h.
|
inline |
Returns the minimum y value.
Definition at line 239 of file qgsbox3d.h.
|
inline |
Returns the maximum z value.
Definition at line 274 of file qgsbox3d.h.
|
inline |
Returns the minimum z value.
Definition at line 267 of file qgsbox3d.h.