Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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],
};
};
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],
};
};