2 * Sixth 3D engine. Copyright ©2012-2016, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of version 3 of the GNU Lesser General Public License
6 * or later as published by the Free Software Foundation.
10 package eu.svjatoslav.sixth.e3d.renderer.octree.raytracer;
14 public double x, y, z;
16 public double xp, yp, zp;
18 public double hitX, hitY, hitZ;
20 public int hitCellSize;
22 public int hitCellX, hitCellY, hitCellZ;
25 * public int orientation;
27 * public static final int ORIENTATION_RIGHT = 0;
29 * public static final int ORIENTATION_LEFT = 1;
31 * public static final int ORIENTATION_DOWN = 2;
33 * public static final int ORIENTATION_UP = 3;
35 * public static final int ORIENTATION_FORWARD = 4;
37 * public static final int ORIENTATION_BACK = 5;
39 * public static final String orientations[] = { "RIGHT", "LEFT", "DOWN",
40 * "UP", "FORWARD", "BACK" };
43 public Ray(final double X, final double Y, final double Z, final double Xp,
44 final double Yp, final double Zp) {
51 // calculateOrientation();
55 * public void calculateOrientation() { float axp = Math.abs(xp); float ayp
56 * = Math.abs(yp); float azp = Math.abs(zp);
58 * if (axp > ayp) { if (axp > azp) { if (xp > 0) { orientation =
59 * ORIENTATION_RIGHT; } else { orientation = ORIENTATION_LEFT; } } else { if
60 * (zp > 0) { orientation = ORIENTATION_FORWARD; } else { orientation =
61 * ORIENTATION_BACK; } } } else { if (ayp > azp) { if (yp > 0) { orientation
62 * = ORIENTATION_DOWN; } else { orientation = ORIENTATION_UP; } } else { if
63 * (zp > 0) { orientation = ORIENTATION_FORWARD; } else { orientation =
64 * ORIENTATION_BACK; } } }
70 public String toString() {
71 return "Ray \n" + " x " + x + "\n" + " y " + y + "\n" + " z " + z
72 + "\n" + " xp " + xp + "\n" + " yp " + yp + "\n" + " zp " + zp
74 * + " orientation " + orientations[orientation];