Merge pull request #4305 from tatchx/master

added some missing tests and fixed a couple of mistakes and typos in …
This commit is contained in:
Masahiro Wakame
2015-05-12 00:37:18 +09:00
2 changed files with 15 additions and 3 deletions
+10 -1
View File
@@ -58,6 +58,7 @@ outStr = vec2.str(vecA);
// vec3
var matr: GLM.IArray;
var q: GLM.IArray;
vecA = [1, 2, 3];
vecB = new Float32Array([4, 5, 6]);
@@ -102,9 +103,12 @@ out = vec3.rotateY(out, vecA, vecB, Math.PI);
out = vec3.rotateZ(out, vecA, vecB, Math.PI);
out = vec3.transformMat3(out, vecA, matr);
matr = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]
matr = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ];
out = vec3.transformMat4(out, vecA, matr);
q = [1, 2, 3, 4];
out = vec3.transformQuat(out, vecA, matr);
out = vec3.forEach(vecArray, 0, 0, 0, vec3.normalize);
outVal = vec3.angle(vecA, vecB);
outStr = vec3.str(vecA);
@@ -237,10 +241,14 @@ out = mat3.normalFromMat4(out, matA);
q = [ 0, -0.7071067811865475, 0, 0.7071067811865475 ];
out = mat3.fromQuat(out, q);
out = mat3.normalFromMat4(out, [ 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12, 13,14,15,16]);
out = mat3.fromMat4(out, [ 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12, 13,14,15,16]);
out = mat3.scale(out, matA, [2,2]);
out = mat3.fromMat2d(out, [1, 2, 3, 4, 5, 6]);
out = mat3.translate(out, matA, [1, 2, 3]);
out = mat3.rotate(out, matA, Math.PI/2);
// mat4
matA = [1, 0, 0, 0,
0, 1, 0, 0,
@@ -324,6 +332,7 @@ outVal = quat.len(quatA);
outVal = quat.squaredLength(quatA);
outVal = quat.sqrLen(quatA);
out = quat.normalize(out, quatA);
outVal = quat.dot(out, quatA, quatB);
out = quat.lerp(out, quatA, quatB, 0.5);
out = quat.slerp(out, quatA, quatB, 0.5);
out = quat.invert(out, quatA);
+5 -2
View File
@@ -6,6 +6,9 @@
declare module GLM {
interface IArray
{
/**
* Must be indexable like an array
*/
[index: number]: number;
}
}
@@ -1585,7 +1588,7 @@ declare module mat3 {
* @param rad the angle to rotate the matrix by
* @returns out
*/
export function translate(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
export function rotate(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
}
// mat4
@@ -2007,7 +2010,7 @@ declare module quat {
* @returns dot product of a and b
* @function
*/
export function dot(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
export function dot(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): number;
/**
* Performs a linear interpolation between two quat's