QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
|
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 (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. | |
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) | |
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 | 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 43 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 23 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 34 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 45 of file qgsbox3d.cpp.
QgsVector3D QgsBox3D::center | ( | ) | const |
Returns the center of the box as a vector.
Definition at line 106 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 196 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 218 of file qgsbox3d.cpp.
bool QgsBox3D::contains | ( | const QgsBox3D & | other | ) | const |
Returns true
when box contains other box.
Definition at line 149 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 164 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 176 of file qgsbox3d.cpp.
QVector< QgsVector3D > QgsBox3D::corners | ( | ) | const |
Returns an array of all box corners as 3D vectors.
Definition at line 338 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 236 of file qgsbox3d.cpp.
|
inline |
Returns the intersection of this box and another 3D box.
Definition at line 113 of file qgsbox3d.cpp.
bool QgsBox3D::intersects | ( | const QgsBox3D & | other | ) | const |
Returns true
if box intersects with another box.
Definition at line 132 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 122 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 127 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 299 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 289 of file qgsbox3d.cpp.
void QgsBox3D::normalize | ( | ) |
Normalize the box so it has non-negative width/height/depth.
Definition at line 97 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 360 of file qgsbox3d.cpp.
QgsBox3D & QgsBox3D::operator+= | ( | const QgsVector3D & | v | ) |
Moves this box in the direction of the vector.
Definition at line 375 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 354 of file qgsbox3d.cpp.
QgsBox3D & QgsBox3D::operator-= | ( | const QgsVector3D & | v | ) |
Moves this box in the direction of the reversed vector.
Definition at line 366 of file qgsbox3d.cpp.
bool QgsBox3D::operator== | ( | const QgsBox3D & | other | ) | const |
Definition at line 251 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 258 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 277 of file qgsbox3d.cpp.
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 90 of file qgsbox3d.cpp.
void QgsBox3D::setXMaximum | ( | double | x | ) |
Sets the maximum x value.
Definition at line 61 of file qgsbox3d.cpp.
void QgsBox3D::setXMinimum | ( | double | x | ) |
Sets the minimum x value.
Definition at line 56 of file qgsbox3d.cpp.
void QgsBox3D::setYMaximum | ( | double | y | ) |
Sets the maximum y value.
Definition at line 71 of file qgsbox3d.cpp.
void QgsBox3D::setYMinimum | ( | double | y | ) |
Sets the minimum y value.
Definition at line 66 of file qgsbox3d.cpp.
void QgsBox3D::setZMaximum | ( | double | z | ) |
Sets the maximum z value.
Definition at line 81 of file qgsbox3d.cpp.
void QgsBox3D::setZMinimum | ( | double | z | ) |
Sets the minimum z value.
Definition at line 76 of file qgsbox3d.cpp.
|
inline |
Converts the box to a 2D rectangle.
Definition at line 339 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 304 of file qgsbox3d.cpp.
|
inline |
Returns the volume of the box.
Definition at line 271 of file qgsbox3d.h.
|
inline |
|
inline |
Returns the maximum x value.
Definition at line 170 of file qgsbox3d.h.
|
inline |
Returns the minimum x value.
Definition at line 163 of file qgsbox3d.h.
|
inline |
Returns the maximum y value.
Definition at line 198 of file qgsbox3d.h.
|
inline |
Returns the minimum y value.
Definition at line 191 of file qgsbox3d.h.
|
inline |
Returns the maximum z value.
Definition at line 226 of file qgsbox3d.h.
|
inline |
Returns the minimum z value.
Definition at line 219 of file qgsbox3d.h.