QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
19 #include "qgis_core.h"
39 : mX( x ), mY( y ), mZ( z ) {}
43 : mX( v.x() ), mY( v.y() ), mZ( v.z() ) {}
46 bool isNull()
const {
return mX == 0 && mY == 0 && mZ == 0; }
49 double x()
const {
return mX; }
51 double y()
const {
return mY; }
53 double z()
const {
return mZ; }
56 void set(
double x,
double y,
double z )
66 return mX == other.mX && mY == other.mY && mZ == other.mZ;
76 return QgsVector3D( mX + other.mX, mY + other.mY, mZ + other.mZ );
82 return QgsVector3D( mX - other.mX, mY - other.mY, mZ - other.mZ );
89 return QgsVector3D( mX * factor, mY * factor, mZ * factor );
95 return QgsVector3D( mX / factor, mY / factor, mZ / factor );
101 return v1.
x() * v2.
x() + v1.
y() * v2.
y() + v1.
z() * v2.
z();
108 v1.
z() * v2.
x() - v1.
x() * v2.
z(),
109 v1.
x() * v2.
y() - v1.
y() * v2.
x() );
113 double length()
const
115 return sqrt( mX * mX + mY * mY + mZ * mZ );
121 const double len = length();
133 return std::sqrt( ( mX - other.
x() ) * ( mX - other.
x() ) +
134 ( mY - other.
y() ) * ( mY - other.
y() ) +
135 ( mZ - other.
z() ) * ( mZ - other.
z() ) );
143 const double t = dotProduct( v, d );
154 QString
str =
"Vector3D (";
169 QVector3D toVector3D()
const {
return QVector3D( mX, mY, mZ ); }
172 SIP_PYOBJECT __repr__();
174 QString
str = QStringLiteral(
"<QgsVector3D: %1>" ).arg( sipCpp->toString() );
175 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
179 double mX = 0, mY = 0, mZ = 0;
182 #endif // QGSVECTOR3D_H
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
double y() const
Returns Y coordinate.
Class for storage of 3D vectors similar to QVector3D, with the difference that it uses double precisi...
QgsMargins operator/(const QgsMargins &margins, double divisor)
Returns a QgsMargins object that is formed by dividing the components of the given margins by the giv...
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
QString qgsDoubleToString(double a, int precision=17)
Returns a string representation of a double.
double z() const
Returns Z coordinate.
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
QgsMargins operator*(const QgsMargins &margins, double factor)
Returns a QgsMargins object that is formed by multiplying each component of the given margins by fact...
double distance(const QgsVector3D &other) const
Returns the distance with the other QgsVector3.
QgsInterval operator-(const QDateTime &dt1, const QDateTime &dt2)
Returns the interval between two datetimes.
QDateTime operator+(const QDateTime &start, const QgsInterval &interval)
Adds an interval to a datetime.
double x() const
Returns X coordinate.