40 const QVector< QgsVector3D > corners = mBox.
corners();
47 for (
int i = 0; i < 8; ++i )
50 x.append( corner.
x() );
51 y.append( corner.
y() );
52 z.append( corner.
z() );
54 transform.transformInPlace( x, y, z, direction );
56 const auto minMaxX = std::minmax_element( x.constBegin(), x.constEnd() );
57 const auto minMaxY = std::minmax_element( y.constBegin(), y.constEnd() );
58 const auto minMaxZ = std::minmax_element( z.constBegin(), z.constEnd() );
59 return QgsBox3D( *minMaxX.first, *minMaxY.first, *minMaxZ.first, *minMaxX.second, *minMaxY.second, *minMaxZ.second );
69 auto polygon = std::make_unique< QgsPolygon >();
71 const QVector< QgsVector3D > corners = mBox.
corners();
78 for (
int i = 0; i < 8; ++i )
81 x.append( corner.
x() );
82 y.append( corner.
y() );
83 z.append( corner.
z() );
88 transform.transformInPlace( x, y, z, direction );
91 auto mp = std::make_unique< QgsMultiPoint >( x, y );
TransformDirection
Indicates the direction (forward or inverse) of a transform.
Abstract base class for all geometries.
A 3-dimensional box composed of x, y, z coordinates.
Does vector analysis using the GEOS library and handles import, export, and exception handling.
QgsAbstractGeometry * convexHull(QString *errorMsg=nullptr) const override
Calculate the convex hull of this.
A simple 4x4 matrix implementation useful for transformation in 3D space.
Represents a oriented (rotated) box in 3 dimensions.
QgsBox3D extent() const
Returns the overall bounding box of the object.
bool intersects(const QgsOrientedBox3D &other) const
Returns true if the box intersects the other box.
QVector< QgsVector3D > corners() const
Returns an array of all corners as 3D vectors.
QgsOrientedBox3D transformed(const QgsMatrix4x4 &transform) const
Returns box transformed by a 4x4 matrix.
QgsOrientedBox3D box() const
Returns the volume's oriented box.
bool intersects(const QgsOrientedBox3D &box) const
Returns true if this bounds intersects the specified box.
QgsTiledSceneBoundingVolume(const QgsOrientedBox3D &box=QgsOrientedBox3D())
Constructor for QgsTiledSceneBoundingVolume, with the specified oriented box.
void transform(const QgsMatrix4x4 &transform)
Applies a transform to the bounding volume.
QgsAbstractGeometry * as2DGeometry(const QgsCoordinateTransform &transform=QgsCoordinateTransform(), Qgis::TransformDirection direction=Qgis::TransformDirection::Forward) const
Returns a new geometry representing the 2-dimensional X/Y center slice of the volume.
QgsBox3D bounds(const QgsCoordinateTransform &transform=QgsCoordinateTransform(), Qgis::TransformDirection direction=Qgis::TransformDirection::Forward) const
Returns the axis aligned bounding box of the volume.
A 3D vector (similar to QVector3D) with the difference that it uses double precision instead of singl...
double y() const
Returns Y coordinate.
double z() const
Returns Z coordinate.
double x() const
Returns X coordinate.