Struct qt_gui::QVector3D

source ·
#[repr(C)]
pub struct QVector3D { /* private fields */ }
Expand description

The QVector3D class represents a vector or vertex in 3D space.

C++ class: QVector3D.

C++ documentation:

The QVector3D class represents a vector or vertex in 3D space.

Vectors are one of the main building blocks of 3D representation and drawing. They consist of three coordinates, traditionally called x, y, and z.

The QVector3D class can also be used to represent vertices in 3D space. We therefore do not need to provide a separate vertex class.

Implementations§

source§

impl QVector3D

source

pub unsafe fn add_assign( &self, vector: impl CastInto<Ref<QVector3D>> ) -> Ref<QVector3D>

Adds the given vector to this vector and returns a reference to this vector.

Calls C++ function: QVector3D& QVector3D::operator+=(const QVector3D& vector).

C++ documentation:

Adds the given vector to this vector and returns a reference to this vector.

See also operator-=().

source

pub unsafe fn copy_from( &self, other: impl CastInto<Ref<QVector3D>> ) -> Ref<QVector3D>

The QVector3D class represents a vector or vertex in 3D space.

Calls C++ function: QVector3D& QVector3D::operator=(const QVector3D& other).

C++ documentation:

The QVector3D class represents a vector or vertex in 3D space.

Vectors are one of the main building blocks of 3D representation and drawing. They consist of three coordinates, traditionally called x, y, and z.

The QVector3D class can also be used to represent vertices in 3D space. We therefore do not need to provide a separate vertex class.

source

pub unsafe fn cross_product( v1: impl CastInto<Ref<QVector3D>>, v2: impl CastInto<Ref<QVector3D>> ) -> CppBox<QVector3D>

Returns the cross-product of vectors v1 and v2, which corresponds to the normal vector of a plane defined by v1 and v2.

Calls C++ function: static QVector3D QVector3D::crossProduct(const QVector3D& v1, const QVector3D& v2).

C++ documentation:

Returns the cross-product of vectors v1 and v2, which corresponds to the normal vector of a plane defined by v1 and v2.

See also normal().

source

pub unsafe fn distance_to_line( &self, point: impl CastInto<Ref<QVector3D>>, direction: impl CastInto<Ref<QVector3D>> ) -> c_float

Returns the distance that this vertex is from a line defined by point and the unit vector direction.

Calls C++ function: float QVector3D::distanceToLine(const QVector3D& point, const QVector3D& direction) const.

C++ documentation:

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.

See also distanceToPlane().

source

pub unsafe fn distance_to_plane_2a( &self, plane: impl CastInto<Ref<QVector3D>>, normal: impl CastInto<Ref<QVector3D>> ) -> c_float

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.

Calls C++ function: float QVector3D::distanceToPlane(const QVector3D& plane, const QVector3D& normal) const.

C++ documentation:

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.

See also normal() and distanceToLine().

source

pub unsafe fn distance_to_plane_3a( &self, plane1: impl CastInto<Ref<QVector3D>>, plane2: impl CastInto<Ref<QVector3D>>, plane3: impl CastInto<Ref<QVector3D>> ) -> c_float

This is an overloaded function.

Calls C++ function: float QVector3D::distanceToPlane(const QVector3D& plane1, const QVector3D& plane2, const QVector3D& plane3) const.

C++ documentation:

This is an overloaded function.

Returns the distance from this vertex a plane defined by the vertices plane1, plane2 and plane3.

The return value will be negative if the vertex is below the plane, or zero if it is on the plane.

The two vectors that define the plane are plane2 - plane1 and plane3 - plane1.

See also normal() and distanceToLine().

source

pub unsafe fn distance_to_point( &self, point: impl CastInto<Ref<QVector3D>> ) -> c_float

Returns the distance from this vertex to a point defined by the vertex point.

Calls C++ function: float QVector3D::distanceToPoint(const QVector3D& point) const.

C++ documentation:

Returns the distance from this vertex to a point defined by the vertex point.

This function was introduced in Qt 5.1.

See also distanceToPlane() and distanceToLine().

source

pub unsafe fn div_assign_float(&self, divisor: c_float) -> Ref<QVector3D>

Divides this vector's coordinates by the given divisor, and returns a reference to this vector.

Calls C++ function: QVector3D& QVector3D::operator/=(float divisor).

C++ documentation:

Divides this vector’s coordinates by the given divisor, and returns a reference to this vector.

See also operator*=().

source

pub unsafe fn div_assign_q_vector_3d( &self, vector: impl CastInto<Ref<QVector3D>> ) -> Ref<QVector3D>

Divides the components of this vector by the corresponding components in vector.

Calls C++ function: QVector3D& QVector3D::operator/=(const QVector3D& vector).

C++ documentation:

Divides the components of this vector by the corresponding components in vector.

This function was introduced in Qt 5.5.

See also operator*=().

source

pub unsafe fn dot_product( v1: impl CastInto<Ref<QVector3D>>, v2: impl CastInto<Ref<QVector3D>> ) -> c_float

Returns the dot product of v1 and v2.

Calls C++ function: static float QVector3D::dotProduct(const QVector3D& v1, const QVector3D& v2).

C++ documentation:

Returns the dot product of v1 and v2.

source

pub unsafe fn index_mut(&self, i: c_int) -> *mut c_float

Returns the component of the vector at index position i as a modifiable reference.

Calls C++ function: float& QVector3D::operator[](int i).

C++ documentation:

Returns the component of the vector at index position i as a modifiable reference.

i must be a valid index position in the vector (i.e., 0 <= i < 3).

This function was introduced in Qt 5.2.

source

pub unsafe fn index(&self, i: c_int) -> c_float

Returns the component of the vector at index position i.

Calls C++ function: float QVector3D::operator[](int i) const.

C++ documentation:

Returns the component of the vector at index position i.

i must be a valid index position in the vector (i.e., 0 <= i < 3).

This function was introduced in Qt 5.2.

source

pub unsafe fn is_null(&self) -> bool

Returns true if the x, y, and z coordinates are set to 0.0, otherwise returns false.

Calls C++ function: bool QVector3D::isNull() const.

C++ documentation:

Returns true if the x, y, and z coordinates are set to 0.0, otherwise returns false.

source

pub unsafe fn length(&self) -> c_float

Returns the length of the vector from the origin.

Calls C++ function: float QVector3D::length() const.

C++ documentation:

Returns the length of the vector from the origin.

See also lengthSquared() and normalized().

source

pub unsafe fn length_squared(&self) -> c_float

Returns the squared length of the vector from the origin. This is equivalent to the dot product of the vector with itself.

Calls C++ function: float QVector3D::lengthSquared() const.

C++ documentation:

Returns the squared length of the vector from the origin. This is equivalent to the dot product of the vector with itself.

See also length() and dotProduct().

source

pub unsafe fn mul_assign_float(&self, factor: c_float) -> Ref<QVector3D>

Multiplies this vector's coordinates by the given factor, and returns a reference to this vector.

Calls C++ function: QVector3D& QVector3D::operator*=(float factor).

C++ documentation:

Multiplies this vector’s coordinates by the given factor, and returns a reference to this vector.

See also operator/=().

source

pub unsafe fn mul_assign_q_vector_3d( &self, vector: impl CastInto<Ref<QVector3D>> ) -> Ref<QVector3D>

This is an overloaded function.

Calls C++ function: QVector3D& QVector3D::operator*=(const QVector3D& vector).

C++ documentation:

This is an overloaded function.

Multiplies the components of this vector by the corresponding components in vector.

Note: this is not the same as the crossProduct() of this vector and vector.

See also crossProduct().

source

pub unsafe fn neg(&self) -> CppBox<QVector3D>

Calls C++ function: QVector3D operator-(const QVector3D& vector).

source

pub unsafe fn new() -> CppBox<QVector3D>

Constructs a null vector, i.e. with coordinates (0, 0, 0).

Calls C++ function: [constructor] void QVector3D::QVector3D().

C++ documentation:

Constructs a null vector, i.e. with coordinates (0, 0, 0).

source

pub unsafe fn from_3_float( xpos: c_float, ypos: c_float, zpos: c_float ) -> CppBox<QVector3D>

Constructs a vector with coordinates (xpos, ypos, zpos).

Calls C++ function: [constructor] void QVector3D::QVector3D(float xpos, float ypos, float zpos).

C++ documentation:

Constructs a vector with coordinates (xpos, ypos, zpos).

source

pub unsafe fn from_q_point( point: impl CastInto<Ref<QPoint>> ) -> CppBox<QVector3D>

Constructs a vector with x and y coordinates from a 2D point, and a z coordinate of 0.

Calls C++ function: [constructor] void QVector3D::QVector3D(const QPoint& point).

C++ documentation:

Constructs a vector with x and y coordinates from a 2D point, and a z coordinate of 0.

source

pub unsafe fn from_q_point_f( point: impl CastInto<Ref<QPointF>> ) -> CppBox<QVector3D>

Constructs a vector with x and y coordinates from a 2D point, and a z coordinate of 0.

Calls C++ function: [constructor] void QVector3D::QVector3D(const QPointF& point).

C++ documentation:

Constructs a vector with x and y coordinates from a 2D point, and a z coordinate of 0.

source

pub unsafe fn from_q_vector_2d( vector: impl CastInto<Ref<QVector2D>> ) -> CppBox<QVector3D>

Constructs a 3D vector from the specified 2D vector. The z coordinate is set to zero.

Calls C++ function: [constructor] void QVector3D::QVector3D(const QVector2D& vector).

C++ documentation:

Constructs a 3D vector from the specified 2D vector. The z coordinate is set to zero.

See also toVector2D().

source

pub unsafe fn from_q_vector_2d_float( vector: impl CastInto<Ref<QVector2D>>, zpos: c_float ) -> CppBox<QVector3D>

Constructs a 3D vector from the specified 2D vector. The z coordinate is set to zpos.

Calls C++ function: [constructor] void QVector3D::QVector3D(const QVector2D& vector, float zpos).

C++ documentation:

Constructs a 3D vector from the specified 2D vector. The z coordinate is set to zpos.

See also toVector2D().

source

pub unsafe fn from_q_vector_4d( vector: impl CastInto<Ref<QVector4D>> ) -> CppBox<QVector3D>

Constructs a 3D vector from the specified 4D vector. The w coordinate is dropped.

Calls C++ function: [constructor] void QVector3D::QVector3D(const QVector4D& vector).

C++ documentation:

Constructs a 3D vector from the specified 4D vector. The w coordinate is dropped.

See also toVector4D().

source

pub unsafe fn new_copy( other: impl CastInto<Ref<QVector3D>> ) -> CppBox<QVector3D>

The QVector3D class represents a vector or vertex in 3D space.

Calls C++ function: [constructor] void QVector3D::QVector3D(const QVector3D& other).

C++ documentation:

The QVector3D class represents a vector or vertex in 3D space.

Vectors are one of the main building blocks of 3D representation and drawing. They consist of three coordinates, traditionally called x, y, and z.

The QVector3D class can also be used to represent vertices in 3D space. We therefore do not need to provide a separate vertex class.

source

pub unsafe fn normal_2a( v1: impl CastInto<Ref<QVector3D>>, v2: impl CastInto<Ref<QVector3D>> ) -> CppBox<QVector3D>

Returns the normal vector of a plane defined by vectors v1 and v2, normalized to be a unit vector.

Calls C++ function: static QVector3D QVector3D::normal(const QVector3D& v1, const QVector3D& v2).

C++ documentation:

Returns the normal vector of a plane defined by vectors v1 and v2, normalized to be a unit vector.

Use crossProduct() to compute the cross-product of v1 and v2 if you do not need the result to be normalized to a unit vector.

See also crossProduct() and distanceToPlane().

source

pub unsafe fn normal_3a( v1: impl CastInto<Ref<QVector3D>>, v2: impl CastInto<Ref<QVector3D>>, v3: impl CastInto<Ref<QVector3D>> ) -> CppBox<QVector3D>

This is an overloaded function.

Calls C++ function: static QVector3D QVector3D::normal(const QVector3D& v1, const QVector3D& v2, const QVector3D& v3).

C++ documentation:

This is an overloaded function.

Returns the normal vector of a plane defined by vectors v2 - v1 and v3 - v1, normalized to be a unit vector.

Use crossProduct() to compute the cross-product of v2 - v1 and v3 - v1 if you do not need the result to be normalized to a unit vector.

See also crossProduct() and distanceToPlane().

source

pub unsafe fn normalize(&self)

Normalizes the currect vector in place. Nothing happens if this vector is a null vector or the length of the vector is very close to 1.

Calls C++ function: void QVector3D::normalize().

C++ documentation:

Normalizes the currect vector in place. Nothing happens if this vector is a null vector or the length of the vector is very close to 1.

See also length() and normalized().

source

pub unsafe fn normalized(&self) -> CppBox<QVector3D>

Returns the normalized unit vector form of this vector.

Calls C++ function: QVector3D QVector3D::normalized() const.

C++ documentation:

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.

See also length() and normalize().

source

pub unsafe fn project( &self, model_view: impl CastInto<Ref<QMatrix4X4>>, projection: impl CastInto<Ref<QMatrix4X4>>, viewport: impl CastInto<Ref<QRect>> ) -> CppBox<QVector3D>

Returns the window coordinates of this vector initially in object/model coordinates using the model view matrix modelView, the projection matrix projection and the viewport dimensions viewport.

Calls C++ function: QVector3D QVector3D::project(const QMatrix4x4& modelView, const QMatrix4x4& projection, const QRect& viewport) const.

C++ documentation:

Returns the window coordinates of this vector initially in object/model coordinates using the model view matrix modelView, the projection matrix projection and the viewport dimensions viewport.

When transforming from clip to normalized space, a division by the w component on the vector components takes place. To prevent dividing by 0 if w equals to 0, it is set to 1.

Note: the returned y coordinates are in OpenGL orientation. OpenGL expects the bottom to be 0 whereas for Qt top is 0.

This function was introduced in Qt 5.5.

See also unproject().

source

pub unsafe fn set_x(&self, x: c_float)

Sets the x coordinate of this point to the given x coordinate.

Calls C++ function: void QVector3D::setX(float x).

C++ documentation:

Sets the x coordinate of this point to the given x coordinate.

See also x(), setY(), and setZ().

source

pub unsafe fn set_y(&self, y: c_float)

Sets the y coordinate of this point to the given y coordinate.

Calls C++ function: void QVector3D::setY(float y).

C++ documentation:

Sets the y coordinate of this point to the given y coordinate.

See also y(), setX(), and setZ().

source

pub unsafe fn set_z(&self, z: c_float)

Sets the z coordinate of this point to the given z coordinate.

Calls C++ function: void QVector3D::setZ(float z).

C++ documentation:

Sets the z coordinate of this point to the given z coordinate.

See also z(), setX(), and setY().

source

pub unsafe fn sub_assign( &self, vector: impl CastInto<Ref<QVector3D>> ) -> Ref<QVector3D>

Subtracts the given vector from this vector and returns a reference to this vector.

Calls C++ function: QVector3D& QVector3D::operator-=(const QVector3D& vector).

C++ documentation:

Subtracts the given vector from this vector and returns a reference to this vector.

See also operator+=().

source

pub unsafe fn to_point(&self) -> CppBox<QPoint>

Returns the QPoint form of this 3D vector. The z coordinate is dropped.

Calls C++ function: QPoint QVector3D::toPoint() const.

C++ documentation:

Returns the QPoint form of this 3D vector. The z coordinate is dropped.

See also toPointF() and toVector2D().

source

pub unsafe fn to_point_f(&self) -> CppBox<QPointF>

Returns the QPointF form of this 3D vector. The z coordinate is dropped.

Calls C++ function: QPointF QVector3D::toPointF() const.

C++ documentation:

Returns the QPointF form of this 3D vector. The z coordinate is dropped.

See also toPoint() and toVector2D().

source

pub unsafe fn to_q_variant(&self) -> CppBox<QVariant>

Returns the 3D vector as a QVariant.

Calls C++ function: QVariant QVector3D::operator QVariant() const.

C++ documentation:

Returns the 3D vector as a QVariant.

source

pub unsafe fn to_vector_2d(&self) -> CppBox<QVector2D>

Returns the 2D vector form of this 3D vector, dropping the z coordinate.

Calls C++ function: QVector2D QVector3D::toVector2D() const.

C++ documentation:

Returns the 2D vector form of this 3D vector, dropping the z coordinate.

See also toVector4D() and toPoint().

source

pub unsafe fn to_vector_4d(&self) -> CppBox<QVector4D>

Returns the 4D form of this 3D vector, with the w coordinate set to zero.

Calls C++ function: QVector4D QVector3D::toVector4D() const.

C++ documentation:

Returns the 4D form of this 3D vector, with the w coordinate set to zero.

See also toVector2D() and toPoint().

source

pub unsafe fn unproject( &self, model_view: impl CastInto<Ref<QMatrix4X4>>, projection: impl CastInto<Ref<QMatrix4X4>>, viewport: impl CastInto<Ref<QRect>> ) -> CppBox<QVector3D>

Returns the object/model coordinates of this vector initially in window coordinates using the model view matrix modelView, the projection matrix projection and the viewport dimensions viewport.

Calls C++ function: QVector3D QVector3D::unproject(const QMatrix4x4& modelView, const QMatrix4x4& projection, const QRect& viewport) const.

C++ documentation:

Returns the object/model coordinates of this vector initially in window coordinates using the model view matrix modelView, the projection matrix projection and the viewport dimensions viewport.

When transforming from clip to normalized space, a division by the w component of the vector components takes place. To prevent dividing by 0 if w equals to 0, it is set to 1.

Note: y coordinates in viewport should use OpenGL orientation. OpenGL expects the bottom to be 0 whereas for Qt top is 0.

This function was introduced in Qt 5.5.

See also project().

source

pub unsafe fn x(&self) -> c_float

Returns the x coordinate of this point.

Calls C++ function: float QVector3D::x() const.

C++ documentation:

Returns the x coordinate of this point.

See also setX(), y(), and z().

source

pub unsafe fn y(&self) -> c_float

Returns the y coordinate of this point.

Calls C++ function: float QVector3D::y() const.

C++ documentation:

Returns the y coordinate of this point.

See also setY(), x(), and z().

source

pub unsafe fn z(&self) -> c_float

Returns the z coordinate of this point.

Calls C++ function: float QVector3D::z() const.

C++ documentation:

Returns the z coordinate of this point.

See also setZ(), x(), and y().

Trait Implementations§

source§

impl Add<Ref<QVector3D>> for &QVector3D

source§

fn add(self, v2: Ref<QVector3D>) -> CppBox<QVector3D>

Calls C++ function: QVector3D operator+(const QVector3D& v1, const QVector3D& v2).

§

type Output = CppBox<QVector3D>

The resulting type after applying the + operator.
source§

impl CppDeletable for QVector3D

source§

unsafe fn delete(&self)

The QVector3D class represents a vector or vertex in 3D space.

Calls C++ function: [destructor] void QVector3D::~QVector3D().

C++ documentation:

The QVector3D class represents a vector or vertex in 3D space.

Vectors are one of the main building blocks of 3D representation and drawing. They consist of three coordinates, traditionally called x, y, and z.

The QVector3D class can also be used to represent vertices in 3D space. We therefore do not need to provide a separate vertex class.

source§

impl Div<Ref<QVector3D>> for &QVector3D

source§

fn div(self, divisor: Ref<QVector3D>) -> CppBox<QVector3D>

Calls C++ function: QVector3D operator/(const QVector3D& vector, const QVector3D& divisor).

§

type Output = CppBox<QVector3D>

The resulting type after applying the / operator.
source§

impl Div<f32> for &QVector3D

source§

fn div(self, divisor: c_float) -> CppBox<QVector3D>

Calls C++ function: QVector3D operator/(const QVector3D& vector, float divisor).

§

type Output = CppBox<QVector3D>

The resulting type after applying the / operator.
source§

impl Mul<Ref<QMatrix4X4>> for &QVector3D

source§

fn mul(self, matrix: Ref<QMatrix4X4>) -> CppBox<QVector3D>

Calls C++ function: QVector3D operator*(const QVector3D& vector, const QMatrix4x4& matrix).

§

type Output = CppBox<QVector3D>

The resulting type after applying the * operator.
source§

impl Mul<Ref<QVector3D>> for &QVector3D

source§

fn mul(self, v2: Ref<QVector3D>) -> CppBox<QVector3D>

Calls C++ function: QVector3D operator*(const QVector3D& v1, const QVector3D& v2).

§

type Output = CppBox<QVector3D>

The resulting type after applying the * operator.
source§

impl Mul<f32> for &QVector3D

source§

fn mul(self, factor: c_float) -> CppBox<QVector3D>

Calls C++ function: QVector3D operator*(const QVector3D& vector, float factor).

§

type Output = CppBox<QVector3D>

The resulting type after applying the * operator.
source§

impl PartialEq<Ref<QVector3D>> for QVector3D

source§

fn eq(&self, v2: &Ref<QVector3D>) -> bool

Returns true if page layout lhs is equal to page layout rhs, i.e. if all the attributes are exactly equal.

Calls C++ function: bool operator==(const QVector3D& v1, const QVector3D& v2).

Warning: no exact match found in C++ documentation. Below is the C++ documentation for bool operator==(const QPageLayout &lhs, const QPageLayout &rhs):

Returns true if page layout lhs is equal to page layout rhs, i.e. if all the attributes are exactly equal.

Note that this is a strict equality, especially for page size where the QPageSize ID, name and size must exactly match, and the margins where the units must match.

See also QPageLayout::isEquivalentTo().

1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Sub<Ref<QVector3D>> for &QVector3D

source§

fn sub(self, v2: Ref<QVector3D>) -> CppBox<QVector3D>

Calls C++ function: QVector3D operator-(const QVector3D& v1, const QVector3D& v2).

§

type Output = CppBox<QVector3D>

The resulting type after applying the - operator.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.