Created
February 10, 2017 02:31
-
-
Save jeandudey/74ff13d692932b18623a0d07d796533b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
impl<'a> std::ops::Sub<Vec3> for &'a Vec3 { | |
type Output = Vec3; | |
fn sub(self, other: Vec3) -> Vec3 { | |
let mut output = Vec3::new([0f64; 3]); | |
for index in 0..3 { | |
output.vector[index] = self.vector[index] - other.vector[index]; | |
} | |
return output; | |
} | |
} | |
impl<'a> std::ops::Sub<&'a Vec3> for Vec3 { | |
type Output = Vec3; | |
fn sub(self, other: &'a Vec3) -> Vec3 { | |
let mut output = Vec3::new([0f64; 3]); | |
for index in 0..3 { | |
output.vector[index] = self.vector[index] - other.vector[index]; | |
} | |
return output; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment