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

source

pub fn is_null(&self) -> bool

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

source§

impl QVector3D

source

pub fn length(&self) -> f32

Returns the length of the vector from the origin.

source§

impl QVector3D

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 QVector3D

source

pub fn normalize(&mut 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.

source§

impl QVector3D

source

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

source

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

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

source§

impl QVector3D

source

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

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

source§

impl QVector3D

source

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

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

source§

impl QVector3D

source

pub fn x(&self) -> f32

Returns the x coordinate of this point.

source§

impl QVector3D

source

pub fn y(&self) -> f32

Returns the y coordinate of this point.

source§

impl QVector3D

source

pub fn z(&self) -> f32

Returns the z coordinate of this point.

source§

impl QVector3D

source

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

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

source

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.

source

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.

source

pub fn distance_to_point(&self, point: QVector3D) -> f32

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

Trait Implementations§

source§

impl Add for QVector3D

§

type Output = QVector3D

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Clone for QVector3D

source§

fn clone(&self) -> QVector3D

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 QVector3D

source§

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

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

impl Default for QVector3D

source§

fn default() -> Self

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

source§

impl Display for QVector3D

source§

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

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

impl Div<f32> for QVector3D

§

type Output = QVector3D

The resulting type after applying the / operator.
source§

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

Performs the / operation. Read more
source§

impl ExternType for QVector3D

§

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

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

type Kind = Trivial

source§

impl From<QPoint> for QVector3D

source§

fn from(value: QPoint) -> Self

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

source§

impl From<QPointF> for QVector3D

source§

fn from(value: QPointF) -> Self

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

source§

impl From<QVector2D> for QVector3D

source§

fn from(value: QVector2D) -> Self

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

source§

impl From<QVector3D> for QPoint

source§

fn from(value: QVector3D) -> Self

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

source§

impl From<QVector3D> for QPointF

source§

fn from(value: QVector3D) -> Self

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

source§

impl From<QVector3D> for QVector2D

source§

fn from(value: QVector3D) -> Self

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

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 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 QVector3D

§

type Output = QVector3D

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl PartialEq for QVector3D

source§

fn eq(&self, other: &QVector3D) -> 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 QVector3D

§

type Output = QVector3D

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl StructuralPartialEq for QVector3D

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.