Guest User

Untitled

a guest
Aug 14th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #[derive(Clone, Debug)]
  2. pub struct Vec3 {
  3. pub v: [f64; 3],
  4. }
  5.  
  6. impl Sub for Vec3 {
  7. type Output = Vec3;
  8.  
  9. fn sub(self, other: Vec3) -> Vec3 {
  10. Vec3 {
  11. v: [
  12. self.v[0] - other.v[0],
  13. self.v[1] - other.v[1],
  14. self.v[2] - other.v[2],
  15. ],
  16. }
  17. }
  18. }
  19.  
  20. let x = Vec3 {v: [0., 0., 0.]};
  21. let y = Vec3 {v: [0., 0., 0.]};
  22. let a = x - y;
  23. let b = x - y;
Add Comment
Please, Sign In to add comment