QGIS API Documentation
4.3.0-Master (9dce731a7a1)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
geometry
qgsorientedbox3d.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsorientedbox3d.h
3
--------------------
4
begin : July 2023
5
copyright : (C) 2023 by Nyall Dawson
6
email : nyall dot dawson at gmail dot com
7
******************************************************************
8
***************************************************************************/
9
10
/***************************************************************************
11
* *
12
* This program is free software; you can redistribute it and/or modify *
13
* it under the terms of the GNU General Public License as published by *
14
* the Free Software Foundation; either version 2 of the License, or *
15
* (at your option) any later version. *
16
* *
17
***************************************************************************/
18
19
#ifndef QGSORIENTEDBOX3D_H
20
#define QGSORIENTEDBOX3D_H
21
22
#include <limits>
23
24
#include "
qgis.h
"
25
#include "qgis_core.h"
26
#include "
qgis_sip.h
"
27
#include "
qgsvector3d.h
"
28
29
#include <QList>
30
#include <QString>
31
32
using namespace
Qt::StringLiterals;
33
34
class
QgsBox3D
;
35
class
QgsCoordinateTransform
;
36
class
QgsMatrix4x4
;
37
47
class
CORE_EXPORT
QgsOrientedBox3D
48
{
49
public
:
53
QgsOrientedBox3D
();
54
58
QgsOrientedBox3D
(
const
QList<double> &
center
,
const
QList< double > &
halfAxes
);
59
63
QgsOrientedBox3D
(
const
QgsVector3D
&
center
,
const
QList< QgsVector3D > &
halfAxes
);
64
69
QgsOrientedBox3D
(
const
QgsVector3D
&
center
,
const
QgsVector3D
&halfSizes,
const
QQuaternion &quaternion );
70
74
static
QgsOrientedBox3D
fromBox3D
(
const
QgsBox3D
&box );
75
76
// clang-format off
77
bool
operator==
(
const
QgsOrientedBox3D
&other )
const
SIP_HOLDGIL
78
// clang-format on
79
{
80
return
qgsDoubleNear
( mCenter[0], other.mCenter[0] )
81
&&
qgsDoubleNear
( mCenter[1], other.mCenter[1] )
82
&&
qgsDoubleNear
( mCenter[2], other.mCenter[2] )
83
&&
qgsDoubleNear
( mHalfAxes[0], other.mHalfAxes[0] )
84
&&
qgsDoubleNear
( mHalfAxes[1], other.mHalfAxes[1] )
85
&&
qgsDoubleNear
( mHalfAxes[2], other.mHalfAxes[2] )
86
&&
qgsDoubleNear
( mHalfAxes[3], other.mHalfAxes[3] )
87
&&
qgsDoubleNear
( mHalfAxes[4], other.mHalfAxes[4] )
88
&&
qgsDoubleNear
( mHalfAxes[5], other.mHalfAxes[5] )
89
&&
qgsDoubleNear
( mHalfAxes[6], other.mHalfAxes[6] )
90
&&
qgsDoubleNear
( mHalfAxes[7], other.mHalfAxes[7] )
91
&&
qgsDoubleNear
( mHalfAxes[8], other.mHalfAxes[8] );
92
}
93
94
bool
operator!=
(
const
QgsOrientedBox3D
&other )
const
SIP_HOLDGIL
95
{
96
return
!( *
this
== other );
97
}
98
102
bool
isNull() const
SIP_HOLDGIL
;
103
110
double
centerX
() const
SIP_HOLDGIL
{
return
mCenter[0]; }
111
118
double
centerY
() const
SIP_HOLDGIL
{
return
mCenter[1]; }
119
126
double
centerZ
() const
SIP_HOLDGIL
{
return
mCenter[2]; }
127
131
QgsVector3D
center
() const
SIP_HOLDGIL
{
return
QgsVector3D
( mCenter[0], mCenter[1], mCenter[2] ); }
132
136
const
double
*
halfAxes
() const
SIP_SKIP
{
return
mHalfAxes; }
137
141
QList< double > halfAxesList() const
SIP_HOLDGIL
SIP_PYNAME
( halfAxes );
142
146
QgsBox3D
extent() const
SIP_HOLDGIL
;
147
151
QVector<
QgsVector3D
> corners() const
SIP_HOLDGIL
;
152
156
QgsVector3D
size() const
SIP_HOLDGIL
;
157
162
double
longestSide() const
SIP_HOLDGIL
;
163
169
QgsBox3D
reprojectedExtent( const
QgsCoordinateTransform
&ct ) const
SIP_THROW
(
QgsCsException
)
SIP_HOLDGIL
;
170
174
QgsOrientedBox3D
transformed( const
QgsMatrix4x4
&transform ) const
SIP_HOLDGIL
;
175
179
bool
intersects( const
QgsOrientedBox3D
&other ) const
SIP_HOLDGIL
;
180
181
#ifdef SIP_RUN
182
// clang-format off
183
SIP_PYOBJECT __repr__();
184
% MethodCode
185
QString str = u
"<QgsOrientedBox3D([%1, %2, %3], [%4, %5, %6, %7, %8, %9, %10, %11, %12])>"
_s
186
.arg( sipCpp->centerX() )
187
.arg( sipCpp->centerY() )
188
.arg( sipCpp->centerZ() )
189
.arg( sipCpp->halfAxes()[0] )
190
.arg( sipCpp->halfAxes()[1] )
191
.arg( sipCpp->halfAxes()[2] )
192
.arg( sipCpp->halfAxes()[3] )
193
.arg( sipCpp->halfAxes()[4] )
194
.arg( sipCpp->halfAxes()[5] )
195
.arg( sipCpp->halfAxes()[6] )
196
.arg( sipCpp->halfAxes()[7] )
197
.arg( sipCpp->halfAxes()[8] );
198
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
199
% End
200
// clang-format on
201
#endif
202
203
private
:
204
205
double
mCenter[ 3 ] { std::numeric_limits< double >::quiet_NaN(), std::numeric_limits< double >::quiet_NaN(), std::numeric_limits< double >::quiet_NaN() };
206
double
mHalfAxes[9] { 1, 0, 0, 0, 1, 0, 0, 0, 1 };
207
208
friend
class
QgsCesiumUtils
;
209
210
};
211
212
213
#endif
// QGSORIENTEDBOX3D_H
QgsBox3D
A 3-dimensional box composed of x, y, z coordinates.
Definition
qgsbox3d.h:45
QgsCoordinateTransform
Handles coordinate transforms between two coordinate systems.
Definition
qgscoordinatetransform.h:63
QgsCsException
Custom exception class for Coordinate Reference System related exceptions.
Definition
qgsexception.h:60
QgsMatrix4x4
A simple 4x4 matrix implementation useful for transformation in 3D space.
Definition
qgsmatrix4x4.h:42
QgsOrientedBox3D
Represents a oriented (rotated) box in 3 dimensions.
Definition
qgsorientedbox3d.h:48
QgsOrientedBox3D::halfAxes
const double * halfAxes() const
Returns the half axes matrix;.
Definition
qgsorientedbox3d.h:136
QgsOrientedBox3D::QgsCesiumUtils
friend class QgsCesiumUtils
Definition
qgsorientedbox3d.h:208
QgsOrientedBox3D::centerZ
double centerZ() const
Returns the center z-coordinate.
Definition
qgsorientedbox3d.h:126
QgsOrientedBox3D::QgsOrientedBox3D
QgsOrientedBox3D()
Constructor for a null oriented box.
QgsOrientedBox3D::operator==
bool operator==(const QgsOrientedBox3D &other) const
Definition
qgsorientedbox3d.h:77
QgsOrientedBox3D::operator!=
bool operator!=(const QgsOrientedBox3D &other) const
Definition
qgsorientedbox3d.h:94
QgsOrientedBox3D::fromBox3D
static QgsOrientedBox3D fromBox3D(const QgsBox3D &box)
Constructs an oriented box from an axis-aligned bounding box.
Definition
qgsorientedbox3d.cpp:83
QgsOrientedBox3D::centerX
double centerX() const
Returns the center x-coordinate.
Definition
qgsorientedbox3d.h:110
QgsOrientedBox3D::centerY
double centerY() const
Returns the center y-coordinate.
Definition
qgsorientedbox3d.h:118
QgsOrientedBox3D::center
QgsVector3D center() const
Returns the vector to the center of the box.
Definition
qgsorientedbox3d.h:131
QgsVector3D
A 3D vector (similar to QVector3D) with the difference that it uses double precision instead of singl...
Definition
qgsvector3d.h:33
qgis.h
qgsDoubleNear
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference).
Definition
qgis.h:7783
qgis_sip.h
SIP_SKIP
#define SIP_SKIP
Definition
qgis_sip.h:138
SIP_PYNAME
#define SIP_PYNAME(name)
Definition
qgis_sip.h:88
SIP_HOLDGIL
#define SIP_HOLDGIL
Definition
qgis_sip.h:183
SIP_THROW
#define SIP_THROW(name,...)
Definition
qgis_sip.h:215
qgsvector3d.h
Generated on
for QGIS API Documentation by
1.17.0