#[repr(C)]pub struct IVector4 {
pub x: i32,
pub y: i32,
pub z: i32,
pub w: i32,
}
Expand description
A 4-dimensional vector with x
, y
, z
and w
components, all of which are i32
.
Fields§
§x: i32
§y: i32
§z: i32
§w: i32
Implementations§
source§impl IVector4
impl IVector4
sourcepub fn new(x: i32, y: i32, z: i32, w: i32) -> IVector4
pub fn new(x: i32, y: i32, z: i32, w: i32) -> IVector4
Creates a new IVector4
with the given x
, y
, z
, and w
components.
Arguments
x
- Thex
component of the vector.y
- They
component of the vector.z
- Thez
component of the vector.w
- Thew
component of the vector.
Examples
use cgl_rs::math::IVector4;
let vec = IVector4::new(1, 2, 3, 4);
assert_eq!(vec.x, 1);
assert_eq!(vec.y, 2);
assert_eq!(vec.z, 3);
assert_eq!(vec.w, 4);
Trait Implementations§
source§impl IndexMut<usize> for IVector4
impl IndexMut<usize> for IVector4
source§fn index_mut(&mut self, index: usize) -> &mut Self::Output
fn index_mut(&mut self, index: usize) -> &mut Self::Output
Returns a mutable reference to the element at the given index
of this Vector4
.
Arguments
index
- The index of the element to retrieve.
Panics
Panics if index
is greater than or equal to 4.
Examples
use cgl_rs::math::IVector4;
let mut vec = IVector4::new(1, 2, 3, 4);
vec[0] = 5;
assert_eq!(vec[0], 5);
source§impl PartialEq<IVector4> for IVector4
impl PartialEq<IVector4> for IVector4
impl Copy for IVector4
impl StructuralPartialEq for IVector4
Auto Trait Implementations§
impl RefUnwindSafe for IVector4
impl Send for IVector4
impl Sync for IVector4
impl Unpin for IVector4
impl UnwindSafe for IVector4
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