QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
QgsRay3D Class Reference

A representation of a ray in 3D. More...

#include <qgsray3d.h>

Public Member Functions

 QgsRay3D (const QVector3D &origin, const QVector3D &direction)
 Constructor.
double angleToPoint (const QVector3D &point) const
 Returns the angle between the ray and the vector from the ray's origin and the point point.
QVector3D direction () const
 Returns the direction of the ray see setDirection().
QVector3D directionInversed () const
 Returns a vector with the direction components inversed ( 1/x, 1/y, 1/z) This can be used as an optimization when used in intersection logic.
bool isInFront (const QVector3D &point) const
 Checks whether the point is in front of the ray.
QVector3D origin () const
 Returns the origin of the ray.
QVector3D point (float distance) const
 Returns the point along the ray with the specified distance from the ray's origin.
float projectedDistance (const QVector3D &point) const
 Returns the distance of the projection of a point to the ray.
QVector3D projectedPoint (const QVector3D &point) const
 Returns the projection of the point on the ray (which is the closest point of the ray to point).
void setDirection (const QVector3D direction)
 Sets the direction of the ray.
void setOrigin (const QVector3D &origin)
 Sets the origin of the ray.

Detailed Description

A representation of a ray in 3D.

A ray is composed of an origin point (the start of the ray) and a direction vector.

Since
QGIS 3.18

Definition at line 30 of file qgsray3d.h.

Constructor & Destructor Documentation

◆ QgsRay3D()

QgsRay3D::QgsRay3D ( const QVector3D & origin,
const QVector3D & direction )

Constructor.

Note
: the direction is automatically normalized

Definition at line 19 of file qgsray3d.cpp.

Member Function Documentation

◆ angleToPoint()

double QgsRay3D::angleToPoint ( const QVector3D & point) const

Returns the angle between the ray and the vector from the ray's origin and the point point.

Definition at line 57 of file qgsray3d.cpp.

◆ direction()

QVector3D QgsRay3D::direction ( ) const
inline

Returns the direction of the ray see setDirection().

Definition at line 50 of file qgsray3d.h.

◆ directionInversed()

QVector3D QgsRay3D::directionInversed ( ) const
inline

Returns a vector with the direction components inversed ( 1/x, 1/y, 1/z) This can be used as an optimization when used in intersection logic.

see direction()

Definition at line 57 of file qgsray3d.h.

◆ isInFront()

bool QgsRay3D::isInFront ( const QVector3D & point) const

Checks whether the point is in front of the ray.

Definition at line 52 of file qgsray3d.cpp.

◆ origin()

QVector3D QgsRay3D::origin ( ) const
inline

Returns the origin of the ray.

See also
setOrigin()

Definition at line 44 of file qgsray3d.h.

◆ point()

QVector3D QgsRay3D::point ( float distance) const

Returns the point along the ray with the specified distance from the ray's origin.

Definition at line 68 of file qgsray3d.cpp.

◆ projectedDistance()

float QgsRay3D::projectedDistance ( const QVector3D & point) const

Returns the distance of the projection of a point to the ray.

Definition at line 47 of file qgsray3d.cpp.

◆ projectedPoint()

QVector3D QgsRay3D::projectedPoint ( const QVector3D & point) const

Returns the projection of the point on the ray (which is the closest point of the ray to point).

Definition at line 42 of file qgsray3d.cpp.

◆ setDirection()

void QgsRay3D::setDirection ( const QVector3D direction)

Sets the direction of the ray.

Note
: the direction is automatically normalized
See also
direction()

Definition at line 34 of file qgsray3d.cpp.

◆ setOrigin()

void QgsRay3D::setOrigin ( const QVector3D & origin)

Sets the origin of the ray.

See also
origin()

Definition at line 29 of file qgsray3d.cpp.


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