MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / perspectiveFov

Method perspectiveFov

src/main/java/field/linalg/Mat4.java:5084–5098  ·  view source on GitHub ↗

Return the vertical field-of-view angle in radians of this perspective transformation matrix. Note that this method will only work using perspective projections obtained via one of the perspective methods, such as #perspective(double, double, double, double) perspective() or {@link #frus

()

Source from the content-addressed store, hash-verified

5082 * @return the vertical field-of-view angle in radians
5083 */
5084 public double perspectiveFov() {
5085 /*
5086 * Compute the angle between the bottom and top frustum plane normals.
5087 */
5088 double n1x, n1y, n1z, n2x, n2y, n2z;
5089 n1x = m03 + m01;
5090 n1y = m13 + m11;
5091 n1z = m23 + m21; // bottom
5092 n2x = m01 - m03;
5093 n2y = m11 - m13;
5094 n2z = m21 - m23; // top
5095 double n1len = Math.sqrt(n1x * n1x + n1y * n1y + n1z * n1z);
5096 double n2len = Math.sqrt(n2x * n2x + n2y * n2y + n2z * n2z);
5097 return Math.acos((n1x * n2x + n1y * n2y + n1z * n2z) / (n1len * n2len));
5098 }
5099
5100 /**
5101 * Determine whether the given point is within the viewing frustum defined by <code>this</code> matrix.

Callers

nothing calls this directly

Calls 1

acosMethod · 0.80

Tested by

no test coverage detected