format
This commit is contained in:
parent
9fd5c523ee
commit
2d2d56807c
@ -73,6 +73,90 @@ pub mod vector {
|
||||
}
|
||||
}
|
||||
|
||||
impl Add for Vector3 {
|
||||
type Output = Self;
|
||||
|
||||
fn add(self, rhs: Self) -> Self::Output {
|
||||
Self::new(self.x + rhs.x, self.y + rhs.y, self.z + rhs.z)
|
||||
}
|
||||
}
|
||||
|
||||
impl Sub for Vector3 {
|
||||
type Output = Self;
|
||||
|
||||
fn sub(self, rhs: Self) -> Self::Output {
|
||||
Self::new(self.x - rhs.x, self.y - rhs.y, self.z - rhs.z)
|
||||
}
|
||||
}
|
||||
|
||||
impl Mul for Vector3 {
|
||||
type Output = Self;
|
||||
|
||||
fn mul(self, rhs: Self) -> Self::Output {
|
||||
Self::new(self.x * rhs.x, self.y * rhs.y, self.z * rhs.z)
|
||||
}
|
||||
}
|
||||
|
||||
impl Div for Vector3 {
|
||||
type Output = Self;
|
||||
|
||||
fn div(self, rhs: Self) -> Self::Output {
|
||||
Self::new(self.x / rhs.x, self.y / rhs.y, self.z / rhs.z)
|
||||
}
|
||||
}
|
||||
|
||||
impl Add for Vector4 {
|
||||
type Output = Self;
|
||||
|
||||
fn add(self, rhs: Self) -> Self::Output {
|
||||
Self::new(
|
||||
self.x + rhs.x,
|
||||
self.y + rhs.y,
|
||||
self.z + rhs.z,
|
||||
self.w + rhs.w,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl Sub for Vector4 {
|
||||
type Output = Self;
|
||||
|
||||
fn sub(self, rhs: Self) -> Self::Output {
|
||||
Self::new(
|
||||
self.x - rhs.x,
|
||||
self.y - rhs.y,
|
||||
self.z - rhs.z,
|
||||
self.w - rhs.w,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl Mul for Vector4 {
|
||||
type Output = Self;
|
||||
|
||||
fn mul(self, rhs: Self) -> Self::Output {
|
||||
Self::new(
|
||||
self.x * rhs.x,
|
||||
self.y * rhs.y,
|
||||
self.z * rhs.z,
|
||||
self.w * rhs.w,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl Div for Vector4 {
|
||||
type Output = Self;
|
||||
|
||||
fn div(self, rhs: Self) -> Self::Output {
|
||||
Self::new(
|
||||
self.x / rhs.x,
|
||||
self.y / rhs.y,
|
||||
self.z / rhs.z,
|
||||
self.w / rhs.w,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl VectorTrait for Vector2 {
|
||||
fn len(&self) -> i8 {
|
||||
return 2;
|
||||
@ -108,38 +192,6 @@ pub mod vector {
|
||||
}
|
||||
}
|
||||
|
||||
impl Add for Vector3 {
|
||||
type Output = Self;
|
||||
|
||||
fn add(self, rhs: Self) -> Self::Output {
|
||||
Self::new(self.x + rhs.x, self.y + rhs.y, self.z + rhs.z)
|
||||
}
|
||||
}
|
||||
|
||||
impl Sub for Vector3 {
|
||||
type Output = Self;
|
||||
|
||||
fn sub(self, rhs: Self) -> Self::Output {
|
||||
Self::new(self.x - rhs.x, self.y - rhs.y, self.z - rhs.z)
|
||||
}
|
||||
}
|
||||
|
||||
impl Mul for Vector3 {
|
||||
type Output = Self;
|
||||
|
||||
fn mul(self, rhs: Self) -> Self::Output {
|
||||
Self::new(self.x * rhs.x, self.y * rhs.y, self.z * rhs.z)
|
||||
}
|
||||
}
|
||||
|
||||
impl Div for Vector3 {
|
||||
type Output = Self;
|
||||
|
||||
fn div(self, rhs: Self) -> Self::Output {
|
||||
Self::new(self.x / rhs.x, self.y / rhs.y, self.z / rhs.z)
|
||||
}
|
||||
}
|
||||
|
||||
impl VectorTrait for Vector3 {
|
||||
fn len(&self) -> i8 {
|
||||
return 3;
|
||||
@ -234,58 +286,6 @@ pub mod vector {
|
||||
}
|
||||
}
|
||||
|
||||
impl Add for Vector4 {
|
||||
type Output = Self;
|
||||
|
||||
fn add(self, rhs: Self) -> Self::Output {
|
||||
Self::new(
|
||||
self.x + rhs.x,
|
||||
self.y + rhs.y,
|
||||
self.z + rhs.z,
|
||||
self.w + rhs.w,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl Sub for Vector4 {
|
||||
type Output = Self;
|
||||
|
||||
fn sub(self, rhs: Self) -> Self::Output {
|
||||
Self::new(
|
||||
self.x - rhs.x,
|
||||
self.y - rhs.y,
|
||||
self.z - rhs.z,
|
||||
self.w - rhs.w,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl Mul for Vector4 {
|
||||
type Output = Self;
|
||||
|
||||
fn mul(self, rhs: Self) -> Self::Output {
|
||||
Self::new(
|
||||
self.x * rhs.x,
|
||||
self.y * rhs.y,
|
||||
self.z * rhs.z,
|
||||
self.w * rhs.w,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl Div for Vector4 {
|
||||
type Output = Self;
|
||||
|
||||
fn div(self, rhs: Self) -> Self::Output {
|
||||
Self::new(
|
||||
self.x / rhs.x,
|
||||
self.y / rhs.y,
|
||||
self.z / rhs.z,
|
||||
self.w / rhs.w,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl Vector2 {
|
||||
pub fn new(x: f64, y: f64) -> Self {
|
||||
Self { x, y }
|
||||
|
Loading…
Reference in New Issue
Block a user