java.lang.Object
eu.svjatoslav.sixth.e3d.renderer.octree.raytracer.Ray

public class Ray extends Object
Represents a ray used for tracing through an OctreeVolume.

A ray is defined by an origin point and a direction vector. After tracing through the octree, the intersection results are stored in the hitPoint, hitCellSize, and hitCellX/hitCellY/hitCellZ fields, which are populated by the octree traversal algorithm.

See Also:
  • Field Details

    • origin

      public Point3D origin
      The origin point of the ray (the starting position in world space).
    • direction

      public Point3D direction
      The direction vector of the ray. Does not need to be normalized; the octree traversal handles arbitrary direction magnitudes.
    • hitPoint

      public Point3D hitPoint
      The point in world space where the ray intersected an octree cell. Set by the octree traversal algorithm after a successful intersection.
    • hitCellSize

      public int hitCellSize
      The size (side length) of the octree cell that was hit. A value of 1 indicates a leaf cell at the finest resolution.
    • hitCellX

      public int hitCellX
      The x coordinate of the octree cell that was hit.
    • hitCellY

      public int hitCellY
      The y coordinate of the octree cell that was hit.
    • hitCellZ

      public int hitCellZ
      The z coordinate of the octree cell that was hit.
  • Constructor Details

    • Ray

      public Ray(Point3D origin, Point3D direction)
      Creates a new ray with the specified origin and direction.
      Parameters:
      origin - the starting point of the ray
      direction - the direction vector of the ray