MCPcopy Index your code
hub / github.com/plotly/plotly.js / perspective

Function perspective

stackgl_modules/index.js:16415–16435  ·  view source on GitHub ↗

* Generates a perspective projection matrix with the given bounds * * @param {mat4} out mat4 frustum matrix will be written into * @param {number} fovy Vertical field of view in radians * @param {number} aspect Aspect ratio. typically viewport width/height * @param {number} near Near bound of t

(out, fovy, aspect, near, far)

Source from the content-addressed store, hash-verified

16413 * @returns {mat4} out
16414 */
16415function perspective(out, fovy, aspect, near, far) {
16416 var f = 1.0 / Math.tan(fovy / 2),
16417 nf = 1 / (near - far);
16418 out[0] = f / aspect;
16419 out[1] = 0;
16420 out[2] = 0;
16421 out[3] = 0;
16422 out[4] = 0;
16423 out[5] = f;
16424 out[6] = 0;
16425 out[7] = 0;
16426 out[8] = 0;
16427 out[9] = 0;
16428 out[10] = (far + near) * nf;
16429 out[11] = -1;
16430 out[12] = 0;
16431 out[13] = 0;
16432 out[14] = (2 * far * near) * nf;
16433 out[15] = 0;
16434 return out;
16435};
16436
16437/***/ }),
16438

Callers 1

calcCameraParamsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…