X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fsixth%2Fe3d%2Frenderer%2Foctree%2Fraytracer%2FRay.java;h=659a98994360395a7f52f993e316e812cddfb83c;hb=3f589bbc56ebfb1bd35b538b8a77d4019396b5aa;hp=ba61a4241ed6c580b07fccb7825c0337d6cac253;hpb=197ac1b87328bb5b06ba52d3768af04b2007b087;p=sixth-3d.git diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/Ray.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/Ray.java index ba61a42..659a989 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/Ray.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/Ray.java @@ -1,75 +1,29 @@ /* * Sixth 3D engine. Author: Svjatoslav Agejenko. * This project is released under Creative Commons Zero (CC0) license. - * -* */ - package eu.svjatoslav.sixth.e3d.renderer.octree.raytracer; +import eu.svjatoslav.sixth.e3d.geometry.Point3D; + public class Ray { - public double x, y, z; + // ray origin + public Point3D origin; - public double xp, yp, zp; + // ray direction + public Point3D direction; - public double hitX, hitY, hitZ; + // ray hit point + public Point3D hitPoint; 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; - y = Y; - z = Z; - xp = Xp; - yp = Yp; - zp = Zp; - // calculateOrientation(); + public Ray(Point3D origin, Point3D direction) { + this.origin = origin; + this.direction = direction; } - /* - * 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]; - */ - } }