firmath 0.4.2

Math Library for Graphics
Documentation
use crate::vector4::Vector4;
use crate::vector3::Vector3;
use crate::vector2::Vector2;

pub trait Conversion<T>  {
    fn convert(self) -> T;
}

impl Conversion<Vector3> for f32 {
    fn convert(self) -> Vector3 {
        Vector3::new(self, self, self)
    }
}

impl Conversion<Vector3> for i32 {
    fn convert(self) -> Vector3 {
        Vector3::new(self as f32, self as f32, self as f32)
    }
}

impl Conversion<Vector2> for f32 {
    fn convert(self) -> Vector2 {
        Vector2::new(self, self)
    }
}

impl Conversion<Vector2> for i32 {
    fn convert(self) -> Vector2 {
        Vector2::new(self as f32, self as f32)
    }
}

impl Conversion<Vector4> for f32 {
    fn convert(self) -> Vector4 {
        Vector4::new(self, self, self, self)
    }
}

impl Conversion<Vector4> for i32 {
    fn convert(self) -> Vector4 {
        Vector4::new(self as f32, self as f32, self as f32, self as f32)
    }
}