Ported over bamboo benchmarks for use as non-Bamboo java benchmarks.
[IRC.git] / Robust / src / Benchmarks / Scheduling / GC / NON_BAMBOO / RayTracer / Ray.java
1 /**************************************************************************
2  *                                                                         *
3  *             Java Grande Forum Benchmark Suite - Version 2.0             *
4  *                                                                         *
5  *                            produced by                                  *
6  *                                                                         *
7  *                  Java Grande Benchmarking Project                       *
8  *                                                                         *
9  *                                at                                       *
10  *                                                                         *
11  *                Edinburgh Parallel Computing Centre                      *
12  *                                                                         *
13  *                email: epcc-javagrande@epcc.ed.ac.uk                     *
14  *                                                                         *
15  *                 Original version of this code by                        *
16  *            Florian Doyon (Florian.Doyon@sophia.inria.fr)                *
17  *              and  Wilfried Klauser (wklauser@acm.org)                   *
18  *                                                                         *
19  *      This version copyright (c) The University of Edinburgh, 1999.      *
20  *                         All rights reserved.                            *
21  *                                                                         *
22  **************************************************************************/
23
24
25
26 final public class Ray {
27   public Vec P, D;
28
29   public Ray(Vec pnt, Vec dir) {
30     P = new Vec(pnt.x, pnt.y, pnt.z);
31     D = new Vec(dir.x, dir.y, dir.z);
32     D.normalize();
33   }
34
35   public Ray() {
36     P = new Vec();
37     D = new Vec();
38   }
39
40   public Vec point(float t) {
41     return new Vec(P.x + D.x * t, P.y + D.y * t, P.z + D.z * t);
42   }
43
44   public String toString() {
45     return "{" + P.toString() + " -> " + D.toString() + "}";
46   }
47 }