Class: QgsRay3D

A representation of a ray in 3D.

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

Added in version 3.18.

Methods

angleToPoint

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

direction

Returns the direction of the ray see setDirection()

directionInversed

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.

isInFront

Checks whether the point is in front of the ray

origin

Returns the origin of the ray

point

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

projectedDistance

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

projectedPoint

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

setDirection

Sets the direction of the ray

setOrigin

Sets the origin of the ray

class qgis.core.QgsRay3D[source]

Bases: object

__init__(origin: QVector3D, direction: QVector3D)

Constructor

Note

: the direction is automatically normalized

Parameters:
  • origin (QVector3D)

  • direction (QVector3D)

__init__(a0: QgsRay3D)
Parameters:

a0 (QgsRay3D)

angleToPoint(self, point: QVector3D) float[source]

Returns the angle between the ray and the vector from the ray’s origin and the point point

Parameters:

point (QVector3D)

Return type:

float

direction(self) QVector3D[source]

Returns the direction of the ray see setDirection()

Return type:

QVector3D

directionInversed(self) QVector3D[source]

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()

Return type:

QVector3D

isInFront(self, point: QVector3D) bool[source]

Checks whether the point is in front of the ray

Parameters:

point (QVector3D)

Return type:

bool

origin(self) QVector3D[source]

Returns the origin of the ray

See also

setOrigin()

Return type:

QVector3D

point(self, distance: float) QVector3D[source]

Returns the point along the ray with the specified distance from the ray’s origin

Parameters:

distance (float)

Return type:

QVector3D

projectedDistance(self, point: QVector3D) float[source]

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

Parameters:

point (QVector3D)

Return type:

float

projectedPoint(self, point: QVector3D) QVector3D[source]

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

Parameters:

point (QVector3D)

Return type:

QVector3D

setDirection(self, direction: QVector3D)[source]

Sets the direction of the ray

Note

: the direction is automatically normalized

See also

direction()

Parameters:

direction (QVector3D)

setOrigin(self, origin: QVector3D)[source]

Sets the origin of the ray

See also

origin()

Parameters:

origin (QVector3D)