Struct cxx_qt_lib::QVector3D
source · #[repr(C)]pub struct QVector3D { /* private fields */ }
Expand description
The QVector3D class represents a vector or vertex in 3D space.
Implementations§
source§impl QVector3D
impl QVector3D
sourcepub fn length_squared(&self) -> f32
pub fn length_squared(&self) -> f32
Returns the squared length of the vector from the origin. This is equivalent to the dot product of the vector with itself.
source§impl QVector3D
impl QVector3D
sourcepub fn normalized(&self) -> QVector3D
pub fn normalized(&self) -> QVector3D
Returns the normalized unit vector form of this vector.
If this vector is null, then a null vector is returned. If the length of the vector is very close to 1, then the vector will be returned as-is. Otherwise the normalized form of the vector of length 1 will be returned.
source§impl QVector3D
impl QVector3D
sourcepub fn new(xpos: f32, ypos: f32, zpos: f32) -> Self
pub fn new(xpos: f32, ypos: f32, zpos: f32) -> Self
Constructs a vector with coordinates (xpos, ypos, zpos). All parameters must be finite.
sourcepub fn distance_to_line(&self, point: QVector3D, direction: QVector3D) -> f32
pub fn distance_to_line(&self, point: QVector3D, direction: QVector3D) -> f32
Returns the distance that this vertex is from a line defined by point and the unit vector direction.
If direction is a null vector, then it does not define a line. In that case, the distance from point to this vertex is returned.
sourcepub fn distance_to_plane(&self, point: QVector3D, normal: QVector3D) -> f32
pub fn distance_to_plane(&self, point: QVector3D, normal: QVector3D) -> f32
Returns the distance from this vertex to a plane defined by the vertex plane and a normal unit vector. The normal parameter is assumed to have been normalized to a unit vector.
The return value will be negative if the vertex is below the plane, or zero if it is on the plane.
sourcepub fn distance_to_point(&self, point: QVector3D) -> f32
pub fn distance_to_point(&self, point: QVector3D) -> f32
Returns the distance from this vertex to a point defined by the vertex point.