QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
QgsVector3D Class Reference

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

#include <qgsvector3d.h>

Public Member Functions

 QgsVector3D ()=default
 Constructs a null vector.
 
 QgsVector3D (const QVector3D &v)
 Constructs a vector from single-precision QVector3D.
 
 QgsVector3D (double x, double y, double z)
 Constructs a vector from given coordinates.
 
double distance (const QgsVector3D &other) const
 Returns the distance with the other QgsVector3D.
 
bool isNull () const
 Returns true if all three coordinates are zero.
 
double length () const
 Returns the length of the vector.
 
void normalize ()
 Normalizes the current vector in place.
 
bool operator!= (const QgsVector3D &other) const
 
QgsVector3D operator* (const double factor) const
 Returns a new vector multiplied by scalar.
 
QgsVector3D operator+ (const QgsVector3D &other) const
 Returns sum of two vectors.
 
const QgsVector3D operator- () const
 Swaps the sign of the components of the vector.
 
QgsVector3D operator- (const QgsVector3D &other) const
 Returns difference of two vectors.
 
QgsVector3D operator/ (const double factor) const
 Returns a new vector divided by scalar.
 
bool operator== (const QgsVector3D &other) const
 
void set (double x, double y, double z)
 Sets vector coordinates.
 
void setX (double x)
 Sets X coordinate.
 
void setY (double y)
 Sets Y coordinate.
 
void setZ (double z)
 Sets Z coordinate.
 
QString toString (int precision=17) const
 Returns a string representation of the 3D vector.
 
QVector3D toVector3D () const
 Converts the current object to QVector3D.
 
double x () const
 Returns X coordinate.
 
double y () const
 Returns Y coordinate.
 
double z () const
 Returns Z coordinate.
 

Static Public Member Functions

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

Detailed Description

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

Definition at line 30 of file qgsvector3d.h.

Constructor & Destructor Documentation

◆ QgsVector3D() [1/3]

QgsVector3D::QgsVector3D ( )
default

Constructs a null vector.

◆ QgsVector3D() [2/3]

QgsVector3D::QgsVector3D ( double  x,
double  y,
double  z 
)
inline

Constructs a vector from given coordinates.

Definition at line 37 of file qgsvector3d.h.

◆ QgsVector3D() [3/3]

QgsVector3D::QgsVector3D ( const QVector3D &  v)
inline

Constructs a vector from single-precision QVector3D.

Definition at line 41 of file qgsvector3d.h.

Member Function Documentation

◆ crossProduct()

static QgsVector3D QgsVector3D::crossProduct ( const QgsVector3D v1,
const QgsVector3D v2 
)
inlinestatic

Returns the cross product of two vectors.

Definition at line 132 of file qgsvector3d.h.

◆ distance()

double QgsVector3D::distance ( const QgsVector3D other) const
inline

Returns the distance with the other QgsVector3D.

Definition at line 158 of file qgsvector3d.h.

◆ dotProduct()

static double QgsVector3D::dotProduct ( const QgsVector3D v1,
const QgsVector3D v2 
)
inlinestatic

Returns the dot product of two vectors.

Definition at line 126 of file qgsvector3d.h.

◆ isNull()

bool QgsVector3D::isNull ( ) const
inline

Returns true if all three coordinates are zero.

Definition at line 45 of file qgsvector3d.h.

◆ length()

double QgsVector3D::length ( ) const
inline

Returns the length of the vector.

Definition at line 140 of file qgsvector3d.h.

◆ normalize()

void QgsVector3D::normalize ( )
inline

Normalizes the current vector in place.

Definition at line 146 of file qgsvector3d.h.

◆ operator!=()

bool QgsVector3D::operator!= ( const QgsVector3D other) const
inline

Definition at line 85 of file qgsvector3d.h.

◆ operator*()

QgsVector3D QgsVector3D::operator* ( const double  factor) const
inline

Returns a new vector multiplied by scalar.

Definition at line 113 of file qgsvector3d.h.

◆ operator+()

QgsVector3D QgsVector3D::operator+ ( const QgsVector3D other) const
inline

Returns sum of two vectors.

Definition at line 91 of file qgsvector3d.h.

◆ operator-() [1/2]

const QgsVector3D QgsVector3D::operator- ( ) const
inline

Swaps the sign of the components of the vector.

Since
QGIS 3.40

Definition at line 107 of file qgsvector3d.h.

◆ operator-() [2/2]

QgsVector3D QgsVector3D::operator- ( const QgsVector3D other) const
inline

Returns difference of two vectors.

Definition at line 97 of file qgsvector3d.h.

◆ operator/()

QgsVector3D QgsVector3D::operator/ ( const double  factor) const
inline

Returns a new vector divided by scalar.

Definition at line 120 of file qgsvector3d.h.

◆ operator==()

bool QgsVector3D::operator== ( const QgsVector3D other) const
inline

Definition at line 81 of file qgsvector3d.h.

◆ perpendicularPoint()

static QgsVector3D QgsVector3D::perpendicularPoint ( const QgsVector3D v1,
const QgsVector3D v2,
const QgsVector3D vp 
)
inlinestatic

Returns the perpendicular point of vector vp from [v1 - v2].

Definition at line 166 of file qgsvector3d.h.

◆ set()

void QgsVector3D::set ( double  x,
double  y,
double  z 
)
inline

Sets vector coordinates.

Definition at line 73 of file qgsvector3d.h.

◆ setX()

void QgsVector3D::setX ( double  x)
inline

Sets X coordinate.

Since
QGIS 3.34

Definition at line 58 of file qgsvector3d.h.

◆ setY()

void QgsVector3D::setY ( double  y)
inline

Sets Y coordinate.

Since
QGIS 3.34

Definition at line 64 of file qgsvector3d.h.

◆ setZ()

void QgsVector3D::setZ ( double  z)
inline

Sets Z coordinate.

Since
QGIS 3.34

Definition at line 70 of file qgsvector3d.h.

◆ toString()

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

Returns a string representation of the 3D vector.

Members will be truncated to the specified precision.

Definition at line 179 of file qgsvector3d.h.

◆ toVector3D()

QVector3D QgsVector3D::toVector3D ( ) const
inline

Converts the current object to QVector3D.

Warning
the conversion may decrease the accuracy (double to float values conversion)
Since
QGIS 3.24

Definition at line 196 of file qgsvector3d.h.

◆ x()

double QgsVector3D::x ( ) const
inline

Returns X coordinate.

Definition at line 48 of file qgsvector3d.h.

◆ y()

double QgsVector3D::y ( ) const
inline

Returns Y coordinate.

Definition at line 50 of file qgsvector3d.h.

◆ z()

double QgsVector3D::z ( ) const
inline

Returns Z coordinate.

Definition at line 52 of file qgsvector3d.h.


The documentation for this class was generated from the following file: