/*
- * Sixth 3D engine. Copyright ©2012-2019, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 3 of the GNU Lesser General Public License
- * or later as published by the Free Software Foundation.
- *
+ * Sixth 3D engine. Author: Svjatoslav Agejenko.
+ * This project is released under Creative Commons Zero (CC0) license.
*/
-
package eu.svjatoslav.sixth.e3d.renderer.octree.raytracer;
public class Ray {
+ // ray origin
public double x, y, z;
+ // ray direction
public double xp, yp, zp;
+ // ray hit point
public double hitX, hitY, hitZ;
+
public int hitCellSize;
public int hitCellX, hitCellY, hitCellZ;
- /*
- * public int orientation;
- *
- * public static final int ORIENTATION_RIGHT = 0;
- *
- * public static final int ORIENTATION_LEFT = 1;
- *
- * public static final int ORIENTATION_DOWN = 2;
- *
- * public static final int ORIENTATION_UP = 3;
- *
- * public static final int ORIENTATION_FORWARD = 4;
- *
- * public static final int ORIENTATION_BACK = 5;
- *
- * public static final String orientations[] = { "RIGHT", "LEFT", "DOWN",
- * "UP", "FORWARD", "BACK" };
- */
-
public Ray(final double X, final double Y, final double Z, final double Xp,
final double Yp, final double Zp) {
x = X;
xp = Xp;
yp = Yp;
zp = Zp;
- // calculateOrientation();
}
- /*
- * public void calculateOrientation() { float axp = Math.abs(xp); float ayp
- * = Math.abs(yp); float azp = Math.abs(zp);
- *
- * if (axp > ayp) { if (axp > azp) { if (xp > 0) { orientation =
- * ORIENTATION_RIGHT; } else { orientation = ORIENTATION_LEFT; } } else { if
- * (zp > 0) { orientation = ORIENTATION_FORWARD; } else { orientation =
- * ORIENTATION_BACK; } } } else { if (ayp > azp) { if (yp > 0) { orientation
- * = ORIENTATION_DOWN; } else { orientation = ORIENTATION_UP; } } else { if
- * (zp > 0) { orientation = ORIENTATION_FORWARD; } else { orientation =
- * ORIENTATION_BACK; } } }
- *
- *
- * }
- */
+
@Override
public String toString() {
return "Ray \n" + " x " + x + "\n" + " y " + y + "\n" + " z " + z
+ "\n" + " xp " + xp + "\n" + " yp " + yp + "\n" + " zp " + zp
- + "\n"; /*
- * + " orientation " + orientations[orientation];
- */
+ + "\n";
}
}