Class ProjectionMatrix
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.io7m.jtensors.core.unparameterized.matrices.Matrix4x4DfrustumProjectionRH(double x_min, double x_max, double y_min, double y_max, double z_near, double z_far) Calculate a matrix that produces a perspective projection.static com.io7m.jtensors.core.unparameterized.matrices.Matrix4x4DorthographicProjectionRH(double x_min, double x_max, double y_min, double y_max, double z_near, double z_far) Calculate a projection matrix that produces an orthographic projection based on the given clipping plane coordinates.static com.io7m.jtensors.core.unparameterized.matrices.Matrix4x4DperspectiveProjectionRH(double z_near, double z_far, double aspect, double horizontal_fov) Calculate a matrix that will produce a perspective projection based on the given view frustum parameters, the aspect ratio of the viewport and a given horizontal field of view in radians.
-
Method Details
-
frustumProjectionRH
public static com.io7m.jtensors.core.unparameterized.matrices.Matrix4x4D frustumProjectionRH(double x_min, double x_max, double y_min, double y_max, double z_near, double z_far) Calculate a matrix that produces a perspective projection. The
(x_min, y_min, z_near)and(x_max, y_max, z_near)parameters specify the points on the near clipping plane that are mapped to the lower-left and upper-right corners of the window, respectively, assuming that the eye is located at(0, 0, 0). Thez_farparameter specifies the location of the far clipping plane.Note that iff
z_far >= Double.POSITIVE_INFINITY, the function produces an "infinite projection matrix", suitable for use in code that deals with shadow volumes.The function assumes a right-handed coordinate system.
See GPU Gems
- Parameters:
x_min- The minimum X clip planex_max- The maximum X clip planey_min- The minimum Y clip planey_max- The maximum Y clip planez_near- The near Z clip planez_far- The far Z clip plane- Returns:
- A frustum projection matrix
-
orthographicProjectionRH
public static com.io7m.jtensors.core.unparameterized.matrices.Matrix4x4D orthographicProjectionRH(double x_min, double x_max, double y_min, double y_max, double z_near, double z_far) Calculate a projection matrix that produces an orthographic projection based on the given clipping plane coordinates.
The function assumes a right-handed coordinate system.
- Parameters:
x_min- The left clipping plane coordinatex_max- The right clipping plane coordinatey_min- The bottom clipping plane coordinatey_max- The top clipping plane coordinatez_near- The near clipping plane coordinatez_far- The far clipping plane coordinate- Returns:
- An orthographic projection matrix
-
perspectiveProjectionRH
public static com.io7m.jtensors.core.unparameterized.matrices.Matrix4x4D perspectiveProjectionRH(double z_near, double z_far, double aspect, double horizontal_fov) Calculate a matrix that will produce a perspective projection based on the given view frustum parameters, the aspect ratio of the viewport and a given horizontal field of view in radians. Note that
fov_radiansrepresents the full horizontal field of view: the angle at the base of the triangle formed by the frustum on thex/zplane.Note that iff
z_far >= Double.POSITIVE_INFINITY, the function produces an "infinite projection matrix", suitable for use in code that deals with shadow volumes.The function assumes a right-handed coordinate system.
See GPU Gems
- Parameters:
z_near- The near clipping plane coordinatez_far- The far clipping plane coordinateaspect- The aspect ratio of the viewport; the width divided by the height. For example, an aspect ratio of 2.0 indicates a viewport twice as wide as it is highhorizontal_fov- The horizontal field of view in radians- Returns:
- A perspective projection matrix
-