#[repr(C)]pub struct Vec2<T>where
T: Copy,{
pub x: T,
pub y: T,
}
Expand description
2D generic vector Implemented for f32, f64, i32
Fields§
§x: T
§y: T
Implementations§
Source§impl<T> Vec2<T>where
T: Scalar,
impl<T> Vec2<T>where
T: Scalar,
Sourcepub fn broadcast(a: T) -> Vec2<T>
pub fn broadcast(a: T) -> Vec2<T>
Constructs a new Vec2 from a scalar value by copying that value to all members
§Examples
// V2f32 is a type alias for Vec2::<f32>
use imath::vec::V2f32;
let v = V2f32::broadcast(1.0);
assert!(v.x == 1.0 && v.y == 1.0)
Sourcepub fn equal_with_abs_error(self, v: Vec2<T>, e: T) -> boolwhere
T: Scalar,
pub fn equal_with_abs_error(self, v: Vec2<T>, e: T) -> boolwhere
T: Scalar,
Returns true if self and v are equal with error no greater than e
Sourcepub fn equal_with_rel_error(self, v: Vec2<T>, e: T) -> boolwhere
T: Real,
pub fn equal_with_rel_error(self, v: Vec2<T>, e: T) -> boolwhere
T: Real,
Returns true if self and v are equal with a relative error no greater than e
Trait Implementations§
Source§impl<T> PartialOrd for Vec2<T>where
T: Copy + PartialOrd,
impl<T> PartialOrd for Vec2<T>where
T: Copy + PartialOrd,
impl<T> Copy for Vec2<T>
impl<T> Eq for Vec2<T>
impl<T> StructuralPartialEq for Vec2<T>where
T: Copy,
Auto Trait Implementations§
impl<T> Freeze for Vec2<T>where
T: Freeze,
impl<T> RefUnwindSafe for Vec2<T>where
T: RefUnwindSafe,
impl<T> Send for Vec2<T>where
T: Send,
impl<T> Sync for Vec2<T>where
T: Sync,
impl<T> Unpin for Vec2<T>where
T: Unpin,
impl<T> UnwindSafe for Vec2<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