Guest User

lavieri

a guest
Mar 12th, 2009
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.52 KB | None | 0 0
  1. /**
  2.  *
  3.  * @author Tomaz Lavieri
  4.  */
  5. public class GeometricVector {
  6.     private final Point3D start;
  7.     private final Point3D end;
  8.  
  9.     public GeometricVector(Point3D start, Point3D end) {
  10.         this.start = start;
  11.         this.end = end;
  12.     }
  13.  
  14.     public double size() {
  15.         double xPow2 = Math.pow(end.getX()-start.getX(), 2);
  16.         double yPow2 = Math.pow(end.getY()-start.getY(), 2);
  17.         double zPow2 = Math.pow(end.getZ()-start.getZ(), 2);
  18.         return Math.sqrt(xPow2 + yPow2 + zPow2);
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment