molstar
Version:
A comprehensive macromolecular library.
23 lines • 1.05 kB
JavaScript
/**
* Copyright (c) 2017 mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author David Sehnal <david.sehnal@gmail.com>
*/
Object.defineProperty(exports, "__esModule", { value: true });
var mat4_1 = require("../3d/mat4");
var vec3_1 = require("../3d/vec3");
describe('Mat4', function () {
it('permutation', function () {
expect(mat4_1.Mat4.areEqual(mat4_1.Mat4.fromPermutation((0, mat4_1.Mat4)(), [0, 1, 2, 3]), mat4_1.Mat4.identity(), 1e-6)).toBe(true);
expect(mat4_1.Mat4.areEqual(mat4_1.Mat4.fromPermutation((0, mat4_1.Mat4)(), [1, 0, 2, 3]), mat4_1.Mat4.ofRows([
[0, 1, 0, 0],
[1, 0, 0, 0],
[0, 0, 1, 0],
[0, 0, 0, 1],
]), 1e-6)).toBe(true);
var perm = mat4_1.Mat4.fromPermutation((0, mat4_1.Mat4)(), [1, 2, 0, 3]);
expect(vec3_1.Vec3.transformMat4((0, vec3_1.Vec3)(), vec3_1.Vec3.create(1, 2, 3), perm)).toEqual(vec3_1.Vec3.create(2, 3, 1));
});
});
//# sourceMappingURL=mat4.spec.js.map
;