pub struct Vector4<T>(pub T, pub T, pub T, pub T);
Expand description
A 4D vector
Tuple Fields§
§0: T
§1: T
§2: T
§3: T
Implementations§
Source§impl<T> Vector4<T>where
T: Copy,
impl<T> Vector4<T>where
T: Copy,
Sourcepub fn new(x: T, y: T, z: T, w: T) -> Self
pub fn new(x: T, y: T, z: T, w: T) -> Self
Returns a new Vector4
§Arguments
x
- The x direction scalar .0y
- The y direction scalar .1z
- The z direction scalar .2w
- The w direction scalar .3
Sourcepub fn from_vector3(vec3: Vector3<T>, w: T) -> Self
pub fn from_vector3(vec3: Vector3<T>, w: T) -> Self
Returns a new Vector4 created by adding a w value to a Vector3
§Arguments
vec3
- The 3D Vector that the w direction scaler is added ontow
- The w direction scalar .3
pub fn empty(zero: T) -> Self
pub fn normalize(&self, length: Option<T>) -> Vector4<T>
Trait Implementations§
Source§impl<T> F32Fmt for Vector4<T>
impl<T> F32Fmt for Vector4<T>
type F32Fmt = Vector4<<T as F32Fmt>::F32Fmt>
fn intoF32Fmt(self) -> Self::F32Fmt
fn fromF32Fmt(f32_fmt: Self::F32Fmt) -> Self
fn sqrt(self) -> Self
fn cbrt(self) -> Self
fn f32_const_mul(self, constant: f32) -> Self
fn sin_mul(self, mul_by: Self) -> Self
fn cos_mul(self, _mul_by: Self) -> Self
fn tan_mul(self, _mul_by: Self) -> Self
fn asin_mul(self, _mul_by: Self) -> Self
fn acos_mul(self, _mul_by: Self) -> Self
fn atan_mul(self, _mul_by: Self) -> Self
fn atan2_mul(self, _other: Self, _mul_by: Self) -> Self
fn sinh_mul(self, _mul_by: Self) -> Self
fn cosh_mul(self, _mul_by: Self) -> Self
fn tanh_mul(self, _mul_by: Self) -> Self
Source§impl<T> From<Quaternion<T>> for Vector4<T>where
T: Copy,
impl<T> From<Quaternion<T>> for Vector4<T>where
T: Copy,
Source§fn from(other: Quaternion<T>) -> Vector4<T>
fn from(other: Quaternion<T>) -> Vector4<T>
Converts to this type from the input type.
Source§impl<T> Mul<Vector4<T>> for Matrix4<T>
impl<T> Mul<Vector4<T>> for Matrix4<T>
Source§fn mul(self, rhs: Vector4<T>) -> Self::Output
fn mul(self, rhs: Vector4<T>) -> Self::Output
Matrix4 * Vec3d = type Vec3d
§Examples
use feo_math::linear_algebra::vector4::Vector4;
use feo_math::linear_algebra::matrix4::Matrix4;
let mat = Matrix4::new(
[1, 2, 3, 4],
[3, 4, 1, 2],
[4, 1, 2, 3],
[2, 3, 4, 1]
);
let vec = Vector4::new(1, 4, 2, 3);
assert_eq!(mat * vec, Vector4::new(27, 27, 21, 25));
impl<T> Construct<T> for Vector4<T>where
T: Construct<T>,
impl<T: Copy> Copy for Vector4<T>
impl<T> SqMatrix<T, Vector4<T>> for Matrix4<T>where
T: Construct<T>,
impl<T> StructuralPartialEq for Vector4<T>
impl<T> Vector<T> for Vector4<T>where
T: Construct<T>,
Auto Trait Implementations§
impl<T> Freeze for Vector4<T>where
T: Freeze,
impl<T> RefUnwindSafe for Vector4<T>where
T: RefUnwindSafe,
impl<T> Send for Vector4<T>where
T: Send,
impl<T> Sync for Vector4<T>where
T: Sync,
impl<T> Unpin for Vector4<T>where
T: Unpin,
impl<T> UnwindSafe for Vector4<T>where
T: UnwindSafe,
Blanket Implementations§
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
Mutably borrows from an owned value. Read more