pub struct Vector4 {
pub x: f32,
pub y: f32,
pub z: f32,
pub w: f32,
}Expand description
A vector with four single-precision components.
Fields§
§x: f32The X component of the vector.
y: f32The Y component of the vector.
z: f32The Z component of the vector.
w: f32The W component of the vector.
Implementations§
Source§impl Vector4
impl Vector4
Sourcepub const fn from_value(value: f32) -> Self
pub const fn from_value(value: f32) -> Self
Creates a vector whose components all have the same value.
Sourcepub const fn from_vector2(value: Vector2, z: f32, w: f32) -> Self
pub const fn from_vector2(value: Vector2, z: f32, w: f32) -> Self
Creates a vector from a Vector2 and the Z and W components.
Sourcepub const fn from_vector3(value: Vector3, w: f32) -> Self
pub const fn from_vector3(value: Vector3, w: f32) -> Self
Creates a vector from a Vector3 and a W component.
Sourcepub fn abs(value: Vector4) -> Vector4
pub fn abs(value: Vector4) -> Vector4
Returns a vector whose elements are the absolute values of each of the specified vector’s elements.
Sourcepub fn clamp(value1: Vector4, min: Vector4, max: Vector4) -> Vector4
pub fn clamp(value1: Vector4, min: Vector4, max: Vector4) -> Vector4
Restricts a vector between a minimum and a maximum value
(min(max(value, min), max), so max wins when the bounds are inverted).
Sourcepub fn distance(value1: Vector4, value2: Vector4) -> f32
pub fn distance(value1: Vector4, value2: Vector4) -> f32
Computes the Euclidean distance between the two given points.
Sourcepub fn distance_squared(value1: Vector4, value2: Vector4) -> f32
pub fn distance_squared(value1: Vector4, value2: Vector4) -> f32
Returns the Euclidean distance squared between two specified points.
Sourcepub fn length_squared(&self) -> f32
pub fn length_squared(&self) -> f32
Returns the length of the vector squared.
Sourcepub fn lerp(value1: Vector4, value2: Vector4, amount: f32) -> Vector4
pub fn lerp(value1: Vector4, value2: Vector4, amount: f32) -> Vector4
Performs a linear interpolation between two vectors based on the given weighting.
Sourcepub fn max(value1: Vector4, value2: Vector4) -> Vector4
pub fn max(value1: Vector4, value2: Vector4) -> Vector4
Returns a vector whose elements are the maximum of each of the pairs of elements in two specified vectors.
Sourcepub fn min(value1: Vector4, value2: Vector4) -> Vector4
pub fn min(value1: Vector4, value2: Vector4) -> Vector4
Returns a vector whose elements are the minimum of each of the pairs of elements in two specified vectors.
Sourcepub fn normalize(vector: Vector4) -> Vector4
pub fn normalize(vector: Vector4) -> Vector4
Returns a vector with the same direction as the specified vector, but with a length of one (NaN components for a zero-length vector).
Sourcepub fn square_root(value: Vector4) -> Vector4
pub fn square_root(value: Vector4) -> Vector4
Returns a vector whose elements are the square root of each of a specified vector’s elements.
Sourcepub fn transform(vector: Vector4, matrix: Matrix4x4) -> Vector4
pub fn transform(vector: Vector4, matrix: Matrix4x4) -> Vector4
Transforms a four-dimensional vector by a specified 4x4 matrix.
Sourcepub fn transform_vector3(position: Vector3, matrix: Matrix4x4) -> Vector4
pub fn transform_vector3(position: Vector3, matrix: Matrix4x4) -> Vector4
Transforms a three-dimensional vector (with an implied w of one) by
a specified 4x4 matrix.
Sourcepub fn transform_vector2(position: Vector2, matrix: Matrix4x4) -> Vector4
pub fn transform_vector2(position: Vector2, matrix: Matrix4x4) -> Vector4
Transforms a two-dimensional vector (with an implied z of zero and
w of one) by a specified 4x4 matrix.
Trait Implementations§
Source§impl AddAssign for Vector4
impl AddAssign for Vector4
Source§fn add_assign(&mut self, right: Vector4)
fn add_assign(&mut self, right: Vector4)
+= operation. Read moreSource§impl BatchValue for Vector4
impl BatchValue for Vector4
impl Copy for Vector4
Source§impl DivAssign for Vector4
impl DivAssign for Vector4
Source§fn div_assign(&mut self, right: Vector4)
fn div_assign(&mut self, right: Vector4)
/= operation. Read moreSource§impl DivAssign<f32> for Vector4
impl DivAssign<f32> for Vector4
Source§fn div_assign(&mut self, right: f32)
fn div_assign(&mut self, right: f32)
/= operation. Read moreSource§impl ExpressionVariantValue for Vector4
impl ExpressionVariantValue for Vector4
Source§const FFI_VARIANT_TYPE: Option<VariantType>
const FFI_VARIANT_TYPE: Option<VariantType>
None when the type cannot be a foreign function parameter.Source§fn try_from_variant(v: &ExpressionVariant) -> Option<Self>
fn try_from_variant(v: &ExpressionVariant) -> Option<Self>
Source§fn into_variant(self) -> ExpressionVariant
fn into_variant(self) -> ExpressionVariant
Source§impl From<Vector4> for ExpressionVariant
impl From<Vector4> for ExpressionVariant
Source§fn from(value: Vector4) -> ExpressionVariant
fn from(value: Vector4) -> ExpressionVariant
Source§impl IInterpolator<Vector4> for Vector4Interpolator
impl IInterpolator<Vector4> for Vector4Interpolator
Source§impl MulAssign for Vector4
impl MulAssign for Vector4
Source§fn mul_assign(&mut self, right: Vector4)
fn mul_assign(&mut self, right: Vector4)
*= operation. Read moreSource§impl MulAssign<f32> for Vector4
impl MulAssign<f32> for Vector4
Source§fn mul_assign(&mut self, right: f32)
fn mul_assign(&mut self, right: f32)
*= operation. Read moreimpl StructuralPartialEq for Vector4
Auto Trait Implementations§
impl Freeze for Vector4
impl RefUnwindSafe for Vector4
impl Send for Vector4
impl Sync for Vector4
impl Unpin for Vector4
impl UnsafeUnpin for Vector4
impl UnwindSafe for Vector4
Blanket Implementations§
Source§impl<T> AnyValue for Twhere
T: PartialEq + 'static,
impl<T> AnyValue for Twhere
T: PartialEq + 'static,
fn any_value_as_any(&self) -> &(dyn Any + 'static)
fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool
fn any_value_type_name(&self) -> &'static str
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more