Struct cxx_qt_lib::QVector4D

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

The QVector4D class represents a vector or vertex in 4D space.

Implementations§

source§

impl QVector4D

source

pub fn is_null(&self) -> bool

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

source§

impl QVector4D

source

pub fn length(&self) -> f32

Returns the length of the vector from the origin.

source§

impl QVector4D

source

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 QVector4D

source

pub fn normalize(&mut self)

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

source§

impl QVector4D

source

pub fn normalized(&self) -> QVector4D

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 QVector4D

source

pub fn set_w(&mut self, w: f32)

Sets the w coordinate of this point to the given finite w coordinate.

source§

impl QVector4D

source

pub fn set_x(&mut self, x: f32)

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

source§

impl QVector4D

source

pub fn set_y(&mut self, y: f32)

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

source§

impl QVector4D

source

pub fn set_z(&mut self, z: f32)

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

source§

impl QVector4D

source

pub fn to_vector_2d_affine(&self) -> QVector2D

Returns the 2D vector form of this 4D vector, dividing the x and y coordinates by the w coordinate and dropping the z coordinate. Returns a null vector if w is zero.

source§

impl QVector4D

source

pub fn to_vector_3d_affine(&self) -> QVector3D

Returns the 3D vector form of this 4D vector, dividing the x, y, and z coordinates by the w coordinate. Returns a null vector if w is zero.

source§

impl QVector4D

source

pub fn w(&self) -> f32

Returns the w coordinate of this point.

source§

impl QVector4D

source

pub fn x(&self) -> f32

Returns the x coordinate of this point.

source§

impl QVector4D

source

pub fn y(&self) -> f32

Returns the y coordinate of this point.

source§

impl QVector4D

source

pub fn z(&self) -> f32

Returns the z coordinate of this point.

source§

impl QVector4D

source

pub fn new(xpos: f32, ypos: f32, zpos: f32, wpos: f32) -> Self

Constructs a vector with coordinates (xpos, ypos, zpos, wpos). All parameters must be finite.

Trait Implementations§

source§

impl Add for QVector4D

§

type Output = QVector4D

The resulting type after applying the + operator.
source§

fn add(self, other: Self) -> Self

Performs the + operation. Read more
source§

impl Clone for QVector4D

source§

fn clone(&self) -> QVector4D

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for QVector4D

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for QVector4D

source§

fn default() -> Self

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

source§

impl Display for QVector4D

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Div<f32> for QVector4D

§

type Output = QVector4D

The resulting type after applying the / operator.
source§

fn div(self, rhs: f32) -> Self

Performs the / operation. Read more
source§

impl ExternType for QVector4D

§

type Id = (Q, V, e, c, t, o, r, _4, D)

A type-level representation of the type’s C++ namespace and type name. Read more
§

type Kind = Trivial

source§

impl From<QPoint> for QVector4D

source§

fn from(value: QPoint) -> Self

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

source§

impl From<QPointF> for QVector4D

source§

fn from(value: QPointF) -> Self

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

source§

impl From<QVector2D> for QVector4D

source§

fn from(value: QVector2D) -> Self

Constructs a 4D vector from the specified 2D vector. The z and w coordinates are set to zero.

source§

impl From<QVector3D> for QVector4D

source§

fn from(value: QVector3D) -> Self

Constructs a 4D vector from the specified 3D vector. The w coordinate is set to zero.

source§

impl From<QVector4D> for QPoint

source§

fn from(value: QVector4D) -> Self

Returns the QPoint form of this 4D vector. The z and w coordinates are dropped. The x and y coordinates are rounded to nearest integers.

source§

impl From<QVector4D> for QPointF

source§

fn from(value: QVector4D) -> Self

Returns the QPointF form of this 4D vector. The z and w coordinates are dropped.

source§

impl From<QVector4D> for QVector2D

source§

fn from(value: QVector4D) -> Self

Constructs a vector with x and y coordinates from a 3D vector. The z and w coordinates of vector are dropped.

source§

impl From<QVector4D> for QVector3D

source§

fn from(value: QVector4D) -> Self

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

source§

impl Mul<f32> for QVector4D

§

type Output = QVector4D

The resulting type after applying the * operator.
source§

fn mul(self, rhs: f32) -> Self

Performs the * operation. Read more
source§

impl PartialEq for QVector4D

source§

fn eq(&self, other: &QVector4D) -> bool

This method tests for self and other values to be equal, and is used by ==.
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 for QVector4D

§

type Output = QVector4D

The resulting type after applying the - operator.
source§

fn sub(self, other: Self) -> Self

Performs the - operation. Read more
source§

impl StructuralPartialEq for QVector4D

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> 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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. 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.