1 31 package org.objectweb.proactive.examples.c3d.geom; 32 33 final public class Ray implements java.io.Serializable { 34 35 public Vec P, D; 36 37 38 public Ray(Vec pnt, Vec dir) { 39 P = new Vec(pnt.x, pnt.y, pnt.z); 40 D = new Vec(dir.x, dir.y, dir.z); 41 D.normalize(); 42 } 43 44 45 public Ray() { 46 P = new Vec(); 47 D = new Vec(); 48 } 49 50 51 public Vec point(double t) { 52 return new Vec(P.x + D.x * t, P.y + D.y * t, P.z + D.z * t); 53 } 54 55 56 public String toString() { 57 return "{" + P.toString() + " -> " + D.toString() + "}"; 58 } 59 } 60 | Popular Tags |