Changed license to Creative Commons Zero (CC0).
[sixth-3d.git] / src / main / java / eu / svjatoslav / sixth / e3d / renderer / octree / raytracer / Ray.java
1 /*
2  * Sixth 3D engine. Author: Svjatoslav Agejenko. 
3  * This project is released under Creative Commons Zero (CC0) license.
4  *
5 *
6  */
7
8 package eu.svjatoslav.sixth.e3d.renderer.octree.raytracer;
9
10 public class Ray {
11
12     public double x, y, z;
13
14     public double xp, yp, zp;
15
16     public double hitX, hitY, hitZ;
17
18     public int hitCellSize;
19
20     public int hitCellX, hitCellY, hitCellZ;
21
22     /*
23      * public int orientation;
24      *
25      * public static final int ORIENTATION_RIGHT = 0;
26      *
27      * public static final int ORIENTATION_LEFT = 1;
28      *
29      * public static final int ORIENTATION_DOWN = 2;
30      *
31      * public static final int ORIENTATION_UP = 3;
32      *
33      * public static final int ORIENTATION_FORWARD = 4;
34      *
35      * public static final int ORIENTATION_BACK = 5;
36      *
37      * public static final String orientations[] = { "RIGHT", "LEFT", "DOWN",
38      * "UP", "FORWARD", "BACK" };
39      */
40
41     public Ray(final double X, final double Y, final double Z, final double Xp,
42                final double Yp, final double Zp) {
43         x = X;
44         y = Y;
45         z = Z;
46         xp = Xp;
47         yp = Yp;
48         zp = Zp;
49         // calculateOrientation();
50     }
51
52     /*
53      * public void calculateOrientation() { float axp = Math.abs(xp); float ayp
54      * = Math.abs(yp); float azp = Math.abs(zp);
55      *
56      * if (axp > ayp) { if (axp > azp) { if (xp > 0) { orientation =
57      * ORIENTATION_RIGHT; } else { orientation = ORIENTATION_LEFT; } } else { if
58      * (zp > 0) { orientation = ORIENTATION_FORWARD; } else { orientation =
59      * ORIENTATION_BACK; } } } else { if (ayp > azp) { if (yp > 0) { orientation
60      * = ORIENTATION_DOWN; } else { orientation = ORIENTATION_UP; } } else { if
61      * (zp > 0) { orientation = ORIENTATION_FORWARD; } else { orientation =
62      * ORIENTATION_BACK; } } }
63      *
64      *
65      * }
66      */
67     @Override
68     public String toString() {
69         return "Ray \n" + "     x " + x + "\n" + "      y " + y + "\n" + "      z " + z
70                 + "\n" + "      xp " + xp + "\n" + "    yp " + yp + "\n" + "    zp " + zp
71                 + "\n"; /*
72          * + "  orientation " + orientations[orientation];
73          */
74     }
75 }