FrustumRayBuilder

Provides methods to compute rays through an arbitrary perspective transformation defined by a {@link Matrix4d}. <p> This can be used to compute the eye-rays in simple software-based raycasting/raytracing. <p> To obtain the origin of the rays call {@link #origin(Vector3d)}. Then to compute the directions of subsequent rays use {@link #dir(float, float, Vector3d)}.

@author Kai Burjack

Constructors

this
this(Matrix4d m)

Create a new {@link FrustumRayBuilder} from the given {@link Matrix4d matrix} by extracing the matrix's frustum.

Members

Functions

dir
Vector3d dir(float x, float y, Vector3d dir)

Obtain the normalized direction of a ray starting at the center of the coordinate system and going through the near frustum plane. <p> The parameters <code>x</code> and <code>y</code> are used to interpolate the generated ray direction from the bottom-left to the top-right frustum corners.

origin
Vector3d origin(Vector3d origin)

Store the eye/origin of the perspective frustum in the given <code>origin</code>.

set
FrustumRayBuilder set(Matrix4d m)

Update the stored frustum corner rays and origin of <code>this</code> {@link FrustumRayBuilder} with the given {@link Matrix4d matrix}. <p> Reference: <a href="http://gamedevs.org/uploads/fast-extraction-viewing-frustum-planes-from-world-view-projection-matrix.pdf"> Fast Extraction of Viewing Frustum Planes from the World-View-Projection Matrix</a> <p> Reference: <a href="http://geomalgorithms.com/a05-_intersect-1.html">http://geomalgorithms.com</a>

Meta