How to use the @antv/matrix-util.vec3.transformMat3 function in @antv/matrix-util

To help you get started, we’ve selected a few @antv/matrix-util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github antvis / G6 / src / util / math.ts View on Github external
export const invertMatrix = (point: Point, matrix: Matrix, tag: 0 | 1 = 1): Point => {
  if (!matrix) { 
    matrix = mat3.create(); 
  }

  const inversedMatrix = mat3.invert([], matrix)
  const vector = [ point.x, point.y, tag ]
  vec3.transformMat3(vector, vector, inversedMatrix)

  return {
    x: vector[0],
    y: vector[1],
  };
};
github antvis / G6 / src / util / math.ts View on Github external
export const applyMatrix = (point: Point, matrix: Matrix, tag: 0 | 1 = 1): Point => {
  const vector = [ point.x, point.y, tag ]
  if(!matrix) {
    matrix = mat3.create()
  }
  
  vec3.transformMat3(vector, vector, matrix)

  return {
    x: vector[0],
    y: vector[1],
  };
};