MCPcopy Create free account
hub / github.com/microsoft/SandDance / _initMatrices

Method _initMatrices

docs/app/js/sanddance-app.js:80119–80141  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

80117 Object.freeze(this);
80118 }
80119 _initMatrices() {
80120 const { width , height , projectionMatrix , viewMatrix } = this;
80121 const vpm = (0, _mathUtils.createMat4)();
80122 _mat4.multiply(vpm, vpm, projectionMatrix);
80123 _mat4.multiply(vpm, vpm, viewMatrix);
80124 this.viewProjectionMatrix = vpm;
80125 const m = (0, _mathUtils.createMat4)();
80126 _mat4.scale(m, m, [
80127 width / 2,
80128 -height / 2,
80129 1
80130 ]);
80131 _mat4.translate(m, m, [
80132 1,
80133 -1,
80134 0
80135 ]);
80136 _mat4.multiply(m, m, vpm);
80137 const mInverse = _mat4.invert((0, _mathUtils.createMat4)(), m);
80138 if (!mInverse) throw new Error("Pixel project matrix not invertible");
80139 this.pixelProjectionMatrix = m;
80140 this.pixelUnprojectionMatrix = mInverse;
80141 }
80142 projectFlat(lngLat) {
80143 return (0, _webMercatorUtils.lngLatToWorld)(lngLat);
80144 }

Callers 1

constructorMethod · 0.95

Calls 4

multiplyMethod · 0.45
scaleMethod · 0.45
translateMethod · 0.45
invertMethod · 0.45

Tested by

no test coverage detected