QgsVector3D class

3 Class for storage of 3D vectors similar to QVector3D, with the difference that it uses double precision instead of single precision floating point numbers.

Public static functions

static auto crossProduct(const QgsVector3D& v1, const QgsVector3D& v2) -> QgsVector3D
Returns the cross product of two vectors.
static auto dotProduct(const QgsVector3D& v1, const QgsVector3D& v2) -> double
Returns the dot product of two vectors.
static auto perpendicularPoint(const QgsVector3D& v1, const QgsVector3D& v2, const QgsVector3D& vp) -> QgsVector3D
Returns the perpendicular point of vector vp from [v1 - v2].

Constructors, destructors, conversion operators

QgsVector3D() defaulted
Constructs a null vector.
QgsVector3D(double x, double y, double z)
Constructs a vector from given coordinates.
QgsVector3D(const QVector3D& v)
Constructs a vector from single-precision QVector3D.

Public functions

auto distance(const QgsVector3D& other) const -> double
Returns the distance with the other QgsVector3.
auto isNull() const -> bool
Returns true if all three coordinates are zero.
auto length() const -> double
Returns the length of the vector.
void normalize()
Normalizes the current vector in place.
auto operator*(const double factor) const -> QgsVector3D
Returns a new vector multiplied by scalar.
auto operator+(const QgsVector3D& other) const -> QgsVector3D
Returns sum of two vectors.
auto operator-(const QgsVector3D& other) const -> QgsVector3D
Returns difference of two vectors.
auto operator/(const double factor) const -> QgsVector3D
Returns a new vector divided by scalar.
void set(double x, double y, double z)
Sets vector coordinates.
auto toString(int precision = 17) const -> QString
Returns a string representation of the 3D vector.
auto x() const -> double
Returns X coordinate.
auto y() const -> double
Returns Y coordinate.
auto z() const -> double
Returns Z coordinate.

Function documentation

QString QgsVector3D::toString(int precision = 17) const

Returns a string representation of the 3D vector.

Members will be truncated to the specified precision.