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
()
| 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. |