getMatrixImpact
getMatrixImpact(
matrix,cameraState,viewportDimensions):number
Defined in: packages/sigma/src/utils/coordinates.ts:98
All these transformations we apply on the matrix to get it rescale the graph as we want make it very hard to get pixel-perfect distances in WebGL. This function returns a factor that properly cancels the matrix effect on lengths.
[jacomyal] To be fully honest, I can’t really explain happens here… I notice that the following ratio works (i.e. it correctly compensates the matrix impact on all camera states I could try):
R = size(V) / size(M * V) / Was long asM * Vis in the direction of W (ie. parallel to (Ox)). It works as well with H and a vector that transforms into something parallel to (Oy).
Also, note that we use angle and not -angle (that would seem logical,
since we want to anticipate the rotation), because the image is vertically
swapped in WebGL.
Parameters
Section titled “Parameters”matrix
Section titled “matrix”Float32Array
cameraState
Section titled “cameraState”viewportDimensions
Section titled “viewportDimensions”Returns
Section titled “Returns”number