You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
WebCAD/src/Common/Matrix4Utils.ts

35 lines
920 B

import { Matrix4, Vector3 } from 'three';
7 years ago
/**
*
*
* @export
* @param {Matrix4} mat
* @param {number} col ,0x 1y 2z 3org
* @param {Vector3} v
*/
export function matrixSetVector(mat: Matrix4, col: number, v: Vector3)
{
let index = col * 4;
mat.elements[index] = v.x;
mat.elements[index + 1] = v.y;
mat.elements[index + 2] = v.z;
}
/**
*
*
* X
* YZXAxisYAxisZAxis
*
* @export
*/
export function matrixAlignCoordSys(matrixFrom: Matrix4, matrixTo: Matrix4)
{
let matrix = new Matrix4().getInverse(matrixFrom);
matrix.multiply(matrixTo);
return matrix;
}