#[repr(C)]pub struct Vector3 {
pub x: f32,
pub y: f32,
pub z: f32,
}Expand description
A vector with three single-precision components.
The layout is the one of the reference runtime and is relied on when the
value is passed to a graphics API by address (as a vertex attribute, for
example): three consecutive singles, x, y, z.
Fields§
§x: f32The X component of the vector.
y: f32The Y component of the vector.
z: f32The Z component of the vector.
Implementations§
Source§impl Vector3
impl Vector3
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) -> Self
pub const fn from_vector2(value: Vector2, z: f32) -> Self
Creates a vector from a Vector2 and a Z component.
Sourcepub fn abs(value: Vector3) -> Vector3
pub fn abs(value: Vector3) -> Vector3
Returns a vector whose elements are the absolute values of each of the specified vector’s elements.
Sourcepub fn clamp(value1: Vector3, min: Vector3, max: Vector3) -> Vector3
pub fn clamp(value1: Vector3, min: Vector3, max: Vector3) -> Vector3
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 cross(vector1: Vector3, vector2: Vector3) -> Vector3
pub fn cross(vector1: Vector3, vector2: Vector3) -> Vector3
Computes the cross product of two vectors.
Sourcepub fn distance(value1: Vector3, value2: Vector3) -> f32
pub fn distance(value1: Vector3, value2: Vector3) -> f32
Computes the Euclidean distance between the two given points.
Sourcepub fn distance_squared(value1: Vector3, value2: Vector3) -> f32
pub fn distance_squared(value1: Vector3, value2: Vector3) -> 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: Vector3, value2: Vector3, amount: f32) -> Vector3
pub fn lerp(value1: Vector3, value2: Vector3, amount: f32) -> Vector3
Performs a linear interpolation between two vectors based on the given weighting.
Sourcepub fn max(value1: Vector3, value2: Vector3) -> Vector3
pub fn max(value1: Vector3, value2: Vector3) -> Vector3
Returns a vector whose elements are the maximum of each of the pairs of elements in two specified vectors.
Sourcepub fn min(value1: Vector3, value2: Vector3) -> Vector3
pub fn min(value1: Vector3, value2: Vector3) -> Vector3
Returns a vector whose elements are the minimum of each of the pairs of elements in two specified vectors.
Sourcepub fn normalize(value: Vector3) -> Vector3
pub fn normalize(value: Vector3) -> Vector3
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: Vector3) -> Vector3
pub fn square_root(value: Vector3) -> Vector3
Returns a vector whose elements are the square root of each of a specified vector’s elements.
Sourcepub fn transform(position: Vector3, matrix: Matrix4x4) -> Vector3
pub fn transform(position: Vector3, matrix: Matrix4x4) -> Vector3
Transforms a vector by a specified 4x4 matrix.
Sourcepub fn transform_quaternion(value: Vector3, rotation: Quaternion) -> Vector3
pub fn transform_quaternion(value: Vector3, rotation: Quaternion) -> Vector3
Transforms a vector by the specified rotation.
Sourcepub fn transform_normal(normal: Vector3, matrix: Matrix4x4) -> Vector3
pub fn transform_normal(normal: Vector3, matrix: Matrix4x4) -> Vector3
Transforms a vector normal by the given 4x4 matrix.
Trait Implementations§
Source§impl AddAssign for Vector3
impl AddAssign for Vector3
Source§fn add_assign(&mut self, right: Vector3)
fn add_assign(&mut self, right: Vector3)
+= operation. Read moreSource§impl BatchValue for Vector3
impl BatchValue for Vector3
impl Copy for Vector3
Source§impl DivAssign for Vector3
impl DivAssign for Vector3
Source§fn div_assign(&mut self, right: Vector3)
fn div_assign(&mut self, right: Vector3)
/= operation. Read moreSource§impl DivAssign<f32> for Vector3
impl DivAssign<f32> for Vector3
Source§fn div_assign(&mut self, right: f32)
fn div_assign(&mut self, right: f32)
/= operation. Read moreSource§impl ExpressionVariantValue for Vector3
impl ExpressionVariantValue for Vector3
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<Vector3> for ExpressionVariant
impl From<Vector3> for ExpressionVariant
Source§fn from(value: Vector3) -> ExpressionVariant
fn from(value: Vector3) -> ExpressionVariant
Source§impl IInterpolator<Vector3> for Vector3Interpolator
impl IInterpolator<Vector3> for Vector3Interpolator
Source§impl MulAssign for Vector3
impl MulAssign for Vector3
Source§fn mul_assign(&mut self, right: Vector3)
fn mul_assign(&mut self, right: Vector3)
*= operation. Read moreSource§impl MulAssign<f32> for Vector3
impl MulAssign<f32> for Vector3
Source§fn mul_assign(&mut self, right: f32)
fn mul_assign(&mut self, right: f32)
*= operation. Read moreimpl StructuralPartialEq for Vector3
Auto Trait Implementations§
impl Freeze for Vector3
impl RefUnwindSafe for Vector3
impl Send for Vector3
impl Sync for Vector3
impl Unpin for Vector3
impl UnsafeUnpin for Vector3
impl UnwindSafe for Vector3
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