Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.37 KB | None | 0 0
  1. static IVector subtractVectors(IVector a, IVector b) {
  2.  
  3.         double vx = a.getVx() - b.getVx();
  4.         double vy = a.getVy() - b.getVy();
  5.  
  6.         if(a instanceof Vector3D && b instanceof Vector3D) {
  7.             double vz = ((Vector3D) a).getVz() - ((Vector3D) b).getVz();
  8.             return new Vector3D(vx, vy, vz);
  9.         }
  10.         return new Vector(vx, vy);
  11.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement