, Milan Burda
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -62,7 +62,7 @@ declare namespace Electron {
/**
* Emitted when Electron has finished initialization.
*/
- on(event: 'ready', listener: Function): this;
+ on(event: 'ready', listener: (event: Event, launchInfo: Object) => void): this;
/**
* Emitted when all windows have been closed.
*
@@ -218,6 +218,10 @@ declare namespace Electron {
args?: string[],
execPath?: string
}): void;
+ /**
+ * @returns Whether Electron has finished initializing.
+ */
+ isReady(): boolean;
/**
* On Linux, focuses on the first visible window.
* On macOS, makes the application the active app.
@@ -1367,6 +1371,12 @@ declare namespace Electron {
}
interface WebPreferences {
+ /**
+ * Whether to enable DevTools.
+ * If it is set to false, can not use BrowserWindow.webContents.openDevTools() to open DevTools.
+ * Default: true.
+ */
+ devTools?: boolean;
/**
* Whether node integration is enabled.
* Default: true.
@@ -1957,7 +1967,7 @@ declare namespace Electron {
interface CrashReporterStartOptions {
/**
- * Default: Electron
+ * Default: app.getName()
*/
productName?: string;
companyName: string;
@@ -3392,16 +3402,18 @@ declare namespace Electron {
interface Shell {
/**
* Show the given file in a file manager. If possible, select the file.
+ * @returns Whether the item was successfully shown.
*/
- showItemInFolder(fullPath: string): void;
+ showItemInFolder(fullPath: string): boolean;
/**
* Open the given file in the desktop's default manner.
+ * @returns Whether the item was successfully shown.
*/
- openItem(fullPath: string): void;
+ openItem(fullPath: string): boolean;
/**
* Open the given external protocol URL in the desktop's default manner
* (e.g., mailto: URLs in the default mail user agent).
- * @returns true if an application was available to open the URL, false otherwise.
+ * @returns Whether an application was available to open the URL.
*/
openExternal(url: string, options?: {
/**
@@ -3412,7 +3424,7 @@ declare namespace Electron {
}): boolean;
/**
* Move the given file to trash.
- * @returns boolean status for the operation.
+ * @returns Whether the item was successfully moved to the trash.
*/
moveItemToTrash(fullPath: string): boolean;
/**
diff --git a/enzyme/index.d.ts b/enzyme/index.d.ts
index 9de785196c..cd5b6cc96d 100644
--- a/enzyme/index.d.ts
+++ b/enzyme/index.d.ts
@@ -454,6 +454,7 @@ export interface ShallowWrapper extends CommonWrapper
{
export interface ReactWrapper
extends CommonWrapper
{
unmount(): ReactWrapper;
mount(): ReactWrapper;
+ render(): CheerioWrapper;
/**
* Returns a wrapper of the node that matches the provided reference name.
diff --git a/express/express-tests.ts b/express/express-tests.ts
index 66747b7b41..fdcd85801f 100644
--- a/express/express-tests.ts
+++ b/express/express-tests.ts
@@ -1,53 +1,56 @@
///
import * as express from './';
-var app = express();
-app.engine('jade', require('jade').__express);
-app.engine('html', require('ejs').renderFile);
+namespace express_tests {
-express.static.mime.define({
+ var app = express();
+
+ app.engine('jade', require('jade').__express);
+ app.engine('html', require('ejs').renderFile);
+
+ express.static.mime.define({
'application/fx': ['fx']
-});
-app.use('/static', express.static(__dirname + '/public'));
+ });
+ app.use('/static', express.static(__dirname + '/public'));
-// simple logger
-app.use(function(req, res, next){
+ // simple logger
+ app.use(function(req, res, next) {
console.log('%s %s', req.method, req.url);
next();
-});
+ });
-app.use(function(err: any, req: express.Request, res: express.Response, next: express.NextFunction) {
+ app.use(function(err: any, req: express.Request, res: express.Response, next: express.NextFunction) {
console.error(err);
next(err);
-});
+ });
-app.get('/', function(req, res){
+ app.get('/', function(req, res) {
res.send('hello world');
-});
+ });
-const router = express.Router();
+ const router = express.Router();
-const pathStr : string = 'test';
-const pathRE : RegExp = /test/;
-const path = true? pathStr : pathRE;
+ const pathStr: string = 'test';
+ const pathRE: RegExp = /test/;
+ const path = true ? pathStr : pathRE;
-router.get(path);
-router.put(path)
-router.post(path);
-router.delete(path);
-router.get(pathStr);
-router.put(pathStr)
-router.post(pathStr);
-router.delete(pathStr);
-router.get(pathRE);
-router.put(pathRE)
-router.post(pathRE);
-router.delete(pathRE);
+ router.get(path);
+ router.put(path)
+ router.post(path);
+ router.delete(path);
+ router.get(pathStr);
+ router.put(pathStr)
+ router.post(pathStr);
+ router.delete(pathStr);
+ router.get(pathRE);
+ router.put(pathRE)
+ router.post(pathRE);
+ router.delete(pathRE);
-router.use((req, res, next) => { next(); })
-router.route('/users')
+ router.use((req, res, next) => { next(); })
+ router.route('/users')
.get((req, res, next) => {
let types: string[] = req.accepts();
let type: string | boolean = req.accepts('json');
@@ -72,28 +75,38 @@ router.route('/users')
res.send(req.query['token']);
});
-router.get('/user/:id', function(req, res, next) {
+ router.get('/user/:id', function(req, res, next) {
if (req.params.id == 0) next('route');
else next();
-}, function(req, res, next) {
+ }, function(req, res, next) {
res.render('regular');
-});
+ });
-app.use((req, res, next) => {
+ app.use((req, res, next) => {
// hacky trick, router is just a handler
router(req, res, next);
-});
+ });
-app.use(router);
+ app.use(router);
-app.listen(3000);
+ app.listen(3000);
-const next: express.NextFunction = () => {};
-const nextWithArgument: express.NextFunction = (err: any) => {};
-
-/**
- * The express.Application is compatible with http.createServer
- */
+ const next: express.NextFunction = () => { };
+}
+/***************************
+ * *
+ * Test with other modules *
+ * *
+ ***************************/
import * as http from 'http';
-http.createServer(app);
+
+
+namespace node_tests {
+
+ {
+ // http.createServer can take express application
+ const app: express.Application = express();
+ http.createServer(app).listen(5678);
+ }
+}
diff --git a/facebook-js-sdk/facebook-js-sdk-tests.ts b/facebook-js-sdk/facebook-js-sdk-tests.ts
index d9f8dc20d3..61721a4f71 100644
--- a/facebook-js-sdk/facebook-js-sdk-tests.ts
+++ b/facebook-js-sdk/facebook-js-sdk-tests.ts
@@ -14,6 +14,12 @@ FB.getLoginStatus(function(response: fb.AuthResponse) {
console.log(response.authResponse.accessToken);
});
+FB.getLoginStatus(function(response: fb.AuthResponse) {
+ console.log(response);
+ console.log(response.status);
+ console.log(response.authResponse.accessToken);
+}, true);
+
FB.getAuthResponse(function(response: fb.AuthResponse) {
console.log(response);
console.log(response.status);
diff --git a/facebook-js-sdk/index.d.ts b/facebook-js-sdk/index.d.ts
index 5353353911..bee34f0a2c 100644
--- a/facebook-js-sdk/index.d.ts
+++ b/facebook-js-sdk/index.d.ts
@@ -8,10 +8,11 @@ declare var FB: fb.FacebookStatic;
declare namespace facebook {
interface FacebookStatic {
- // api: any;
- // AppEvents: any;
- // Canvas: any;
- // Event: any;
+ api: any;
+ AppEvents: any;
+ Canvas: any;
+ Event: any;
+
/**
* The method FB.getAuthResponse() is a synchronous accessor for the current authResponse.
* The synchronous nature of this method is what sets it apart from the other login methods.
@@ -25,7 +26,7 @@ declare namespace facebook {
*
* @param callback function to handle the response.
*/
- getLoginStatus(callback: (response: AuthResponse) => void): void;
+ getLoginStatus(callback: (response: AuthResponse) => void, roundtrip?: boolean ): void;
/**
* The method FB.init() is used to initialize and setup the SDK.
*
@@ -49,8 +50,9 @@ declare namespace facebook {
* @param callback function to handle the response
*/
logout(callback: (response: AuthResponse) => void): void;
- // ui: any;
- // XFBML: any;
+
+ ui: any;
+ XFBML: any;
}
interface InitParams {
diff --git a/gl-matrix/gl-matrix-legacy-tests.ts b/gl-matrix/gl-matrix-legacy-tests.ts
new file mode 100644
index 0000000000..5cfa9a1c3a
--- /dev/null
+++ b/gl-matrix/gl-matrix-legacy-tests.ts
@@ -0,0 +1,362 @@
+///
+
+// common
+var result: number = glMatrix.toRadian(180);
+
+var out: GLM.IArray;
+var outVal: number;
+var outStr: string;
+
+// vec2
+var vecA: GLM.IArray, vecB: GLM.IArray, matA: GLM.IArray;
+var vecArray: GLM.IArray;
+
+vecA = [1, 2];
+vecB = new Float32Array([3, 4]);
+out = [0, 0];
+matA = [1, 2, 3, 4, 5, 6];
+vecArray = [1, 2, 3, 4, 0, 0];
+
+out = vec2.create();
+out = vec2.clone(vecA);
+out = vec2.fromValues(1, 2);
+out = vec2.copy(out, vecA);
+out = vec2.set(out, 1, 2);
+out = vec2.add(out, vecA, vecB);
+out = vec2.subtract(out, vecA, vecB);
+out = vec2.sub(out, vecA, vecB);
+out = vec2.multiply(out, vecA, vecB);
+out = vec2.mul(out, vecA, vecB);
+out = vec2.divide(out, vecA, vecB);
+out = vec2.div(out, vecA, vecB);
+out = vec2.min(out, vecA, vecB);
+out = vec2.max(out, vecA, vecB);
+out = vec2.scale(out, vecA, 2);
+out = vec2.scaleAndAdd(out, vecA, vecB, 0.5);
+outVal = vec2.distance(vecA, vecB);
+outVal = vec2.dist(vecA, vecB);
+outVal = vec2.squaredDistance(vecA, vecB);
+outVal = vec2.sqrDist(vecA, vecB);
+outVal = vec2.length(vecA);
+outVal = vec2.len(vecA);
+outVal = vec2.squaredLength(vecA);
+outVal = vec2.sqrLen(vecA);
+out = vec2.negate(out, vecA);
+out = vec2.inverse(out, vecA);
+out = vec2.normalize(out, vecA);
+outVal = vec2.dot(vecA, vecB);
+out = vec2.cross(out, vecA, vecB);
+out = vec2.lerp(out, vecA, vecB, 0.5);
+out = vec2.random(out);
+out = vec2.random(out, 5.0);
+out = vec2.transformMat2(out, vecA, matA);
+out = vec2.transformMat2d(out, vecA, matA);
+out = vec2.transformMat3(out, vecA, matA);
+out = vec2.transformMat4(out, vecA, matA);
+out = vec2.forEach(vecArray, 0, 0, 0, vec2.normalize);
+outStr = vec2.str(vecA);
+
+// vec3
+var matr: GLM.IArray;
+var q: GLM.IArray;
+
+vecA = [1, 2, 3];
+vecB = new Float32Array([4, 5, 6]);
+out = [0, 0, 0];
+vecArray = [1, 2, 3, 4, 5, 6, 0, 0, 0];
+matr = [1, 0, 0, 0, 1, 0, 0, 0, 1 ];
+
+out = vec3.create();
+out = vec3.clone(vecA);
+out = vec3.fromValues(1, 2, 3);
+out = vec3.copy(out, vecA);
+out = vec3.set(out, 1, 2, 3);
+out = vec3.add(out, vecA, vecB);
+out = vec3.subtract(out, vecA, vecB);
+out = vec3.sub(out, vecA, vecB);
+out = vec3.multiply(out, vecA, vecB);
+out = vec3.mul(out, vecA, vecB);
+out = vec3.divide(out, vecA, vecB);
+out = vec3.div(out, vecA, vecB);
+out = vec3.min(out, vecA, vecB);
+out = vec3.max(out, vecA, vecB);
+out = vec3.scale(out, vecA, 2);
+out = vec3.scaleAndAdd(out, vecA, vecB, 0.5);
+outVal = vec3.distance(vecA, vecB);
+outVal = vec3.dist(vecA, vecB);
+outVal = vec3.squaredDistance(vecA, vecB);
+outVal = vec3.sqrDist(vecA, vecB);
+outVal = vec3.length(vecA);
+outVal = vec3.len(vecA);
+outVal = vec3.squaredLength(vecA);
+outVal = vec3.sqrLen(vecA);
+out = vec3.negate(out, vecA);
+out = vec3.inverse(out, vecA);
+out = vec3.normalize(out, vecA);
+outVal = vec3.dot(vecA, vecB);
+out = vec3.cross(out, vecA, vecB);
+out = vec3.lerp(out, vecA, vecB, 0.5);
+out = vec3.random(out);
+out = vec3.random(out, 5.0);
+out = vec3.rotateX(out, vecA, vecB, Math.PI);
+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 ];
+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);
+
+// vec4
+var q: GLM.IArray;
+
+vecA = [1, 2, 3, 4];
+vecB = new Float32Array([5, 6, 7, 8]);
+out = [0, 0, 0, 0];
+q = [1, 2, 3, 4];
+
+out = vec4.create();
+out = vec4.clone(vecA);
+out = vec4.fromValues(1, 2, 3, 4);
+out = vec4.copy(out, vecA);
+out = vec4.set(out, 1, 2, 3, 4);
+out = vec4.add(out, vecA, vecB);
+out = vec4.subtract(out, vecA, vecB);
+out = vec4.sub(out, vecA, vecB);
+out = vec4.multiply(out, vecA, vecB);
+out = vec4.mul(out, vecA, vecB);
+out = vec4.divide(out, vecA, vecB);
+out = vec4.div(out, vecA, vecB);
+out = vec4.min(out, vecA, vecB);
+out = vec4.max(out, vecA, vecB);
+out = vec4.scale(out, vecA, 2);
+out = vec4.scaleAndAdd(out, vecA, vecB, 0.5);
+outVal = vec4.distance(vecA, vecB);
+outVal = vec4.dist(vecA, vecB);
+outVal = vec4.squaredDistance(vecA, vecB);
+outVal = vec4.sqrDist(vecA, vecB);
+outVal = vec4.length(vecA);
+outVal = vec4.len(vecA);
+outVal = vec4.squaredLength(vecA);
+outVal = vec4.sqrLen(vecA);
+out = vec4.negate(out, vecA);
+out = vec4.inverse(out, vecA);
+out = vec4.normalize(out, vecA);
+outVal = vec4.dot(vecA, vecB);
+out = vec4.lerp(out, vecA, vecB, 0.5);
+out = vec4.random(out);
+out = vec4.random(out, 5.0);
+
+matr = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]
+out = vec4.transformMat4(out, vecA, matr);
+out = vec4.transformQuat(out, vecA, q);
+
+vecArray = [1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0];
+out = vec4.forEach(vecArray, 0, 0, 0, vec4.normalize);
+outStr = vec4.str(vecA);
+
+// mat2
+var matB: GLM.IArray, identity: GLM.IArray;
+
+matA = [1, 2, 3, 4];
+matB = new Float32Array([5, 6, 7, 8]);
+out = [0, 0, 0, 0];
+identity = [1, 0, 0, 1];
+
+out = mat2.create();
+out = mat2.clone(matA);
+out = mat2.copy(out, matA);
+out = mat2.identity(out);
+out = mat2.transpose(out, matA);
+out = mat2.invert(out, matA);
+out = mat2.adjoint(out, matA);
+outVal = mat2.determinant(matA);
+out = mat2.multiply(out, matA, matB);
+out = mat2.mul(out, matA, matB);
+out = mat2.rotate(out, matA, Math.PI * 0.5);
+
+vecA = [2, 3];
+out = mat2.scale(out, matA, vecA);
+outStr = mat2.str(matA);
+outVal = mat2.frob(matA);
+
+var L = mat2.create();
+var D = mat2.create();
+var U = mat2.create();
+out = mat2.LDU(L, D, U, [4,3,6,3]);
+
+// mat2d
+matA = [1, 2, 3, 4, 5, 6];
+matB = [7, 8, 9, 10, 11, 12];
+out = [0, 0, 0, 0, 0, 0];
+identity = [1, 0, 0, 1, 0, 0];
+
+out = mat2d.create();
+out = mat2d.clone(matA);
+out = mat2d.copy(out, matA);
+out = mat2d.identity(out);
+out = mat2d.invert(out, matA);
+outVal = mat2d.determinant(matA);
+out = mat2d.multiply(out, matA, matB);
+out = mat2d.mul(out, matA, matB);
+out = mat2d.rotate(out, matA, Math.PI * 0.5);
+
+vecA = [2, 3];
+out = mat2d.scale(out, matA, vecA);
+out = mat2d.translate(out, matA, vecA);
+outStr = mat2d.str(matA);
+outVal = mat2d.frob(matA);
+
+// mat3
+matA = [1, 0, 0, 0, 1, 0, 1, 2, 1];
+matB = [1, 0, 0, 0, 1, 0, 3, 4, 1];
+out = [0, 0, 0, 0, 0, 0, 0, 0, 0];
+identity = [1, 0, 0, 0, 1, 0, 0, 0, 1];
+
+out = mat3.create();
+out = mat3.clone(matA);
+out = mat3.copy(out, matA);
+out = mat3.identity(out);
+out = mat3.transpose(out, matA);
+out = mat3.invert(out, matA);
+out = mat3.adjoint(out, matA);
+outVal = mat3.determinant(matA);
+out = mat3.multiply(out, matA, matB);
+out = mat3.mul(out, matA, matB);
+outStr = mat3.str(matA);
+outVal = mat3.frob(matA);
+
+matA = [1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1];
+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,
+ 0, 0, 1, 0,
+ 1, 2, 3, 1];
+
+matB = [1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ 4, 5, 6, 1];
+
+out = [0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0];
+
+identity = [1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1];
+
+out = mat4.create();
+out = mat4.clone(matA);
+out = mat4.copy(out, matA);
+out = mat4.identity(out);
+out = mat4.transpose(out, matA);
+out = mat4.invert(out, matA);
+out = mat4.adjoint(out, matA);
+outVal = mat4.determinant(matA);
+out = mat4.multiply(out, matA, matB);
+out = mat4.mul(out, matA, matB);
+out = mat4.translate(out, matA, [4, 5, 6]);
+out = mat4.scale(out, matA, [4, 5, 6]);
+
+var rad = Math.PI * 0.5;
+var axis = [1, 0, 0];
+out = mat4.rotate(out, matA, rad, axis);
+out = mat4.rotateX(out, matA, rad);
+out = mat4.rotateY(out, matA, rad);
+out = mat4.rotateZ(out, matA, rad);
+
+out = mat4.frustum(out, -1, 1, -1, 1, -1, 1);
+
+var fovy = Math.PI * 0.5;
+out = mat4.perspective(out, fovy, 1, 0, 1);
+out = mat4.ortho(out, -1, 1, -1, 1, -1, 1);
+
+var eye = [0, 0, 1];
+var center = [0, 0, -1];
+var up = [0, 1, 0];
+out = mat4.lookAt(out, eye, center, up);
+
+outStr = mat4.str(matA);
+outVal = mat4.frob(matA);
+
+q = [0, 0, 0, 1];
+out = mat4.fromRotationTranslation(out, q, [1, 2, 3]);
+out = mat4.fromQuat(out, q);
+
+q = [0, 0, 0, 1];
+out = mat4.fromRotationTranslationScale(out, q, [1, 2, 3], [1, 2, 3]);
+out = mat4.fromQuat(out, q);
+
+
+// quat
+var quatA = [1, 2, 3, 4];
+var quatB = [5, 6, 7, 8];
+out = [0, 0, 0, 0];
+var vec = [1, 1, -1];
+var id = [0, 0, 0, 1];
+var deg90 = Math.PI / 2;
+
+out = quat.create();
+out = quat.clone(quatA);
+out = quat.fromValues(1, 2, 3, 4);
+out = quat.copy(out, quatA);
+out = quat.set(out, 1, 2, 3, 4);
+out = quat.identity(out);
+out = quat.setAxisAngle(out, [1, 0, 0], Math.PI * 0.5);
+out = quat.add(out, quatA, quatB);
+out = quat.multiply(out, quatA, quatB);
+out = quat.mul(out, quatA, quatB);
+out = quat.scale(out, quatA, 2);
+outVal = quat.length(quatA);
+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);
+out = quat.conjugate(out, quatA);
+outStr = quat.str(quatA);
+out = quat.rotateX(out, id, deg90);
+out = quat.rotateY(out, id, deg90);
+out = quat.rotateZ(out, id, deg90);
+
+matr = [ 1, 0, 0,
+ 0, 0, -1,
+ 0, 1, 0 ];
+out = quat.fromMat3(out, matr);
+
+var view = [-1, 0, 0];
+up = [ 0, 1, 0];
+var right= [ 0, 0,-1];
+out = quat.setAxes([], view, right, up);
+
+out = quat.rotationTo(out, [0, 1, 0], [1, 0, 0]);
+out = quat.calculateW(out, quatA);
+
diff --git a/gl-matrix/gl-matrix-legacy.d.ts b/gl-matrix/gl-matrix-legacy.d.ts
new file mode 100644
index 0000000000..16366f263a
--- /dev/null
+++ b/gl-matrix/gl-matrix-legacy.d.ts
@@ -0,0 +1,2163 @@
+// Type definitions for gl-matrix 2.2.2
+// Project: https://github.com/toji/gl-matrix
+// Definitions by: Tat
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+declare namespace GLM {
+ interface IArray
+ {
+ /**
+ * Must be indexable like an array
+ */
+ [index: number]: number;
+ }
+}
+
+// Common
+declare namespace glMatrix {
+ /**
+ * Convert Degree To Radian
+ *
+ * @param a Angle in Degrees
+ */
+ export function toRadian(a: number): number;
+}
+
+// vec2
+declare namespace vec2 {
+ /**
+ * Creates a new, empty vec2
+ *
+ * @returns a new 2D vector
+ */
+ export function create(): GLM.IArray;
+
+ /**
+ * Creates a new vec2 initialized with values from an existing vector
+ *
+ * @param a a vector to clone
+ * @returns a new 2D vector
+ */
+ export function clone(a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Creates a new vec2 initialized with the given values
+ *
+ * @param x X component
+ * @param y Y component
+ * @returns a new 2D vector
+ */
+ export function fromValues(x: number, y: number): GLM.IArray;
+
+ /**
+ * Copy the values from one vec2 to another
+ *
+ * @param out the receiving vector
+ * @param a the source vector
+ * @returns out
+ */
+ export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Set the components of a vec2 to the given values
+ *
+ * @param out the receiving vector
+ * @param x X component
+ * @param y Y component
+ * @returns out
+ */
+ export function set(out: GLM.IArray, x: number, y: number): GLM.IArray;
+
+ /**
+ * Adds two vec2's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function add(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Subtracts vector b from vector a
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function subtract(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Subtracts vector b from vector a
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function sub(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Multiplies two vec2's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Multiplies two vec2's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Divides two vec2's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function divide(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Divides two vec2's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function div(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Returns the minimum of two vec2's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function min(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Returns the maximum of two vec2's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function max(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Scales a vec2 by a scalar number
+ *
+ * @param out the receiving vector
+ * @param a the vector to scale
+ * @param b amount to scale the vector by
+ * @returns out
+ */
+ export function scale(out: GLM.IArray, a: GLM.IArray, b: number): GLM.IArray;
+
+ /**
+ * Adds two vec2's after scaling the second operand by a scalar value
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @param scale the amount to scale b by before adding
+ * @returns out
+ */
+ export function scaleAndAdd(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, scale: number): GLM.IArray;
+
+ /**
+ * Calculates the euclidian distance between two vec2's
+ *
+ * @param a the first operand
+ * @param b the second operand
+ * @returns distance between a and b
+ */
+ export function distance(a: GLM.IArray, b: GLM.IArray): number;
+
+ /**
+ * Calculates the euclidian distance between two vec2's
+ *
+ * @param a the first operand
+ * @param b the second operand
+ * @returns distance between a and b
+ */
+ export function dist(a: GLM.IArray, b: GLM.IArray): number;
+
+ /**
+ * Calculates the squared euclidian distance between two vec2's
+ *
+ * @param a the first operand
+ * @param b the second operand
+ * @returns squared distance between a and b
+ */
+ export function squaredDistance(a: GLM.IArray, b: GLM.IArray): number;
+
+ /**
+ * Calculates the squared euclidian distance between two vec2's
+ *
+ * @param a the first operand
+ * @param b the second operand
+ * @returns squared distance between a and b
+ */
+ export function sqrDist(a: GLM.IArray, b: GLM.IArray): number;
+
+ /**
+ * Calculates the length of a vec2
+ *
+ * @param a vector to calculate length of
+ * @returns length of a
+ */
+ export function length(a: GLM.IArray): number;
+
+ /**
+ * Calculates the length of a vec2
+ *
+ * @param a vector to calculate length of
+ * @returns length of a
+ */
+ export function len(a: GLM.IArray): number;
+
+ /**
+ * Calculates the squared length of a vec2
+ *
+ * @param a vector to calculate squared length of
+ * @returns squared length of a
+ */
+ export function squaredLength(a: GLM.IArray): number;
+
+ /**
+ * Calculates the squared length of a vec2
+ *
+ * @param a vector to calculate squared length of
+ * @returns squared length of a
+ */
+ export function sqrLen(a: GLM.IArray): number;
+
+ /**
+ * Negates the components of a vec2
+ *
+ * @param out the receiving vector
+ * @param a vector to negate
+ * @returns out
+ */
+ export function negate(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Returns the inverse of the components of a vec2
+ *
+ * @param out the receiving vector
+ * @param a vector to invert
+ * @returns out
+ */
+ export function inverse(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Normalize a vec2
+ *
+ * @param out the receiving vector
+ * @param a vector to normalize
+ * @returns out
+ */
+ export function normalize(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Calculates the dot product of two vec2's
+ *
+ * @param a the first operand
+ * @param b the second operand
+ * @returns dot product of a and b
+ */
+ export function dot(a: GLM.IArray, b: GLM.IArray): number;
+
+ /**
+ * Computes the cross product of two vec2's
+ * Note that the cross product must by definition produce a 3D vector
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function cross(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Performs a linear interpolation between two vec2's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @param t interpolation amount between the two inputs
+ * @returns out
+ */
+ export function lerp(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, t: number): GLM.IArray;
+
+ /**
+ * Generates a random unit vector
+ *
+ * @param out the receiving vector
+ * @returns out
+ */
+ export function random(out: GLM.IArray): GLM.IArray;
+
+ /**
+ * Generates a random vector with the given scale
+ *
+ * @param out the receiving vector
+ * @param scale Length of the resulting vector. If ommitted, a unit vector will be returned
+ * @returns out
+ */
+ export function random(out: GLM.IArray, scale: number): GLM.IArray;
+
+ /**
+ * Transforms the vec2 with a mat2
+ *
+ * @param out the receiving vector
+ * @param a the vector to transform
+ * @param m matrix to transform with
+ * @returns out
+ */
+ export function transformMat2(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray;
+
+ /**
+ * Transforms the vec2 with a mat2d
+ *
+ * @param out the receiving vector
+ * @param a the vector to transform
+ * @param m matrix to transform with
+ * @returns out
+ */
+ export function transformMat2d(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray;
+
+ /**
+ * Transforms the vec2 with a mat3
+ * 3rd vector component is implicitly '1'
+ *
+ * @param out the receiving vector
+ * @param a the vector to transform
+ * @param m matrix to transform with
+ * @returns out
+ */
+ export function transformMat3(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray;
+
+ /**
+ * Transforms the vec2 with a mat4
+ * 3rd vector component is implicitly '0'
+ * 4th vector component is implicitly '1'
+ *
+ * @param out the receiving vector
+ * @param a the vector to transform
+ * @param m matrix to transform with
+ * @returns out
+ */
+ export function transformMat4(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray;
+
+ /**
+ * Perform some operation over an array of vec2s.
+ *
+ * @param a the array of vectors to iterate over
+ * @param stride Number of elements between the start of each vec2. If 0 assumes tightly packed
+ * @param offset Number of elements to skip at the beginning of the array
+ * @param count Number of vec2s to iterate over. If 0 iterates over entire array
+ * @param fn Function to call for each vector in the array
+ * @param arg additional argument to pass to fn
+ * @returns a
+ */
+ export function forEach(a: GLM.IArray, stride: number, offset: number, count: number,
+ fn: (a: GLM.IArray, b: GLM.IArray, arg: any) => void, arg: any): GLM.IArray;
+
+ /**
+ * Perform some operation over an array of vec2s.
+ *
+ * @param a the array of vectors to iterate over
+ * @param stride Number of elements between the start of each vec2. If 0 assumes tightly packed
+ * @param offset Number of elements to skip at the beginning of the array
+ * @param count Number of vec2s to iterate over. If 0 iterates over entire array
+ * @param fn Function to call for each vector in the array
+ * @returns a
+ */
+ export function forEach(a: GLM.IArray, stride: number, offset: number, count: number,
+ fn: (a: GLM.IArray, b: GLM.IArray) => void): GLM.IArray;
+
+ /**
+ * Returns a string representation of a vector
+ *
+ * @param vec vector to represent as a string
+ * @returns string representation of the vector
+ */
+ export function str(a: GLM.IArray): string;
+}
+
+// vec3
+declare namespace vec3 {
+
+ /**
+ * Creates a new, empty vec3
+ *
+ * @returns a new 3D vector
+ */
+ export function create(): GLM.IArray;
+
+ /**
+ * Creates a new vec3 initialized with values from an existing vector
+ *
+ * @param a vector to clone
+ * @returns a new 3D vector
+ */
+ export function clone(a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Creates a new vec3 initialized with the given values
+ *
+ * @param x X component
+ * @param y Y component
+ * @param z Z component
+ * @returns a new 3D vector
+ */
+ export function fromValues(x: number, y: number, z: number): GLM.IArray;
+
+ /**
+ * Copy the values from one vec3 to another
+ *
+ * @param out the receiving vector
+ * @param a the source vector
+ * @returns out
+ */
+ export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Set the components of a vec3 to the given values
+ *
+ * @param out the receiving vector
+ * @param x X component
+ * @param y Y component
+ * @param z Z component
+ * @returns out
+ */
+ export function set(out: GLM.IArray, x: number, y: number, z: number): GLM.IArray;
+
+ /**
+ * Adds two vec3's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function add(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Subtracts vector b from vector a
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function subtract(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Subtracts vector b from vector a
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function sub(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray
+
+ /**
+ * Multiplies two vec3's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Multiplies two vec3's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Divides two vec3's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function divide(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Divides two vec3's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function div(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Returns the minimum of two vec3's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function min(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Returns the maximum of two vec3's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function max(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Scales a vec3 by a scalar number
+ *
+ * @param out the receiving vector
+ * @param a the vector to scale
+ * @param b amount to scale the vector by
+ * @returns out
+ */
+ export function scale(out: GLM.IArray, a: GLM.IArray, b: number): GLM.IArray;
+
+ /**
+ * Adds two vec3's after scaling the second operand by a scalar value
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @param scale the amount to scale b by before adding
+ * @returns out
+ */
+ export function scaleAndAdd(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, scale: number): GLM.IArray;
+
+ /**
+ * Calculates the euclidian distance between two vec3's
+ *
+ * @param a the first operand
+ * @param b the second operand
+ * @returns distance between a and b
+ */
+ export function distance(a: GLM.IArray, b: GLM.IArray): number;
+
+ /**
+ * Calculates the euclidian distance between two vec3's
+ *
+ * @param a the first operand
+ * @param b the second operand
+ * @returns distance between a and b
+ */
+ export function dist(a: GLM.IArray, b: GLM.IArray): number;
+
+ /**
+ * Calculates the squared euclidian distance between two vec3's
+ *
+ * @param a the first operand
+ * @param b the second operand
+ * @returns squared distance between a and b
+ */
+ export function squaredDistance(a: GLM.IArray, b: GLM.IArray): number;
+
+ /**
+ * Calculates the squared euclidian distance between two vec3's
+ *
+ * @param a the first operand
+ * @param b the second operand
+ * @returns squared distance between a and b
+ */
+ export function sqrDist(a: GLM.IArray, b: GLM.IArray): number;
+
+ /**
+ * Calculates the length of a vec3
+ *
+ * @param a vector to calculate length of
+ * @returns length of a
+ */
+ export function length(a: GLM.IArray): number;
+
+ /**
+ * Calculates the length of a vec3
+ *
+ * @param a vector to calculate length of
+ * @returns length of a
+ */
+ export function len(a: GLM.IArray): number;
+
+ /**
+ * Calculates the squared length of a vec3
+ *
+ * @param a vector to calculate squared length of
+ * @returns squared length of a
+ */
+ export function squaredLength(a: GLM.IArray): number;
+
+ /**
+ * Calculates the squared length of a vec3
+ *
+ * @param a vector to calculate squared length of
+ * @returns squared length of a
+ */
+ export function sqrLen(a: GLM.IArray): number;
+
+ /**
+ * Negates the components of a vec3
+ *
+ * @param out the receiving vector
+ * @param a vector to negate
+ * @returns out
+ */
+ export function negate(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Returns the inverse of the components of a vec3
+ *
+ * @param out the receiving vector
+ * @param a vector to invert
+ * @returns out
+ */
+ export function inverse(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Normalize a vec3
+ *
+ * @param out the receiving vector
+ * @param a vector to normalize
+ * @returns out
+ */
+ export function normalize(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Calculates the dot product of two vec3's
+ *
+ * @param a the first operand
+ * @param b the second operand
+ * @returns dot product of a and b
+ */
+ export function dot(a: GLM.IArray, b: GLM.IArray): number;
+
+ /**
+ * Computes the cross product of two vec3's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function cross(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Performs a linear interpolation between two vec3's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @param t interpolation amount between the two inputs
+ * @returns out
+ */
+ export function lerp(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, t: number): GLM.IArray;
+
+ /**
+ * Generates a random unit vector
+ *
+ * @param out the receiving vector
+ * @returns out
+ */
+ export function random(out: GLM.IArray): GLM.IArray;
+
+ /**
+ * Generates a random vector with the given scale
+ *
+ * @param out the receiving vector
+ * @param [scale] Length of the resulting vector. If ommitted, a unit vector will be returned
+ * @returns out
+ */
+ export function random(out: GLM.IArray, scale: number): GLM.IArray;
+
+ /**
+ * Rotate a 3D vector around the x-axis
+ * @param out The receiving vec3
+ * @param a The vec3 point to rotate
+ * @param b The origin of the rotation
+ * @param c The angle of rotation
+ * @returns out
+ */
+ export function rotateX(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, c: number): GLM.IArray;
+
+ /**
+ * Rotate a 3D vector around the y-axis
+ * @param out The receiving vec3
+ * @param a The vec3 point to rotate
+ * @param b The origin of the rotation
+ * @param c The angle of rotation
+ * @returns out
+ */
+ export function rotateY(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, c: number): GLM.IArray;
+
+ /**
+ * Rotate a 3D vector around the z-axis
+ * @param out The receiving vec3
+ * @param a The vec3 point to rotate
+ * @param b The origin of the rotation
+ * @param c The angle of rotation
+ * @returns out
+ */
+ export function rotateZ(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, c: number): GLM.IArray;
+
+ /**
+ * Transforms the vec3 with a mat3.
+ *
+ * @param out the receiving vector
+ * @param a the vector to transform
+ * @param m the 3x3 matrix to transform with
+ * @returns out
+ */
+ export function transformMat3(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray;
+
+ /**
+ * Transforms the vec3 with a mat4.
+ * 4th vector component is implicitly '1'
+ *
+ * @param out the receiving vector
+ * @param a the vector to transform
+ * @param m matrix to transform with
+ * @returns out
+ */
+ export function transformMat4(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray;
+
+ /**
+ * Transforms the vec3 with a quat
+ *
+ * @param out the receiving vector
+ * @param a the vector to transform
+ * @param q quaternion to transform with
+ * @returns out
+ */
+ export function transformQuat(out: GLM.IArray, a: GLM.IArray, q: GLM.IArray): GLM.IArray;
+
+
+ /**
+ * Perform some operation over an array of vec3s.
+ *
+ * @param a the array of vectors to iterate over
+ * @param stride Number of elements between the start of each vec3. If 0 assumes tightly packed
+ * @param offset Number of elements to skip at the beginning of the array
+ * @param count Number of vec3s to iterate over. If 0 iterates over entire array
+ * @param fn Function to call for each vector in the array
+ * @param arg additional argument to pass to fn
+ * @returns a
+ * @function
+ */
+ export function forEach(out: GLM.IArray, string: number, offset: number, count: number,
+ fn: (a: GLM.IArray, b: GLM.IArray, arg: any) => void, arg: any): GLM.IArray;
+
+ /**
+ * Perform some operation over an array of vec3s.
+ *
+ * @param a the array of vectors to iterate over
+ * @param stride Number of elements between the start of each vec3. If 0 assumes tightly packed
+ * @param offset Number of elements to skip at the beginning of the array
+ * @param count Number of vec3s to iterate over. If 0 iterates over entire array
+ * @param fn Function to call for each vector in the array
+ * @returns a
+ * @function
+ */
+ export function forEach(out: GLM.IArray, string: number, offset: number, count: number,
+ fn: (a: GLM.IArray, b: GLM.IArray) => void): GLM.IArray;
+
+ /**
+ * Get the angle between two 3D vectors
+ * @param a The first operand
+ * @param b The second operand
+ * @returns The angle in radians
+ */
+ export function angle(a: GLM.IArray, b: GLM.IArray): number;
+
+ /**
+ * Returns a string representation of a vector
+ *
+ * @param vec vector to represent as a string
+ * @returns string representation of the vector
+ */
+ export function str(a: GLM.IArray): string;
+}
+
+// vec4
+declare namespace vec4 {
+
+ /**
+ * Creates a new, empty vec4
+ *
+ * @returns a new 4D vector
+ */
+ export function create(): GLM.IArray;
+
+ /**
+ * Creates a new vec4 initialized with values from an existing vector
+ *
+ * @param a vector to clone
+ * @returns a new 4D vector
+ */
+ export function clone(a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Creates a new vec4 initialized with the given values
+ *
+ * @param x X component
+ * @param y Y component
+ * @param z Z component
+ * @param w W component
+ * @returns a new 4D vector
+ */
+ export function fromValues(x: number, y: number, z: number, w: number): GLM.IArray;
+
+ /**
+ * Copy the values from one vec4 to another
+ *
+ * @param out the receiving vector
+ * @param a the source vector
+ * @returns out
+ */
+ export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Set the components of a vec4 to the given values
+ *
+ * @param out the receiving vector
+ * @param x X component
+ * @param y Y component
+ * @param z Z component
+ * @param w W component
+ * @returns out
+ */
+ export function set(out: GLM.IArray, x: number, y: number, z: number, w: number): GLM.IArray;
+
+ /**
+ * Adds two vec4's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function add(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Subtracts vector b from vector a
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function subtract(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Subtracts vector b from vector a
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function sub(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Multiplies two vec4's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Multiplies two vec4's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Divides two vec4's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function divide(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Divides two vec4's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function div(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Returns the minimum of two vec4's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function min(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Returns the maximum of two vec4's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function max(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Scales a vec4 by a scalar number
+ *
+ * @param out the receiving vector
+ * @param a the vector to scale
+ * @param b amount to scale the vector by
+ * @returns out
+ */
+ export function scale(out: GLM.IArray, a: GLM.IArray, b: number): GLM.IArray;
+
+ /**
+ * Adds two vec4's after scaling the second operand by a scalar value
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @param scale the amount to scale b by before adding
+ * @returns out
+ */
+ export function scaleAndAdd(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, scale: number): GLM.IArray;
+
+ /**
+ * Calculates the euclidian distance between two vec4's
+ *
+ * @param a the first operand
+ * @param b the second operand
+ * @returns distance between a and b
+ */
+ export function distance(a: GLM.IArray, b: GLM.IArray): number;
+
+ /**
+ * Calculates the euclidian distance between two vec4's
+ *
+ * @param a the first operand
+ * @param b the second operand
+ * @returns distance between a and b
+ */
+ export function dist(a: GLM.IArray, b: GLM.IArray): number;
+
+ /**
+ * Calculates the squared euclidian distance between two vec4's
+ *
+ * @param a the first operand
+ * @param b the second operand
+ * @returns squared distance between a and b
+ */
+ export function squaredDistance(a: GLM.IArray, b: GLM.IArray): number;
+
+ /**
+ * Calculates the squared euclidian distance between two vec4's
+ *
+ * @param a the first operand
+ * @param b the second operand
+ * @returns squared distance between a and b
+ */
+ export function sqrDist(a: GLM.IArray, b: GLM.IArray): number;
+
+ /**
+ * Calculates the length of a vec4
+ *
+ * @param a vector to calculate length of
+ * @returns length of a
+ */
+ export function length(a: GLM.IArray): number;
+
+ /**
+ * Calculates the length of a vec4
+ *
+ * @param a vector to calculate length of
+ * @returns length of a
+ */
+ export function len(a: GLM.IArray): number;
+
+ /**
+ * Calculates the squared length of a vec4
+ *
+ * @param a vector to calculate squared length of
+ * @returns squared length of a
+ */
+ export function squaredLength(a: GLM.IArray): number;
+
+ /**
+ * Calculates the squared length of a vec4
+ *
+ * @param a vector to calculate squared length of
+ * @returns squared length of a
+ */
+ export function sqrLen(a: GLM.IArray): number;
+
+ /**
+ * Negates the components of a vec4
+ *
+ * @param out the receiving vector
+ * @param a vector to negate
+ * @returns out
+ */
+ export function negate(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Returns the inverse of the components of a vec4
+ *
+ * @param out the receiving vector
+ * @param a vector to invert
+ * @returns out
+ */
+ export function inverse(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Normalize a vec4
+ *
+ * @param out the receiving vector
+ * @param a vector to normalize
+ * @returns out
+ */
+ export function normalize(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Calculates the dot product of two vec4's
+ *
+ * @param a the first operand
+ * @param b the second operand
+ * @returns dot product of a and b
+ */
+ export function dot(a: GLM.IArray, b: GLM.IArray): number;
+
+ /**
+ * Performs a linear interpolation between two vec4's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @param t interpolation amount between the two inputs
+ * @returns out
+ */
+ export function lerp(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, t: number): GLM.IArray;
+
+ /**
+ * Generates a random unit vector
+ *
+ * @param out the receiving vector
+ * @returns out
+ */
+ export function random(out: GLM.IArray): GLM.IArray;
+
+ /**
+ * Generates a random vector with the given scale
+ *
+ * @param out the receiving vector
+ * @param Length of the resulting vector. If ommitted, a unit vector will be returned
+ * @returns out
+ */
+ export function random(out: GLM.IArray, scale: number): GLM.IArray;
+
+ /**
+ * Transforms the vec4 with a mat4.
+ *
+ * @param out the receiving vector
+ * @param a the vector to transform
+ * @param m matrix to transform with
+ * @returns out
+ */
+ export function transformMat4(out: GLM.IArray, a: GLM.IArray, mat: GLM.IArray): GLM.IArray;
+
+ /**
+ * Transforms the vec4 with a quat
+ *
+ * @param out the receiving vector
+ * @param a the vector to transform
+ * @param q quaternion to transform with
+ * @returns out
+ */
+ export function transformQuat(out: GLM.IArray, a: GLM.IArray, quat: GLM.IArray): GLM.IArray;
+
+ /**
+ * Perform some operation over an array of vec4s.
+ *
+ * @param a the array of vectors to iterate over
+ * @param stride Number of elements between the start of each vec4. If 0 assumes tightly packed
+ * @param offset Number of elements to skip at the beginning of the array
+ * @param count Number of vec4s to iterate over. If 0 iterates over entire array
+ * @param fn Function to call for each vector in the array
+ * @param additional argument to pass to fn
+ * @returns a
+ * @function
+ */
+ export function forEach(out: GLM.IArray, string: number, offset: number, count: number,
+ callback: (a: GLM.IArray, b: GLM.IArray, arg: any) => void, arg: any): GLM.IArray;
+
+ /**
+ * Perform some operation over an array of vec4s.
+ *
+ * @param a the array of vectors to iterate over
+ * @param stride Number of elements between the start of each vec4. If 0 assumes tightly packed
+ * @param offset Number of elements to skip at the beginning of the array
+ * @param count Number of vec4s to iterate over. If 0 iterates over entire array
+ * @param fn Function to call for each vector in the array
+ * @returns a
+ * @function
+ */
+ export function forEach(out: GLM.IArray, string: number, offset: number, count: number,
+ callback: (a: GLM.IArray, b: GLM.IArray) => void): GLM.IArray;
+
+ /**
+ * Returns a string representation of a vector
+ *
+ * @param vec vector to represent as a string
+ * @returns string representation of the vector
+ */
+ export function str(a: GLM.IArray): string;
+}
+
+// mat2
+declare namespace mat2 {
+
+ /**
+ * Creates a new identity mat2
+ *
+ * @returns a new 2x2 matrix
+ */
+ export function create(): GLM.IArray;
+
+ /**
+ * Creates a new mat2 initialized with values from an existing matrix
+ *
+ * @param a matrix to clone
+ * @returns a new 2x2 matrix
+ */
+ export function clone(a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Copy the values from one mat2 to another
+ *
+ * @param out the receiving matrix
+ * @param a the source matrix
+ * @returns out
+ */
+ export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Set a mat2 to the identity matrix
+ *
+ * @param out the receiving matrix
+ * @returns out
+ */
+ export function identity(out: GLM.IArray): GLM.IArray;
+
+ /**
+ * Transpose the values of a mat2
+ *
+ * @param out the receiving matrix
+ * @param a the source matrix
+ * @returns out
+ */
+ export function transpose(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Inverts a mat2
+ *
+ * @param out the receiving matrix
+ * @param a the source matrix
+ * @returns out
+ */
+ export function invert(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Calculates the adjugate of a mat2
+ *
+ * @param out the receiving matrix
+ * @param a the source matrix
+ * @returns out
+ */
+ export function adjoint(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Calculates the determinant of a mat2
+ *
+ * @param a the source matrix
+ * @returns determinant of a
+ */
+ export function determinant(a: GLM.IArray): number;
+
+ /**
+ * Multiplies two mat2's
+ *
+ * @param out the receiving matrix
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Multiplies two mat2's
+ *
+ * @param out the receiving matrix
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Rotates a mat2 by the given angle
+ *
+ * @param out the receiving matrix
+ * @param a the matrix to rotate
+ * @param rad the angle to rotate the matrix by
+ * @returns out
+ */
+ export function rotate(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+
+ /**
+ * Scales the mat2 by the dimensions in the given vec2
+ *
+ * @param out the receiving matrix
+ * @param a the matrix to rotate
+ * @param v the vec2 to scale the matrix by
+ * @returns out
+ **/
+ export function scale(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray;
+
+ /**
+ * Returns a string representation of a mat2
+ *
+ * @param a matrix to represent as a string
+ * @returns string representation of the matrix
+ */
+ export function str(a: GLM.IArray): string;
+
+ /**
+ * Returns Frobenius norm of a mat2
+ *
+ * @param a the matrix to calculate Frobenius norm of
+ * @returns Frobenius norm
+ */
+ export function frob(a: GLM.IArray): number;
+
+ /**
+ * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix
+ * @param L the lower triangular matrix
+ * @param D the diagonal matrix
+ * @param U the upper triangular matrix
+ * @param a the input matrix to factorize
+ */
+ export function LDU(L: GLM.IArray, D: GLM.IArray, U: GLM.IArray, a: GLM.IArray): GLM.IArray;
+}
+
+// mat2d
+declare namespace mat2d {
+
+ /**
+ * Creates a new identity mat2d
+ *
+ * @returns a new 2x3 matrix
+ */
+ export function create(): GLM.IArray;
+
+ /**
+ * Creates a new mat2d initialized with values from an existing matrix
+ *
+ * @param a matrix to clone
+ * @returns a new 2x3 matrix
+ */
+ export function clone(a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Copy the values from one mat2d to another
+ *
+ * @param out the receiving matrix
+ * @param a the source matrix
+ * @returns out
+ */
+ export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Set a mat2d to the identity matrix
+ *
+ * @param out the receiving matrix
+ * @returns out
+ */
+ export function identity(out: GLM.IArray): GLM.IArray;
+
+ /**
+ * Inverts a mat2d
+ *
+ * @param out the receiving matrix
+ * @param a the source matrix
+ * @returns out
+ */
+ export function invert(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Calculates the determinant of a mat2d
+ *
+ * @param a the source matrix
+ * @returns determinant of a
+ */
+ export function determinant(a: GLM.IArray): number;
+
+ /**
+ * Multiplies two mat2d's
+ *
+ * @param out the receiving matrix
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Multiplies two mat2d's
+ *
+ * @param out the receiving matrix
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Rotates a mat2d by the given angle
+ *
+ * @param out the receiving matrix
+ * @param a the matrix to rotate
+ * @param rad the angle to rotate the matrix by
+ * @returns out
+ */
+ export function rotate(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+
+ /**
+ * Scales the mat2d by the dimensions in the given vec2
+ *
+ * @param out the receiving matrix
+ * @param a the matrix to translate
+ * @param v the vec2 to scale the matrix by
+ * @returns out
+ **/
+ export function scale(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray;
+
+ /**
+ * Translates the mat2d by the dimensions in the given vec2
+ *
+ * @param out the receiving matrix
+ * @param a the matrix to translate
+ * @param v the vec2 to translate the matrix by
+ * @returns out
+ **/
+ export function translate(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray;
+
+ /**
+ * Returns a string representation of a mat2d
+ *
+ * @param a matrix to represent as a string
+ * @returns string representation of the matrix
+ */
+ export function str(a: GLM.IArray): string;
+
+ /**
+ * Returns Frobenius norm of a mat2d
+ *
+ * @param a the matrix to calculate Frobenius norm of
+ * @returns Frobenius norm
+ */
+ export function frob(a: GLM.IArray): number;
+}
+
+// mat3
+declare namespace mat3 {
+
+ /**
+ * Creates a new identity mat3
+ *
+ * @returns a new 3x3 matrix
+ */
+ export function create(): GLM.IArray;
+
+ /**
+ * Creates a new mat3 initialized with values from an existing matrix
+ *
+ * @param a matrix to clone
+ * @returns a new 3x3 matrix
+ */
+ export function clone(a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Copy the values from one mat3 to another
+ *
+ * @param out the receiving matrix
+ * @param a the source matrix
+ * @returns out
+ */
+ export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Set a mat3 to the identity matrix
+ *
+ * @param out the receiving matrix
+ * @returns out
+ */
+ export function identity(out: GLM.IArray): GLM.IArray;
+
+ /**
+ * Transpose the values of a mat3
+ *
+ * @param out the receiving matrix
+ * @param a the source matrix
+ * @returns out
+ */
+ export function transpose(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Inverts a mat3
+ *
+ * @param out the receiving matrix
+ * @param a the source matrix
+ * @returns out
+ */
+ export function invert(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Calculates the adjugate of a mat3
+ *
+ * @param out the receiving matrix
+ * @param a the source matrix
+ * @returns out
+ */
+ export function adjoint(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Calculates the determinant of a mat3
+ *
+ * @param a the source matrix
+ * @returns determinant of a
+ */
+ export function determinant(a: GLM.IArray): number;
+
+ /**
+ * Multiplies two mat3's
+ *
+ * @param out the receiving matrix
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Multiplies two mat3's
+ *
+ * @param out the receiving matrix
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Returns a string representation of a mat3
+ *
+ * @param mat matrix to represent as a string
+ * @returns string representation of the matrix
+ */
+ export function str(mat: GLM.IArray): string;
+
+ /**
+ * Returns Frobenius norm of a mat3
+ *
+ * @param a the matrix to calculate Frobenius norm of
+ * @returns Frobenius norm
+ */
+ export function frob(a: GLM.IArray): number;
+
+ /**
+ * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix
+ *
+ * @param out mat3 receiving operation result
+ * @param a Mat4 to derive the normal matrix from
+ *
+ * @returns out
+ */
+ export function normalFromMat4(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Calculates a 3x3 matrix from the given quaternion
+ *
+ * @param out mat3 receiving operation result
+ * @param q Quaternion to create matrix from
+ *
+ * @returns out
+ */
+ export function fromQuat(out: GLM.IArray, q: GLM.IArray): GLM.IArray;
+
+ /**
+ * Copies the upper-left 3x3 values into the given mat3.
+ *
+ * @param out the receiving 3x3 matrix
+ * @param a the source 4x4 matrix
+ * @returns out
+ */
+ export function fromMat4(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Scales the mat3 by the dimensions in the given vec2
+ *
+ * @param out the receiving matrix
+ * @param a the matrix to rotate
+ * @param v the vec2 to scale the matrix by
+ * @returns out
+ **/
+ export function scale(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray;
+
+ /**
+ * Copies the values from a mat2d into a mat3
+ *
+ * @param out the receiving matrix
+ * @param {mat2d} a the matrix to copy
+ * @returns out
+ **/
+ export function fromMat2d(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Translate a mat3 by the given vector
+ *
+ * @param out the receiving matrix
+ * @param a the matrix to translate
+ * @param v vector to translate by
+ * @returns out
+ */
+ export function translate(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray;
+
+ /**
+ * Rotates a mat3 by the given angle
+ *
+ * @param out the receiving matrix
+ * @param a the matrix to rotate
+ * @param rad the angle to rotate the matrix by
+ * @returns out
+ */
+ export function rotate(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+}
+
+// mat4
+declare namespace mat4 {
+
+ /**
+ * Creates a new identity mat4
+ *
+ * @returns a new 4x4 matrix
+ */
+ export function create(): GLM.IArray;
+
+ /**
+ * Creates a new mat4 initialized with values from an existing matrix
+ *
+ * @param a matrix to clone
+ * @returns a new 4x4 matrix
+ */
+ export function clone(a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Copy the values from one mat4 to another
+ *
+ * @param out the receiving matrix
+ * @param a the source matrix
+ * @returns out
+ */
+ export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Set a mat4 to the identity matrix
+ *
+ * @param out the receiving matrix
+ * @returns out
+ */
+ export function identity(a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Transpose the values of a mat4
+ *
+ * @param out the receiving matrix
+ * @param a the source matrix
+ * @returns out
+ */
+ export function transpose(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Inverts a mat4
+ *
+ * @param out the receiving matrix
+ * @param a the source matrix
+ * @returns out
+ */
+ export function invert(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Calculates the adjugate of a mat4
+ *
+ * @param out the receiving matrix
+ * @param a the source matrix
+ * @returns out
+ */
+ export function adjoint(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Calculates the determinant of a mat4
+ *
+ * @param a the source matrix
+ * @returns determinant of a
+ */
+ export function determinant(a: GLM.IArray): number;
+
+ /**
+ * Multiplies two mat4's
+ *
+ * @param out the receiving matrix
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Multiplies two mat4's
+ *
+ * @param out the receiving matrix
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Translate a mat4 by the given vector
+ *
+ * @param out the receiving matrix
+ * @param a the matrix to translate
+ * @param v vector to translate by
+ * @returns out
+ */
+ export function translate(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray;
+
+ /**
+ * Scales the mat4 by the dimensions in the given vec3
+ *
+ * @param out the receiving matrix
+ * @param a the matrix to scale
+ * @param v the vec3 to scale the matrix by
+ * @returns out
+ **/
+ export function scale(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray;
+
+ /**
+ * Rotates a mat4 by the given angle
+ *
+ * @param out the receiving matrix
+ * @param a the matrix to rotate
+ * @param rad the angle to rotate the matrix by
+ * @param axis the axis to rotate around
+ * @returns out
+ */
+ export function rotate(out: GLM.IArray, a: GLM.IArray, rad: number, axis: GLM.IArray): GLM.IArray;
+
+ /**
+ * Rotates a matrix by the given angle around the X axis
+ *
+ * @param out the receiving matrix
+ * @param a the matrix to rotate
+ * @param rad the angle to rotate the matrix by
+ * @returns out
+ */
+ export function rotateX(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+
+ /**
+ * Rotates a matrix by the given angle around the Y axis
+ *
+ * @param out the receiving matrix
+ * @param a the matrix to rotate
+ * @param rad the angle to rotate the matrix by
+ * @returns out
+ */
+ export function rotateY(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+
+ /**
+ * Rotates a matrix by the given angle around the Z axis
+ *
+ * @param out the receiving matrix
+ * @param a the matrix to rotate
+ * @param rad the angle to rotate the matrix by
+ * @returns out
+ */
+ export function rotateZ(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+
+ /**
+ * Generates a frustum matrix with the given bounds
+ *
+ * @param out mat4 frustum matrix will be written into
+ * @param left Left bound of the frustum
+ * @param right Right bound of the frustum
+ * @param bottom Bottom bound of the frustum
+ * @param top Top bound of the frustum
+ * @param near Near bound of the frustum
+ * @param far Far bound of the frustum
+ * @returns out
+ */
+ export function frustum(out: GLM.IArray, left: number, right: number,
+ bottom: number, top: number, near: number, far: number): GLM.IArray;
+
+ /**
+ * Generates a perspective projection matrix with the given bounds
+ *
+ * @param out mat4 frustum matrix will be written into
+ * @param fovy Vertical field of view in radians
+ * @param aspect Aspect ratio. typically viewport width/height
+ * @param near Near bound of the frustum
+ * @param far Far bound of the frustum
+ * @returns out
+ */
+ export function perspective(out: GLM.IArray, fovy: number, aspect: number,
+ near: number, far: number): GLM.IArray;
+
+ /**
+ * Generates a orthogonal projection matrix with the given bounds
+ *
+ * @param out mat4 frustum matrix will be written into
+ * @param left Left bound of the frustum
+ * @param right Right bound of the frustum
+ * @param bottom Bottom bound of the frustum
+ * @param top Top bound of the frustum
+ * @param near Near bound of the frustum
+ * @param far Far bound of the frustum
+ * @returns out
+ */
+ export function ortho(out: GLM.IArray, left: number, right: number,
+ bottom: number, top: number, near: number, far: number): GLM.IArray;
+
+ /**
+ * Generates a look-at matrix with the given eye position, focal point, and up axis
+ *
+ * @param out mat4 frustum matrix will be written into
+ * @param eye Position of the viewer
+ * @param center Point the viewer is looking at
+ * @param up vec3 pointing up
+ * @returns out
+ */
+ export function lookAt(out: GLM.IArray, eye: GLM.IArray,
+ center: GLM.IArray, up: GLM.IArray): GLM.IArray;
+
+ /**
+ * Returns a string representation of a mat4
+ *
+ * @param mat matrix to represent as a string
+ * @returns string representation of the matrix
+ */
+ export function str(mat: GLM.IArray): string;
+
+ /**
+ * Returns Frobenius norm of a mat4
+ *
+ * @param a the matrix to calculate Frobenius norm of
+ * @returns Frobenius norm
+ */
+ export function frob(a: GLM.IArray): number;
+
+ /**
+ * Creates a matrix from a quaternion rotation and vector translation
+ * This is equivalent to (but much faster than):
+ *
+ * mat4.identity(dest);
+ * mat4.translate(dest, vec);
+ * var quatMat = mat4.create();
+ * quat4.toMat4(quat, quatMat);
+ * mat4.multiply(dest, quatMat);
+ *
+ * @param out mat4 receiving operation result
+ * @param q Rotation quaternion
+ * @param v Translation vector
+ * @returns out
+ */
+ export function fromRotationTranslation(out: GLM.IArray, q: GLM.IArray, v: GLM.IArray): GLM.IArray;
+
+ /**
+ * Creates a matrix from a quaternion rotation, vector translation and vector scale.
+ *
+ * This is equivalent to (but much faster than):
+ *
+ * mat4.identity(dest);
+ * mat4.translate(dest, vec);
+ * var quatMat = mat4.create();
+ * quat4.toMat4(quat, quatMat);
+ * mat4.multiply(dest, quatMat);
+ * mat4.scale(dest, scale)
+ *
+ * @param out mat4 receiving operation result
+ * @param q Rotation quaternion
+ * @param v Translation vector
+ * @param s Scale vector
+ * @returns out
+ */
+ export function fromRotationTranslationScale(out: GLM.IArray, q: GLM.IArray, v: GLM.IArray, s: GLM.IArray): GLM.IArray
+
+ /**
+ * Creates a matrix from a quaternion
+ *
+ * @param out mat4 receiving operation result
+ * @param q Rotation quaternion
+ * @returns out
+ */
+ export function fromQuat(out: GLM.IArray, q: GLM.IArray): GLM.IArray;
+}
+
+// quat
+declare namespace quat {
+
+ /**
+ * Creates a new identity quat
+ *
+ * @returns a new quaternion
+ */
+ export function create(): GLM.IArray;
+
+ /**
+ * Creates a new quat initialized with values from an existing quaternion
+ *
+ * @param a quaternion to clone
+ * @returns a new quaternion
+ * @function
+ */
+ export function clone(a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Creates a new quat initialized with the given values
+ *
+ * @param x X component
+ * @param y Y component
+ * @param z Z component
+ * @param w W component
+ * @returns a new quaternion
+ * @function
+ */
+ export function fromValues(x: number, y: number, z: number, w: number): GLM.IArray;
+
+ /**
+ * Copy the values from one quat to another
+ *
+ * @param out the receiving quaternion
+ * @param a the source quaternion
+ * @returns out
+ * @function
+ */
+ export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Set the components of a quat to the given values
+ *
+ * @param out the receiving quaternion
+ * @param x X component
+ * @param y Y component
+ * @param z Z component
+ * @param w W component
+ * @returns out
+ * @function
+ */
+ export function set(out: GLM.IArray, x: number, y: number, z: number, w: number): GLM.IArray;
+
+ /**
+ * Set a quat to the identity quaternion
+ *
+ * @param out the receiving quaternion
+ * @returns out
+ */
+ export function identity(out: GLM.IArray): GLM.IArray;
+
+ /**
+ * Sets a quat from the given angle and rotation axis,
+ * then returns it.
+ *
+ * @param out the receiving quaternion
+ * @param axis the axis around which to rotate
+ * @param rad the angle in radians
+ * @returns out
+ **/
+ export function setAxisAngle(out: GLM.IArray, axis: GLM.IArray, rad: number): GLM.IArray;
+
+ /**
+ * Adds two quat's
+ *
+ * @param out the receiving quaternion
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ * @function
+ */
+ export function add(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Multiplies two quat's
+ *
+ * @param out the receiving quaternion
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Multiplies two quat's
+ *
+ * @param out the receiving quaternion
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Scales a quat by a scalar number
+ *
+ * @param out the receiving vector
+ * @param a the vector to scale
+ * @param b amount to scale the vector by
+ * @returns out
+ * @function
+ */
+ export function scale(out: GLM.IArray, a: GLM.IArray, b: number): GLM.IArray;
+
+ /**
+ * Calculates the length of a quat
+ *
+ * @param a vector to calculate length of
+ * @returns length of a
+ * @function
+ */
+ export function length(a: GLM.IArray): number;
+
+ /**
+ * Calculates the length of a quat
+ *
+ * @param a vector to calculate length of
+ * @returns length of a
+ * @function
+ */
+ export function len(a: GLM.IArray): number;
+
+ /**
+ * Calculates the squared length of a quat
+ *
+ * @param a vector to calculate squared length of
+ * @returns squared length of a
+ * @function
+ */
+ export function squaredLength(a: GLM.IArray): number;
+
+ /**
+ * Calculates the squared length of a quat
+ *
+ * @param a vector to calculate squared length of
+ * @returns squared length of a
+ * @function
+ */
+ export function sqrLen(a: GLM.IArray): number;
+
+ /**
+ * Normalize a quat
+ *
+ * @param out the receiving quaternion
+ * @param a quaternion to normalize
+ * @returns out
+ * @function
+ */
+ export function normalize(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Calculates the dot product of two quat's
+ *
+ * @param a the first operand
+ * @param b the second operand
+ * @returns dot product of a and b
+ * @function
+ */
+ export function dot(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): number;
+
+ /**
+ * Performs a linear interpolation between two quat's
+ *
+ * @param out the receiving quaternion
+ * @param a the first operand
+ * @param b the second operand
+ * @param t interpolation amount between the two inputs
+ * @returns out
+ * @function
+ */
+ export function lerp(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, t: number): GLM.IArray;
+
+ /**
+ * Performs a spherical linear interpolation between two quat
+ *
+ * @param out the receiving quaternion
+ * @param a the first operand
+ * @param b the second operand
+ * @param t interpolation amount between the two inputs
+ * @returns out
+ */
+ export function slerp(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, t: number): GLM.IArray;
+
+ /**
+ * Calculates the inverse of a quat
+ *
+ * @param out the receiving quaternion
+ * @param a quat to calculate inverse of
+ * @returns out
+ */
+ export function invert(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Calculates the conjugate of a quat
+ * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result.
+ *
+ * @param out the receiving quaternion
+ * @param a quat to calculate conjugate of
+ * @returns out
+ */
+ export function conjugate(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Returns a string representation of a quatenion
+ *
+ * @param vec vector to represent as a string
+ * @returns string representation of the vector
+ */
+ export function str(a: GLM.IArray): string;
+
+ /**
+ * Rotates a quaternion by the given angle about the X axis
+ *
+ * @param out quat receiving operation result
+ * @param a quat to rotate
+ * @param rad angle (in radians) to rotate
+ * @returns out
+ */
+ export function rotateX(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+
+ /**
+ * Rotates a quaternion by the given angle about the Y axis
+ *
+ * @param out quat receiving operation result
+ * @param a quat to rotate
+ * @param rad angle (in radians) to rotate
+ * @returns out
+ */
+ export function rotateY(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+
+ /**
+ * Rotates a quaternion by the given angle about the Z axis
+ *
+ * @param out quat receiving operation result
+ * @param a quat to rotate
+ * @param rad angle (in radians) to rotate
+ * @returns out
+ */
+ export function rotateZ(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+
+ /**
+ * Creates a quaternion from the given 3x3 rotation matrix.
+ *
+ * NOTE: The resultant quaternion is not normalized, so you should be sure
+ * to renormalize the quaternion yourself where necessary.
+ *
+ * @param out the receiving quaternion
+ * @param m rotation matrix
+ * @returns out
+ * @function
+ */
+ export function fromMat3(out: GLM.IArray, m: GLM.IArray): GLM.IArray;
+
+ /**
+ * Sets the specified quaternion with values corresponding to the given
+ * axes. Each axis is a vec3 and is expected to be unit length and
+ * perpendicular to all other specified axes.
+ *
+ * @param view the vector representing the viewing direction
+ * @param right the vector representing the local "right" direction
+ * @param up the vector representing the local "up" direction
+ * @returns out
+ */
+ export function setAxes(out: GLM.IArray, view: GLM.IArray, right: GLM.IArray,
+ up: GLM.IArray): GLM.IArray;
+
+ /**
+ * Sets a quaternion to represent the shortest rotation from one
+ * vector to another.
+ *
+ * Both vectors are assumed to be unit length.
+ *
+ * @param out the receiving quaternion.
+ * @param a the initial vector
+ * @param b the destination vector
+ * @returns out
+ */
+ export function rotationTo(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Calculates the W component of a quat from the X, Y, and Z components.
+ * Assumes that quaternion is 1 unit in length.
+ * Any existing W component will be ignored.
+ *
+ * @param out the receiving quaternion
+ * @param a quat to calculate W component of
+ * @returns out
+ */
+ export function calculateW(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+}
diff --git a/gl-matrix/gl-matrix-tests.ts b/gl-matrix/gl-matrix-tests.ts
index cec5812e7d..7e64e9c935 100644
--- a/gl-matrix/gl-matrix-tests.ts
+++ b/gl-matrix/gl-matrix-tests.ts
@@ -1,362 +1,347 @@
// common
-var result: number = glMatrix.toRadian(180);
+import {vec2, mat2, mat3, mat4, vec3, vec4, mat2d, quat} from "./gl-matrix";
-var out: GLM.IArray;
var outVal: number;
+var outBool: boolean;
var outStr: string;
-// vec2
-var vecA: GLM.IArray, vecB: GLM.IArray, matA: GLM.IArray;
-var vecArray: GLM.IArray;
-
-vecA = [1, 2];
-vecB = new Float32Array([3, 4]);
-out = [0, 0];
-matA = [1, 2, 3, 4, 5, 6];
-vecArray = [1, 2, 3, 4, 0, 0];
+let vecArray = new Float32Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]);
+
+let vec2A = vec2.fromValues(1, 2);
+let vec2B = vec2.fromValues(3, 4);
+let vec3A = vec3.fromValues(1, 2, 3);
+let vec3B = vec3.fromValues(3, 4, 5);
+let vec4A = vec4.fromValues(1, 2, 3, 4);
+let vec4B = vec4.fromValues(3, 4, 5, 6);
+let mat2A = mat2.fromValues(1, 2, 3, 4);
+let mat2B = mat2.fromValues(1, 2, 3, 4);
+let mat2dA = mat2d.fromValues(1, 2, 3, 4, 5, 6);
+let mat2dB = mat2d.fromValues(1, 2, 3, 4, 5, 6);
+let mat3A = mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
+let mat3B = mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
+let mat4A = mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
+let mat4B = mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
+let quatA = quat.fromValues(1, 2, 3, 4);
+let quatB = quat.fromValues(5, 6, 7, 8);
+
+let outVec2 = vec2.create();
+let outVec3 = vec3.create();
+let outVec4 = vec4.create();
+let outMat2 = mat2.create();
+let outMat2d = mat2d.create();
+let outMat3 = mat3.create();
+let outMat4 = mat4.create();
+let outQuat = quat.create();
-out = vec2.create();
-out = vec2.clone(vecA);
-out = vec2.fromValues(1, 2);
-out = vec2.copy(out, vecA);
-out = vec2.set(out, 1, 2);
-out = vec2.add(out, vecA, vecB);
-out = vec2.subtract(out, vecA, vecB);
-out = vec2.sub(out, vecA, vecB);
-out = vec2.multiply(out, vecA, vecB);
-out = vec2.mul(out, vecA, vecB);
-out = vec2.divide(out, vecA, vecB);
-out = vec2.div(out, vecA, vecB);
-out = vec2.min(out, vecA, vecB);
-out = vec2.max(out, vecA, vecB);
-out = vec2.scale(out, vecA, 2);
-out = vec2.scaleAndAdd(out, vecA, vecB, 0.5);
-outVal = vec2.distance(vecA, vecB);
-outVal = vec2.dist(vecA, vecB);
-outVal = vec2.squaredDistance(vecA, vecB);
-outVal = vec2.sqrDist(vecA, vecB);
-outVal = vec2.length(vecA);
-outVal = vec2.len(vecA);
-outVal = vec2.squaredLength(vecA);
-outVal = vec2.sqrLen(vecA);
-out = vec2.negate(out, vecA);
-out = vec2.inverse(out, vecA);
-out = vec2.normalize(out, vecA);
-outVal = vec2.dot(vecA, vecB);
-out = vec2.cross(out, vecA, vecB);
-out = vec2.lerp(out, vecA, vecB, 0.5);
-out = vec2.random(out);
-out = vec2.random(out, 5.0);
-out = vec2.transformMat2(out, vecA, matA);
-out = vec2.transformMat2d(out, vecA, matA);
-out = vec2.transformMat3(out, vecA, matA);
-out = vec2.transformMat4(out, vecA, matA);
-out = vec2.forEach(vecArray, 0, 0, 0, vec2.normalize);
-outStr = vec2.str(vecA);
+// vec2
+outVec2 = vec2.create();
+outVec2 = vec2.clone(vec2A);
+outVec2 = vec2.fromValues(1, 2);
+outVec2 = vec2.copy(outVec2, vec2A);
+outVec2 = vec2.set(outVec2, 1, 2);
+outVec2 = vec2.add(outVec2, vec2A, vec2B);
+outVec2 = vec2.subtract(outVec2, vec2A, vec2B);
+outVec2 = vec2.sub(outVec2, vec2A, vec2B);
+outVec2 = vec2.multiply(outVec2, vec2A, vec2B);
+outVec2 = vec2.mul(outVec2, vec2A, vec2B);
+outVec2 = vec2.divide(outVec2, vec2A, vec2B);
+outVec2 = vec2.div(outVec2, vec2A, vec2B);
+outVec2 = vec2.ceil(outVec2, vec2A);
+outVec2 = vec2.floor(outVec2, vec2A);
+outVec2 = vec2.min(outVec2, vec2A, vec2B);
+outVec2 = vec2.max(outVec2, vec2A, vec2B);
+outVec2 = vec2.round(outVec2, vec2A);
+outVec2 = vec2.scale(outVec2, vec2A, 2);
+outVec2 = vec2.scaleAndAdd(outVec2, vec2A, vec2B, 0.5);
+outVal = vec2.distance(vec2A, vec2B);
+outVal = vec2.dist(vec2A, vec2B);
+outVal = vec2.squaredDistance(vec2A, vec2B);
+outVal = vec2.sqrDist(vec2A, vec2B);
+outVal = vec2.length(vec2A);
+outVal = vec2.len(vec2A);
+outVal = vec2.squaredLength(vec2A);
+outVal = vec2.sqrLen(vec2A);
+outVec2 = vec2.negate(outVec2, vec2A);
+outVec2 = vec2.inverse(outVec2, vec2A);
+outVec2 = vec2.normalize(outVec2, vec2A);
+outVal = vec2.dot(vec2A, vec2B);
+outVec2 = vec2.cross(outVec2, vec2A, vec2B);
+outVec2 = vec2.lerp(outVec2, vec2A, vec2B, 0.5);
+outVec2 = vec2.random(outVec2);
+outVec2 = vec2.random(outVec2, 5.0);
+outVec2 = vec2.transformMat2(outVec2, vec2A, mat2A);
+outVec2 = vec2.transformMat2d(outVec2, vec2A, mat2dA);
+outVec2 = vec2.transformMat3(outVec2, vec2A, mat3A);
+outVec2 = vec2.transformMat4(outVec2, vec2A, mat4A);
+vecArray = vec2.forEach(vecArray, 0, 0, 0, vec2.normalize);
+outStr = vec2.str(vec2A);
+outBool = vec2.exactEquals(vec2A, vec2B);
+outBool = vec2.equals(vec2A, vec2B);
+outVec2 = vec2.add(outVec2, [0, 1], [2, 3]); // test one method with number array input
// vec3
-var matr: GLM.IArray;
-var q: GLM.IArray;
-
-vecA = [1, 2, 3];
-vecB = new Float32Array([4, 5, 6]);
-out = [0, 0, 0];
-vecArray = [1, 2, 3, 4, 5, 6, 0, 0, 0];
-matr = [1, 0, 0, 0, 1, 0, 0, 0, 1 ];
-
-out = vec3.create();
-out = vec3.clone(vecA);
-out = vec3.fromValues(1, 2, 3);
-out = vec3.copy(out, vecA);
-out = vec3.set(out, 1, 2, 3);
-out = vec3.add(out, vecA, vecB);
-out = vec3.subtract(out, vecA, vecB);
-out = vec3.sub(out, vecA, vecB);
-out = vec3.multiply(out, vecA, vecB);
-out = vec3.mul(out, vecA, vecB);
-out = vec3.divide(out, vecA, vecB);
-out = vec3.div(out, vecA, vecB);
-out = vec3.min(out, vecA, vecB);
-out = vec3.max(out, vecA, vecB);
-out = vec3.scale(out, vecA, 2);
-out = vec3.scaleAndAdd(out, vecA, vecB, 0.5);
-outVal = vec3.distance(vecA, vecB);
-outVal = vec3.dist(vecA, vecB);
-outVal = vec3.squaredDistance(vecA, vecB);
-outVal = vec3.sqrDist(vecA, vecB);
-outVal = vec3.length(vecA);
-outVal = vec3.len(vecA);
-outVal = vec3.squaredLength(vecA);
-outVal = vec3.sqrLen(vecA);
-out = vec3.negate(out, vecA);
-out = vec3.inverse(out, vecA);
-out = vec3.normalize(out, vecA);
-outVal = vec3.dot(vecA, vecB);
-out = vec3.cross(out, vecA, vecB);
-out = vec3.lerp(out, vecA, vecB, 0.5);
-out = vec3.random(out);
-out = vec3.random(out, 5.0);
-out = vec3.rotateX(out, vecA, vecB, Math.PI);
-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 ];
-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);
+outVec3 = vec3.create();
+outVec3 = vec3.clone(vec3A);
+outVec3 = vec3.fromValues(1, 2, 3);
+outVec3 = vec3.copy(outVec3, vec3A);
+outVec3 = vec3.set(outVec3, 1, 2, 3);
+outVec3 = vec3.add(outVec3, vec3A, vec3B);
+outVec3 = vec3.subtract(outVec3, vec3A, vec3B);
+outVec3 = vec3.sub(outVec3, vec3A, vec3B);
+outVec3 = vec3.multiply(outVec3, vec3A, vec3B);
+outVec3 = vec3.mul(outVec3, vec3A, vec3B);
+outVec3 = vec3.divide(outVec3, vec3A, vec3B);
+outVec3 = vec3.div(outVec3, vec3A, vec3B);
+outVec3 = vec3.ceil(outVec3, vec3A);
+outVec3 = vec3.floor(outVec3, vec3A);
+outVec3 = vec3.min(outVec3, vec3A, vec3B);
+outVec3 = vec3.max(outVec3, vec3A, vec3B);
+outVec3 = vec3.round(outVec3, vec3A);
+outVec3 = vec3.scale(outVec3, vec3A, 2);
+outVec3 = vec3.scaleAndAdd(outVec3, vec3A, vec3B, 0.5);
+outVal = vec3.distance(vec3A, vec3B);
+outVal = vec3.dist(vec3A, vec3B);
+outVal = vec3.squaredDistance(vec3A, vec3B);
+outVal = vec3.sqrDist(vec3A, vec3B);
+outVal = vec3.length(vec3A);
+outVal = vec3.len(vec3A);
+outVal = vec3.squaredLength(vec3A);
+outVal = vec3.sqrLen(vec3A);
+outVec3 = vec3.negate(outVec3, vec3A);
+outVec3 = vec3.inverse(outVec3, vec3A);
+outVec3 = vec3.normalize(outVec3, vec3A);
+outVal = vec3.dot(vec3A, vec3B);
+outVec3 = vec3.cross(outVec3, vec3A, vec3B);
+outVec3 = vec3.lerp(outVec3, vec3A, vec3B, 0.5);
+outVec3 = vec3.hermite(outVec3, vec3A, vec3B, vec3A, vec3B, 0.5);
+outVec3 = vec3.bezier(outVec3, vec3A, vec3B, vec3A, vec3B, 0.5);
+outVec3 = vec3.random(outVec3);
+outVec3 = vec3.random(outVec3, 5.0);
+outVec3 = vec3.transformMat3(outVec3, vec3A, mat3A);
+outVec3 = vec3.transformMat4(outVec3, vec3A, mat4A);
+outVec3 = vec3.transformQuat(outVec3, vec3A, quatA);
+outVec3 = vec3.rotateX(outVec3, vec3A, vec3B, Math.PI);
+outVec3 = vec3.rotateY(outVec3, vec3A, vec3B, Math.PI);
+outVec3 = vec3.rotateZ(outVec3, vec3A, vec3B, Math.PI);
+vecArray = vec3.forEach(vecArray, 0, 0, 0, vec3.normalize);
+outVal = vec3.angle(vec3A, vec3B);
+outStr = vec3.str(vec3A);
+outBool = vec3.exactEquals(vec3A, vec3B);
+outBool = vec3.equals(vec3A, vec3B);
+outVec3 = vec3.add(outVec3, [0, 1, 2], [3, 4, 5]); // test one method with number array input
// vec4
-var q: GLM.IArray;
-
-vecA = [1, 2, 3, 4];
-vecB = new Float32Array([5, 6, 7, 8]);
-out = [0, 0, 0, 0];
-q = [1, 2, 3, 4];
-
-out = vec4.create();
-out = vec4.clone(vecA);
-out = vec4.fromValues(1, 2, 3, 4);
-out = vec4.copy(out, vecA);
-out = vec4.set(out, 1, 2, 3, 4);
-out = vec4.add(out, vecA, vecB);
-out = vec4.subtract(out, vecA, vecB);
-out = vec4.sub(out, vecA, vecB);
-out = vec4.multiply(out, vecA, vecB);
-out = vec4.mul(out, vecA, vecB);
-out = vec4.divide(out, vecA, vecB);
-out = vec4.div(out, vecA, vecB);
-out = vec4.min(out, vecA, vecB);
-out = vec4.max(out, vecA, vecB);
-out = vec4.scale(out, vecA, 2);
-out = vec4.scaleAndAdd(out, vecA, vecB, 0.5);
-outVal = vec4.distance(vecA, vecB);
-outVal = vec4.dist(vecA, vecB);
-outVal = vec4.squaredDistance(vecA, vecB);
-outVal = vec4.sqrDist(vecA, vecB);
-outVal = vec4.length(vecA);
-outVal = vec4.len(vecA);
-outVal = vec4.squaredLength(vecA);
-outVal = vec4.sqrLen(vecA);
-out = vec4.negate(out, vecA);
-out = vec4.inverse(out, vecA);
-out = vec4.normalize(out, vecA);
-outVal = vec4.dot(vecA, vecB);
-out = vec4.lerp(out, vecA, vecB, 0.5);
-out = vec4.random(out);
-out = vec4.random(out, 5.0);
-
-matr = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]
-out = vec4.transformMat4(out, vecA, matr);
-out = vec4.transformQuat(out, vecA, q);
-
-vecArray = [1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0];
-out = vec4.forEach(vecArray, 0, 0, 0, vec4.normalize);
-outStr = vec4.str(vecA);
+outVec4 = vec4.create();
+outVec4 = vec4.clone(vec4A);
+outVec4 = vec4.fromValues(1, 2, 3, 4);
+outVec4 = vec4.copy(outVec4, vec4A);
+outVec4 = vec4.set(outVec4, 1, 2, 3, 4);
+outVec4 = vec4.add(outVec4, vec4A, vec4B);
+outVec4 = vec4.subtract(outVec4, vec4A, vec4B);
+outVec4 = vec4.sub(outVec4, vec4A, vec4B);
+outVec4 = vec4.multiply(outVec4, vec4A, vec4B);
+outVec4 = vec4.mul(outVec4, vec4A, vec4B);
+outVec4 = vec4.divide(outVec4, vec4A, vec4B);
+outVec4 = vec4.div(outVec4, vec4A, vec4B);
+outVec4 = vec4.ceil(outVec4, vec4A);
+outVec4 = vec4.floor(outVec4, vec4A);
+outVec4 = vec4.min(outVec4, vec4A, vec4B);
+outVec4 = vec4.max(outVec4, vec4A, vec4B);
+outVec4 = vec4.scale(outVec4, vec4A, 2);
+outVec4 = vec4.scaleAndAdd(outVec4, vec4A, vec4B, 0.5);
+outVal = vec4.distance(vec4A, vec4B);
+outVal = vec4.dist(vec4A, vec4B);
+outVal = vec4.squaredDistance(vec4A, vec4B);
+outVal = vec4.sqrDist(vec4A, vec4B);
+outVal = vec4.length(vec4A);
+outVal = vec4.len(vec4A);
+outVal = vec4.squaredLength(vec4A);
+outVal = vec4.sqrLen(vec4A);
+outVec4 = vec4.negate(outVec4, vec4A);
+outVec4 = vec4.inverse(outVec4, vec4A);
+outVec4 = vec4.normalize(outVec4, vec4A);
+outVal = vec4.dot(vec4A, vec4B);
+outVec4 = vec4.lerp(outVec4, vec4A, vec4B, 0.5);
+outVec4 = vec4.random(outVec4);
+outVec4 = vec4.random(outVec4, 5.0);
+outVec4 = vec4.transformMat4(outVec4, vec4A, mat4A);
+outVec4 = vec4.transformQuat(outVec4, vec4A, quatA);
+vecArray = vec4.forEach(vecArray, 0, 0, 0, vec4.normalize);
+outStr = vec4.str(vec4A);
+outBool = vec4.exactEquals(vec4A, vec4B);
+outBool = vec4.equals(vec4A, vec4B);
+outVec4 = vec4.add(outVec4, [0, 1, 2, 3], [4, 5, 6, 7]); // test one method with number array input
// mat2
-var matB: GLM.IArray, identity: GLM.IArray;
-
-matA = [1, 2, 3, 4];
-matB = new Float32Array([5, 6, 7, 8]);
-out = [0, 0, 0, 0];
-identity = [1, 0, 0, 1];
-
-out = mat2.create();
-out = mat2.clone(matA);
-out = mat2.copy(out, matA);
-out = mat2.identity(out);
-out = mat2.transpose(out, matA);
-out = mat2.invert(out, matA);
-out = mat2.adjoint(out, matA);
-outVal = mat2.determinant(matA);
-out = mat2.multiply(out, matA, matB);
-out = mat2.mul(out, matA, matB);
-out = mat2.rotate(out, matA, Math.PI * 0.5);
-
-vecA = [2, 3];
-out = mat2.scale(out, matA, vecA);
-outStr = mat2.str(matA);
-outVal = mat2.frob(matA);
-
+outMat2 = mat2.create();
+outMat2 = mat2.clone(mat2A);
+outMat2 = mat2.copy(outMat2, mat2A);
+outMat2 = mat2.identity(outMat2);
+outMat2 = mat2.fromValues(1, 2, 3, 4);
+outMat2 = mat2.set(outMat2, 1, 2, 3, 4);
+outMat2 = mat2.transpose(outMat2, mat2A);
+outMat2 = mat2.invert(outMat2, mat2A);
+outMat2 = mat2.adjoint(outMat2, mat2A);
+outVal = mat2.determinant(mat2A);
+outMat2 = mat2.multiply(outMat2, mat2A, mat2B);
+outMat2 = mat2.mul(outMat2, mat2A, mat2B);
+outMat2 = mat2.rotate(outMat2, mat2A, Math.PI * 0.5);
+outMat2 = mat2.scale(outMat2, mat2A, vec2A);
+outMat2 = mat2.fromRotation(outMat2, 0.5);
+outMat2 = mat2.fromScaling(outMat2, vec2A);
+outStr = mat2.str(mat2A);
+outVal = mat2.frob(mat2A);
var L = mat2.create();
var D = mat2.create();
var U = mat2.create();
-out = mat2.LDU(L, D, U, [4,3,6,3]);
+outMat2 = mat2.LDU(L, D, U, mat2A);
+outMat2 = mat2.add(outMat2, mat2A, mat2B);
+outMat2 = mat2.subtract(outMat2, mat2A, mat2B);
+outMat2 = mat2.sub(outMat2, mat2A, mat2B);
+outBool = mat2.exactEquals(mat2A, mat2B);
+outBool = mat2.equals(mat2A, mat2B);
+outMat2 = mat2.multiplyScalar (outMat2, mat2A, 2);
+outMat2 = mat2.multiplyScalarAndAdd (outMat2, mat2A, mat2B, 2);
// mat2d
-matA = [1, 2, 3, 4, 5, 6];
-matB = [7, 8, 9, 10, 11, 12];
-out = [0, 0, 0, 0, 0, 0];
-identity = [1, 0, 0, 1, 0, 0];
-
-out = mat2d.create();
-out = mat2d.clone(matA);
-out = mat2d.copy(out, matA);
-out = mat2d.identity(out);
-out = mat2d.invert(out, matA);
-outVal = mat2d.determinant(matA);
-out = mat2d.multiply(out, matA, matB);
-out = mat2d.mul(out, matA, matB);
-out = mat2d.rotate(out, matA, Math.PI * 0.5);
-
-vecA = [2, 3];
-out = mat2d.scale(out, matA, vecA);
-out = mat2d.translate(out, matA, vecA);
-outStr = mat2d.str(matA);
-outVal = mat2d.frob(matA);
+outMat2d = mat2d.create();
+outMat2d = mat2d.clone(mat2dA);
+outMat2d = mat2d.copy(outMat2d, mat2dA);
+outMat2d = mat2d.identity(outMat2d);
+outMat2d = mat2d.fromValues(1, 2, 3, 4, 5, 6);
+outMat2d = mat2d.set(outMat2d, 1, 2, 3, 4, 5, 6);
+outMat2d = mat2d.invert(outMat2d, mat2dA);
+outVal = mat2d.determinant(mat2dA);
+outMat2d = mat2d.multiply(outMat2d, mat2dA, mat2dB);
+outMat2d = mat2d.mul(outMat2d, mat2dA, mat2dB);
+outMat2d = mat2d.rotate(outMat2d, mat2dA, Math.PI * 0.5);
+outMat2d = mat2d.scale(outMat2d, mat2dA, vec2A);
+outMat2d = mat2d.translate(outMat2d, mat2dA, vec2A);
+outMat2d = mat2d.fromRotation(outMat2d, 0.5);
+outMat2d = mat2d.fromScaling(outMat2d, vec2A);
+outMat2d = mat2d.fromTranslation(outMat2d, vec2A);
+outStr = mat2d.str(mat2dA);
+outVal = mat2d.frob(mat2dA);
+outMat2d = mat2d.add(outMat2d, mat2dA, mat2dB);
+outMat2d = mat2d.subtract(outMat2d, mat2dA, mat2dB);
+outMat2d = mat2d.sub(outMat2d, mat2dA, mat2dB);
+outMat2d = mat2d.multiplyScalar (outMat2d, mat2dA, 2);
+outMat2d = mat2d.multiplyScalarAndAdd (outMat2d, mat2dA, mat2dB, 2);
+outBool = mat2d.exactEquals(mat2dA, mat2dB);
+outBool = mat2d.equals(mat2dA, mat2dB);
// mat3
-matA = [1, 0, 0, 0, 1, 0, 1, 2, 1];
-matB = [1, 0, 0, 0, 1, 0, 3, 4, 1];
-out = [0, 0, 0, 0, 0, 0, 0, 0, 0];
-identity = [1, 0, 0, 0, 1, 0, 0, 0, 1];
-
-out = mat3.create();
-out = mat3.clone(matA);
-out = mat3.copy(out, matA);
-out = mat3.identity(out);
-out = mat3.transpose(out, matA);
-out = mat3.invert(out, matA);
-out = mat3.adjoint(out, matA);
-outVal = mat3.determinant(matA);
-out = mat3.multiply(out, matA, matB);
-out = mat3.mul(out, matA, matB);
-outStr = mat3.str(matA);
-outVal = mat3.frob(matA);
-
-matA = [1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 0, 1];
-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,
- 0, 0, 1, 0,
- 1, 2, 3, 1];
-
-matB = [1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 4, 5, 6, 1];
-
-out = [0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0];
-
-identity = [1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 0, 1];
-
-out = mat4.create();
-out = mat4.clone(matA);
-out = mat4.copy(out, matA);
-out = mat4.identity(out);
-out = mat4.transpose(out, matA);
-out = mat4.invert(out, matA);
-out = mat4.adjoint(out, matA);
-outVal = mat4.determinant(matA);
-out = mat4.multiply(out, matA, matB);
-out = mat4.mul(out, matA, matB);
-out = mat4.translate(out, matA, [4, 5, 6]);
-out = mat4.scale(out, matA, [4, 5, 6]);
-
-var rad = Math.PI * 0.5;
-var axis = [1, 0, 0];
-out = mat4.rotate(out, matA, rad, axis);
-out = mat4.rotateX(out, matA, rad);
-out = mat4.rotateY(out, matA, rad);
-out = mat4.rotateZ(out, matA, rad);
-
-out = mat4.frustum(out, -1, 1, -1, 1, -1, 1);
-
-var fovy = Math.PI * 0.5;
-out = mat4.perspective(out, fovy, 1, 0, 1);
-out = mat4.ortho(out, -1, 1, -1, 1, -1, 1);
-
-var eye = [0, 0, 1];
-var center = [0, 0, -1];
-var up = [0, 1, 0];
-out = mat4.lookAt(out, eye, center, up);
-
-outStr = mat4.str(matA);
-outVal = mat4.frob(matA);
-
-q = [0, 0, 0, 1];
-out = mat4.fromRotationTranslation(out, q, [1, 2, 3]);
-out = mat4.fromQuat(out, q);
-
-q = [0, 0, 0, 1];
-out = mat4.fromRotationTranslationScale(out, q, [1, 2, 3], [1, 2, 3]);
-out = mat4.fromQuat(out, q);
+outMat3 = mat3.create();
+outMat3 = mat3.fromMat4(outMat3, mat4A);
+outMat3 = mat3.clone(mat3A);
+outMat3 = mat3.copy(outMat3, mat3A);
+outMat3 = mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
+outMat3 = mat3.set(outMat3, 1, 2, 3, 4, 5, 6, 7, 8, 9);
+outMat3 = mat3.identity(outMat3);
+outMat3 = mat3.transpose(outMat3, mat3A);
+outMat3 = mat3.invert(outMat3, mat3A);
+outMat3 = mat3.adjoint(outMat3, mat3A);
+outVal = mat3.determinant(mat3A);
+outMat3 = mat3.multiply(outMat3, mat3A, mat3B);
+outMat3 = mat3.mul(outMat3, mat3A, mat3B);
+outMat3 = mat3.translate(outMat3, mat3A, vec3A);
+outMat3 = mat3.rotate(outMat3, mat3A, Math.PI/2);
+outMat3 = mat3.scale(outMat3, mat3A, vec2A);
+outMat3 = mat3.fromTranslation(outMat3, vec2A);
+outMat3 = mat3.fromRotation(outMat3, Math.PI);
+outMat3 = mat3.fromScaling(outMat3, vec2A);
+outMat3 = mat3.fromMat2d(outMat3, mat2dA);
+outMat3 = mat3.fromQuat(outMat3, quatA);
+outMat3 = mat3.normalFromMat4(outMat3, mat4A);
+outStr = mat3.str(mat3A);
+outVal = mat3.frob(mat3A);
+outMat3 = mat3.add(outMat3, mat3A, mat3B);
+outMat3 = mat3.subtract(outMat3, mat3A, mat3B);
+outMat3 = mat3.sub(outMat3, mat3A, mat3B);
+outMat3 = mat3.multiplyScalar (outMat3, mat3A, 2);
+outMat3 = mat3.multiplyScalarAndAdd (outMat3, mat3A, mat3B, 2);
+outBool = mat3.exactEquals(mat3A, mat3B);
+outBool = mat3.equals(mat3A, mat3B);
+//mat4
+outMat4 = mat4.create();
+outMat4 = mat4.clone(mat4A);
+outMat4 = mat4.copy(outMat4, mat4A);
+outMat4 = mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
+outMat4 = mat4.set(outMat4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
+outMat4 = mat4.identity(outMat4);
+outMat4 = mat4.transpose(outMat4, mat4A);
+outMat4 = mat4.invert(outMat4, mat4A);
+outMat4 = mat4.adjoint(outMat4, mat4A);
+outVal = mat4.determinant(mat4A);
+outMat4 = mat4.multiply(outMat4, mat4A, mat4B);
+outMat4 = mat4.mul(outMat4, mat4A, mat4B);
+outMat4 = mat4.translate(outMat4, mat4A, vec3A);
+outMat4 = mat4.scale(outMat4, mat4A, vec3A);
+outMat4 = mat4.rotate(outMat4, mat4A, Math.PI, vec3A);
+outMat4 = mat4.rotateX(outMat4, mat4A, Math.PI);
+outMat4 = mat4.rotateY(outMat4, mat4A, Math.PI);
+outMat4 = mat4.rotateZ(outMat4, mat4A, Math.PI);
+outMat4 = mat4.fromTranslation(outMat4, vec3A);
+outMat4 = mat4.fromRotation(outMat4, Math.PI, vec3A);
+outMat4 = mat4.fromScaling(outMat4, vec3A);
+outMat4 = mat4.fromXRotation(outMat4, Math.PI);
+outMat4 = mat4.fromYRotation(outMat4, Math.PI);
+outMat4 = mat4.fromZRotation(outMat4, Math.PI);
+outMat4 = mat4.fromRotationTranslation(outMat4, quatA, vec3A);
+outVec3 = mat4.getTranslation(outVec3, mat4A)
+outQuat = mat4.getRotation(outQuat, mat4A)
+outMat4 = mat4.fromRotationTranslationScale(outMat4, quatA, vec3A, vec3B);
+outMat4 = mat4.fromRotationTranslationScaleOrigin(outMat4, quatA, vec3A, vec3B, vec3A);
+outMat4 = mat4.fromQuat(outMat4, quatB);
+outMat4 = mat4.frustum(outMat4, -1, 1, -1, 1, -1, 1);
+outMat4 = mat4.perspective(outMat4, Math.PI, 1, 0, 1);
+outMat4 = mat4.perspectiveFromFieldOfView(outMat4, {upDegrees:Math.PI, downDegrees:-Math.PI, leftDegrees:-Math.PI, rightDegrees:Math.PI}, 1, 0);
+outMat4 = mat4.ortho(outMat4, -1, 1, -1, 1, -1, 1);
+outMat4 = mat4.lookAt(outMat4, vec3A, vec3B, vec3A);
+outStr = mat4.str(mat4A);
+outVal = mat4.frob(mat4A);
+outMat4 = mat4.add(outMat4, mat4A, mat4B);
+outMat4 = mat4.subtract(outMat4, mat4A, mat4B);
+outMat4 = mat4.sub(outMat4, mat4A, mat4B);
+outMat4 = mat4.multiplyScalar (outMat4, mat4A, 2);
+outMat4 = mat4.multiplyScalarAndAdd (outMat4, mat4A, mat4B, 2);
+outBool = mat4.exactEquals(mat4A, mat4B);
+outBool = mat4.equals(mat4A, mat4B);
// quat
-var quatA = [1, 2, 3, 4];
-var quatB = [5, 6, 7, 8];
-out = [0, 0, 0, 0];
-var vec = [1, 1, -1];
-var id = [0, 0, 0, 1];
var deg90 = Math.PI / 2;
-
-out = quat.create();
-out = quat.clone(quatA);
-out = quat.fromValues(1, 2, 3, 4);
-out = quat.copy(out, quatA);
-out = quat.set(out, 1, 2, 3, 4);
-out = quat.identity(out);
-out = quat.setAxisAngle(out, [1, 0, 0], Math.PI * 0.5);
-out = quat.add(out, quatA, quatB);
-out = quat.multiply(out, quatA, quatB);
-out = quat.mul(out, quatA, quatB);
-out = quat.scale(out, quatA, 2);
+outQuat = quat.create();
+outQuat = quat.clone(quatA);
+outQuat = quat.fromValues(1, 2, 3, 4);
+outQuat = quat.copy(outQuat, quatA);
+outQuat = quat.set(outQuat, 1, 2, 3, 4);
+outQuat = quat.identity(outQuat);
+outQuat = quat.rotationTo(outQuat, vec3A, vec3B);
+outQuat = quat.setAxes(outQuat, vec3A, vec3B, vec3A);
+outQuat = quat.setAxisAngle(outQuat, vec3A, Math.PI * 0.5);
+outVal = quat.getAxisAngle (outVec3, quatA);
+outQuat = quat.add(outQuat, quatA, quatB);
+outQuat = quat.multiply(outQuat, quatA, quatB);
+outQuat = quat.mul(outQuat, quatA, quatB);
+outQuat = quat.scale(outQuat, quatA, 2);
outVal = quat.length(quatA);
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);
-out = quat.conjugate(out, quatA);
+outQuat = quat.normalize(outQuat, quatA);
+outVal = quat.dot(quatA, quatB);
+outQuat = quat.lerp(outQuat, quatA, quatB, 0.5);
+outQuat = quat.slerp(outQuat, quatA, quatB, 0.5);
+outQuat = quat.invert(outQuat, quatA);
+outQuat = quat.conjugate(outQuat, quatA);
outStr = quat.str(quatA);
-out = quat.rotateX(out, id, deg90);
-out = quat.rotateY(out, id, deg90);
-out = quat.rotateZ(out, id, deg90);
-
-matr = [ 1, 0, 0,
- 0, 0, -1,
- 0, 1, 0 ];
-out = quat.fromMat3(out, matr);
-
-var view = [-1, 0, 0];
-up = [ 0, 1, 0];
-var right= [ 0, 0,-1];
-out = quat.setAxes([], view, right, up);
-
-out = quat.rotationTo(out, [0, 1, 0], [1, 0, 0]);
-out = quat.calculateW(out, quatA);
-
+outQuat = quat.rotateX(outQuat, quatA, deg90);
+outQuat = quat.rotateY(outQuat, quatA, deg90);
+outQuat = quat.rotateZ(outQuat, quatA, deg90);
+outQuat = quat.fromMat3(outQuat, mat3A);
+outQuat = quat.calculateW(outQuat, quatA);
+outBool = quat.exactEquals(quatA, quatB);
+outBool = quat.equals(quatA, quatB);
diff --git a/gl-matrix/gl-matrix-typed-tests.ts b/gl-matrix/gl-matrix-typed-tests.ts
deleted file mode 100644
index 7364ec0a83..0000000000
--- a/gl-matrix/gl-matrix-typed-tests.ts
+++ /dev/null
@@ -1,346 +0,0 @@
-///
-
-// common
-import {vec2, mat2, mat3, mat4, vec3, vec4, glMatrix, mat2d, quat} from "./gl-matrix-typed";
-var result: number = glMatrix.toRadian(180);
-
-var outVal: number;
-var outBool: boolean;
-var outStr: string;
-
-let vecArray = new Float32Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]);
-
-let vec2A = vec2.fromValues(1, 2);
-let vec2B = vec2.fromValues(3, 4);
-let vec3A = vec3.fromValues(1, 2, 3);
-let vec3B = vec3.fromValues(3, 4, 5);
-let vec4A = vec4.fromValues(1, 2, 3, 4);
-let vec4B = vec4.fromValues(3, 4, 5, 6);
-let mat2A = mat2.fromValues(1, 2, 3, 4);
-let mat2B = mat2.fromValues(1, 2, 3, 4);
-let mat2dA = mat2d.fromValues(1, 2, 3, 4, 5, 6);
-let mat2dB = mat2d.fromValues(1, 2, 3, 4, 5, 6);
-let mat3A = mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
-let mat3B = mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
-let mat4A = mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
-let mat4B = mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
-let quatA = quat.fromValues(1, 2, 3, 4);
-let quatB = quat.fromValues(5, 6, 7, 8);
-
-let outVec2 = vec2.create();
-let outVec3 = vec3.create();
-let outVec4 = vec4.create();
-let outMat2 = mat2.create();
-let outMat2d = mat2d.create();
-let outMat3 = mat3.create();
-let outMat4 = mat4.create();
-let outQuat = quat.create();
-
-// vec2
-outVec2 = vec2.create();
-outVec2 = vec2.clone(vec2A);
-outVec2 = vec2.fromValues(1, 2);
-outVec2 = vec2.copy(outVec2, vec2A);
-outVec2 = vec2.set(outVec2, 1, 2);
-outVec2 = vec2.add(outVec2, vec2A, vec2B);
-outVec2 = vec2.subtract(outVec2, vec2A, vec2B);
-outVec2 = vec2.sub(outVec2, vec2A, vec2B);
-outVec2 = vec2.multiply(outVec2, vec2A, vec2B);
-outVec2 = vec2.mul(outVec2, vec2A, vec2B);
-outVec2 = vec2.divide(outVec2, vec2A, vec2B);
-outVec2 = vec2.div(outVec2, vec2A, vec2B);
-outVec2 = vec2.ceil(outVec2, vec2A);
-outVec2 = vec2.floor(outVec2, vec2A);
-outVec2 = vec2.min(outVec2, vec2A, vec2B);
-outVec2 = vec2.max(outVec2, vec2A, vec2B);
-outVec2 = vec2.round(outVec2, vec2A);
-outVec2 = vec2.scale(outVec2, vec2A, 2);
-outVec2 = vec2.scaleAndAdd(outVec2, vec2A, vec2B, 0.5);
-outVal = vec2.distance(vec2A, vec2B);
-outVal = vec2.dist(vec2A, vec2B);
-outVal = vec2.squaredDistance(vec2A, vec2B);
-outVal = vec2.sqrDist(vec2A, vec2B);
-outVal = vec2.length(vec2A);
-outVal = vec2.len(vec2A);
-outVal = vec2.squaredLength(vec2A);
-outVal = vec2.sqrLen(vec2A);
-outVec2 = vec2.negate(outVec2, vec2A);
-outVec2 = vec2.inverse(outVec2, vec2A);
-outVec2 = vec2.normalize(outVec2, vec2A);
-outVal = vec2.dot(vec2A, vec2B);
-outVec2 = vec2.cross(outVec2, vec2A, vec2B);
-outVec2 = vec2.lerp(outVec2, vec2A, vec2B, 0.5);
-outVec2 = vec2.random(outVec2);
-outVec2 = vec2.random(outVec2, 5.0);
-outVec2 = vec2.transformMat2(outVec2, vec2A, mat2A);
-outVec2 = vec2.transformMat2d(outVec2, vec2A, mat2dA);
-outVec2 = vec2.transformMat3(outVec2, vec2A, mat3A);
-outVec2 = vec2.transformMat4(outVec2, vec2A, mat4A);
-vecArray = vec2.forEach(vecArray, 0, 0, 0, vec2.normalize);
-outStr = vec2.str(vec2A);
-outBool = vec2.exactEquals(vec2A, vec2B);
-outBool = vec2.equals(vec2A, vec2B);
-
-// vec3
-outVec3 = vec3.create();
-outVec3 = vec3.clone(vec3A);
-outVec3 = vec3.fromValues(1, 2, 3);
-outVec3 = vec3.copy(outVec3, vec3A);
-outVec3 = vec3.set(outVec3, 1, 2, 3);
-outVec3 = vec3.add(outVec3, vec3A, vec3B);
-outVec3 = vec3.subtract(outVec3, vec3A, vec3B);
-outVec3 = vec3.sub(outVec3, vec3A, vec3B);
-outVec3 = vec3.multiply(outVec3, vec3A, vec3B);
-outVec3 = vec3.mul(outVec3, vec3A, vec3B);
-outVec3 = vec3.divide(outVec3, vec3A, vec3B);
-outVec3 = vec3.div(outVec3, vec3A, vec3B);
-outVec3 = vec3.ceil(outVec3, vec3A);
-outVec3 = vec3.floor(outVec3, vec3A);
-outVec3 = vec3.min(outVec3, vec3A, vec3B);
-outVec3 = vec3.max(outVec3, vec3A, vec3B);
-outVec3 = vec3.round(outVec3, vec3A);
-outVec3 = vec3.scale(outVec3, vec3A, 2);
-outVec3 = vec3.scaleAndAdd(outVec3, vec3A, vec3B, 0.5);
-outVal = vec3.distance(vec3A, vec3B);
-outVal = vec3.dist(vec3A, vec3B);
-outVal = vec3.squaredDistance(vec3A, vec3B);
-outVal = vec3.sqrDist(vec3A, vec3B);
-outVal = vec3.length(vec3A);
-outVal = vec3.len(vec3A);
-outVal = vec3.squaredLength(vec3A);
-outVal = vec3.sqrLen(vec3A);
-outVec3 = vec3.negate(outVec3, vec3A);
-outVec3 = vec3.inverse(outVec3, vec3A);
-outVec3 = vec3.normalize(outVec3, vec3A);
-outVal = vec3.dot(vec3A, vec3B);
-outVec3 = vec3.cross(outVec3, vec3A, vec3B);
-outVec3 = vec3.lerp(outVec3, vec3A, vec3B, 0.5);
-outVec3 = vec3.hermite(outVec3, vec3A, vec3B, vec3A, vec3B, 0.5);
-outVec3 = vec3.bezier(outVec3, vec3A, vec3B, vec3A, vec3B, 0.5);
-outVec3 = vec3.random(outVec3);
-outVec3 = vec3.random(outVec3, 5.0);
-outVec3 = vec3.transformMat3(outVec3, vec3A, mat3A);
-outVec3 = vec3.transformMat4(outVec3, vec3A, mat4A);
-outVec3 = vec3.transformQuat(outVec3, vec3A, quatA);
-outVec3 = vec3.rotateX(outVec3, vec3A, vec3B, Math.PI);
-outVec3 = vec3.rotateY(outVec3, vec3A, vec3B, Math.PI);
-outVec3 = vec3.rotateZ(outVec3, vec3A, vec3B, Math.PI);
-vecArray = vec3.forEach(vecArray, 0, 0, 0, vec3.normalize);
-outVal = vec3.angle(vec3A, vec3B);
-outStr = vec3.str(vec3A);
-outBool = vec3.exactEquals(vec3A, vec3B);
-outBool = vec3.equals(vec3A, vec3B);
-
-// vec4
-outVec4 = vec4.create();
-outVec4 = vec4.clone(vec4A);
-outVec4 = vec4.fromValues(1, 2, 3, 4);
-outVec4 = vec4.copy(outVec4, vec4A);
-outVec4 = vec4.set(outVec4, 1, 2, 3, 4);
-outVec4 = vec4.add(outVec4, vec4A, vec4B);
-outVec4 = vec4.subtract(outVec4, vec4A, vec4B);
-outVec4 = vec4.sub(outVec4, vec4A, vec4B);
-outVec4 = vec4.multiply(outVec4, vec4A, vec4B);
-outVec4 = vec4.mul(outVec4, vec4A, vec4B);
-outVec4 = vec4.divide(outVec4, vec4A, vec4B);
-outVec4 = vec4.div(outVec4, vec4A, vec4B);
-outVec4 = vec4.ceil(outVec4, vec4A);
-outVec4 = vec4.floor(outVec4, vec4A);
-outVec4 = vec4.min(outVec4, vec4A, vec4B);
-outVec4 = vec4.max(outVec4, vec4A, vec4B);
-outVec4 = vec4.scale(outVec4, vec4A, 2);
-outVec4 = vec4.scaleAndAdd(outVec4, vec4A, vec4B, 0.5);
-outVal = vec4.distance(vec4A, vec4B);
-outVal = vec4.dist(vec4A, vec4B);
-outVal = vec4.squaredDistance(vec4A, vec4B);
-outVal = vec4.sqrDist(vec4A, vec4B);
-outVal = vec4.length(vec4A);
-outVal = vec4.len(vec4A);
-outVal = vec4.squaredLength(vec4A);
-outVal = vec4.sqrLen(vec4A);
-outVec4 = vec4.negate(outVec4, vec4A);
-outVec4 = vec4.inverse(outVec4, vec4A);
-outVec4 = vec4.normalize(outVec4, vec4A);
-outVal = vec4.dot(vec4A, vec4B);
-outVec4 = vec4.lerp(outVec4, vec4A, vec4B, 0.5);
-outVec4 = vec4.random(outVec4);
-outVec4 = vec4.random(outVec4, 5.0);
-outVec4 = vec4.transformMat4(outVec4, vec4A, mat4A);
-outVec4 = vec4.transformQuat(outVec4, vec4A, quatA);
-vecArray = vec4.forEach(vecArray, 0, 0, 0, vec4.normalize);
-outStr = vec4.str(vec4A);
-outBool = vec4.exactEquals(vec4A, vec4B);
-outBool = vec4.equals(vec4A, vec4B);
-
-// mat2
-outMat2 = mat2.create();
-outMat2 = mat2.clone(mat2A);
-outMat2 = mat2.copy(outMat2, mat2A);
-outMat2 = mat2.identity(outMat2);
-outMat2 = mat2.fromValues(1, 2, 3, 4);
-outMat2 = mat2.set(outMat2, 1, 2, 3, 4);
-outMat2 = mat2.transpose(outMat2, mat2A);
-outMat2 = mat2.invert(outMat2, mat2A);
-outMat2 = mat2.adjoint(outMat2, mat2A);
-outVal = mat2.determinant(mat2A);
-outMat2 = mat2.multiply(outMat2, mat2A, mat2B);
-outMat2 = mat2.mul(outMat2, mat2A, mat2B);
-outMat2 = mat2.rotate(outMat2, mat2A, Math.PI * 0.5);
-outMat2 = mat2.scale(outMat2, mat2A, vec2A);
-outMat2 = mat2.fromRotation(outMat2, 0.5);
-outMat2 = mat2.fromScaling(outMat2, vec2A);
-outStr = mat2.str(mat2A);
-outVal = mat2.frob(mat2A);
-var L = mat2.create();
-var D = mat2.create();
-var U = mat2.create();
-outMat2 = mat2.LDU(L, D, U, mat2A);
-outMat2 = mat2.add(outMat2, mat2A, mat2B);
-outMat2 = mat2.subtract(outMat2, mat2A, mat2B);
-outMat2 = mat2.sub(outMat2, mat2A, mat2B);
-outBool = mat2.exactEquals(mat2A, mat2B);
-outBool = mat2.equals(mat2A, mat2B);
-outMat2 = mat2.multiplyScalar (outMat2, mat2A, 2);
-outMat2 = mat2.multiplyScalarAndAdd (outMat2, mat2A, mat2B, 2);
-
-// mat2d
-outMat2d = mat2d.create();
-outMat2d = mat2d.clone(mat2dA);
-outMat2d = mat2d.copy(outMat2d, mat2dA);
-outMat2d = mat2d.identity(outMat2d);
-outMat2d = mat2d.fromValues(1, 2, 3, 4, 5, 6);
-outMat2d = mat2d.set(outMat2d, 1, 2, 3, 4, 5, 6);
-outMat2d = mat2d.invert(outMat2d, mat2dA);
-outVal = mat2d.determinant(mat2dA);
-outMat2d = mat2d.multiply(outMat2d, mat2dA, mat2dB);
-outMat2d = mat2d.mul(outMat2d, mat2dA, mat2dB);
-outMat2d = mat2d.rotate(outMat2d, mat2dA, Math.PI * 0.5);
-outMat2d = mat2d.scale(outMat2d, mat2dA, vec2A);
-outMat2d = mat2d.translate(outMat2d, mat2dA, vec2A);
-outMat2d = mat2d.fromRotation(outMat2d, 0.5);
-outMat2d = mat2d.fromScaling(outMat2d, vec2A);
-outMat2d = mat2d.fromTranslation(outMat2d, vec2A);
-outStr = mat2d.str(mat2dA);
-outVal = mat2d.frob(mat2dA);
-outMat2d = mat2d.add(outMat2d, mat2dA, mat2dB);
-outMat2d = mat2d.subtract(outMat2d, mat2dA, mat2dB);
-outMat2d = mat2d.sub(outMat2d, mat2dA, mat2dB);
-outMat2d = mat2d.multiplyScalar (outMat2d, mat2dA, 2);
-outMat2d = mat2d.multiplyScalarAndAdd (outMat2d, mat2dA, mat2dB, 2);
-outBool = mat2d.exactEquals(mat2dA, mat2dB);
-outBool = mat2d.equals(mat2dA, mat2dB);
-
-
-// mat3
-outMat3 = mat3.create();
-outMat3 = mat3.fromMat4(outMat3, mat4A);
-outMat3 = mat3.clone(mat3A);
-outMat3 = mat3.copy(outMat3, mat3A);
-outMat3 = mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
-outMat3 = mat3.set(outMat3, 1, 2, 3, 4, 5, 6, 7, 8, 9);
-outMat3 = mat3.identity(outMat3);
-outMat3 = mat3.transpose(outMat3, mat3A);
-outMat3 = mat3.invert(outMat3, mat3A);
-outMat3 = mat3.adjoint(outMat3, mat3A);
-outVal = mat3.determinant(mat3A);
-outMat3 = mat3.multiply(outMat3, mat3A, mat3B);
-outMat3 = mat3.mul(outMat3, mat3A, mat3B);
-outMat3 = mat3.translate(outMat3, mat3A, vec3A);
-outMat3 = mat3.rotate(outMat3, mat3A, Math.PI/2);
-outMat3 = mat3.scale(outMat3, mat3A, vec2A);
-outMat3 = mat3.fromTranslation(outMat3, vec2A);
-outMat3 = mat3.fromRotation(outMat3, Math.PI);
-outMat3 = mat3.fromScaling(outMat3, vec2A);
-outMat3 = mat3.fromMat2d(outMat3, mat2dA);
-outMat3 = mat3.fromQuat(outMat3, quatA);
-outMat3 = mat3.normalFromMat4(outMat3, mat4A);
-outStr = mat3.str(mat3A);
-outVal = mat3.frob(mat3A);
-outMat3 = mat3.add(outMat3, mat3A, mat3B);
-outMat3 = mat3.subtract(outMat3, mat3A, mat3B);
-outMat3 = mat3.sub(outMat3, mat3A, mat3B);
-outMat3 = mat3.multiplyScalar (outMat3, mat3A, 2);
-outMat3 = mat3.multiplyScalarAndAdd (outMat3, mat3A, mat3B, 2);
-outBool = mat3.exactEquals(mat3A, mat3B);
-outBool = mat3.equals(mat3A, mat3B);
-
-//mat4
-outMat4 = mat4.create();
-outMat4 = mat4.clone(mat4A);
-outMat4 = mat4.copy(outMat4, mat4A);
-outMat4 = mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
-outMat4 = mat4.set(outMat4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
-outMat4 = mat4.identity(outMat4);
-outMat4 = mat4.transpose(outMat4, mat4A);
-outMat4 = mat4.invert(outMat4, mat4A);
-outMat4 = mat4.adjoint(outMat4, mat4A);
-outVal = mat4.determinant(mat4A);
-outMat4 = mat4.multiply(outMat4, mat4A, mat4B);
-outMat4 = mat4.mul(outMat4, mat4A, mat4B);
-outMat4 = mat4.translate(outMat4, mat4A, vec3A);
-outMat4 = mat4.scale(outMat4, mat4A, vec3A);
-outMat4 = mat4.rotate(outMat4, mat4A, Math.PI, vec3A);
-outMat4 = mat4.rotateX(outMat4, mat4A, Math.PI);
-outMat4 = mat4.rotateY(outMat4, mat4A, Math.PI);
-outMat4 = mat4.rotateZ(outMat4, mat4A, Math.PI);
-outMat4 = mat4.fromTranslation(outMat4, vec3A);
-outMat4 = mat4.fromRotation(outMat4, Math.PI, vec3A);
-outMat4 = mat4.fromScaling(outMat4, vec3A);
-outMat4 = mat4.fromXRotation(outMat4, Math.PI);
-outMat4 = mat4.fromYRotation(outMat4, Math.PI);
-outMat4 = mat4.fromZRotation(outMat4, Math.PI);
-outMat4 = mat4.fromRotationTranslation(outMat4, quatA, vec3A);
-outVec3 = mat4.getTranslation(outVec3, mat4A)
-outQuat = mat4.getRotation(outQuat, mat4A)
-outMat4 = mat4.fromRotationTranslationScale(outMat4, quatA, vec3A, vec3B);
-outMat4 = mat4.fromRotationTranslationScaleOrigin(outMat4, quatA, vec3A, vec3B, vec3A);
-outMat4 = mat4.fromQuat(outMat4, quatB);
-outMat4 = mat4.frustum(outMat4, -1, 1, -1, 1, -1, 1);
-outMat4 = mat4.perspective(outMat4, Math.PI, 1, 0, 1);
-outMat4 = mat4.perspectiveFromFieldOfView(outMat4, {upDegrees:Math.PI, downDegrees:-Math.PI, leftDegrees:-Math.PI, rightDegrees:Math.PI}, 1, 0);
-outMat4 = mat4.ortho(outMat4, -1, 1, -1, 1, -1, 1);
-outMat4 = mat4.lookAt(outMat4, vec3A, vec3B, vec3A);
-outStr = mat4.str(mat4A);
-outVal = mat4.frob(mat4A);
-outMat4 = mat4.add(outMat4, mat4A, mat4B);
-outMat4 = mat4.subtract(outMat4, mat4A, mat4B);
-outMat4 = mat4.sub(outMat4, mat4A, mat4B);
-outMat4 = mat4.multiplyScalar (outMat4, mat4A, 2);
-outMat4 = mat4.multiplyScalarAndAdd (outMat4, mat4A, mat4B, 2);
-outBool = mat4.exactEquals(mat4A, mat4B);
-outBool = mat4.equals(mat4A, mat4B);
-
-// quat
-var deg90 = Math.PI / 2;
-outQuat = quat.create();
-outQuat = quat.clone(quatA);
-outQuat = quat.fromValues(1, 2, 3, 4);
-outQuat = quat.copy(outQuat, quatA);
-outQuat = quat.set(outQuat, 1, 2, 3, 4);
-outQuat = quat.identity(outQuat);
-outQuat = quat.rotationTo(outQuat, vec3A, vec3B);
-outQuat = quat.setAxes(outQuat, vec3A, vec3B, vec3A);
-outQuat = quat.setAxisAngle(outQuat, vec3A, Math.PI * 0.5);
-outVal = quat.getAxisAngle (outVec3, quatA);
-outQuat = quat.add(outQuat, quatA, quatB);
-outQuat = quat.multiply(outQuat, quatA, quatB);
-outQuat = quat.mul(outQuat, quatA, quatB);
-outQuat = quat.scale(outQuat, quatA, 2);
-outVal = quat.length(quatA);
-outVal = quat.len(quatA);
-outVal = quat.squaredLength(quatA);
-outVal = quat.sqrLen(quatA);
-outQuat = quat.normalize(outQuat, quatA);
-outVal = quat.dot(quatA, quatB);
-outQuat = quat.lerp(outQuat, quatA, quatB, 0.5);
-outQuat = quat.slerp(outQuat, quatA, quatB, 0.5);
-outQuat = quat.invert(outQuat, quatA);
-outQuat = quat.conjugate(outQuat, quatA);
-outStr = quat.str(quatA);
-outQuat = quat.rotateX(outQuat, quatA, deg90);
-outQuat = quat.rotateY(outQuat, quatA, deg90);
-outQuat = quat.rotateZ(outQuat, quatA, deg90);
-outQuat = quat.fromMat3(outQuat, mat3A);
-outQuat = quat.calculateW(outQuat, quatA);
-outBool = quat.exactEquals(quatA, quatB);
-outBool = quat.equals(quatA, quatB);
\ No newline at end of file
diff --git a/gl-matrix/gl-matrix-typed.d.ts b/gl-matrix/gl-matrix-typed.d.ts
deleted file mode 100644
index e172074fec..0000000000
--- a/gl-matrix/gl-matrix-typed.d.ts
+++ /dev/null
@@ -1,3054 +0,0 @@
-// Type definitions for gl-matrix 2.2.2
-// Project: https://github.com/toji/gl-matrix
-// Definitions by: Mattijs Kneppers , based on definitions by Tat
-// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-
-// Common
-export class glMatrix {
- /**
- * Convert Degree To Radian
- *
- * @param a Angle in Degrees
- */
- public static toRadian(a: number): number;
-}
-
-// vec2
-export class vec2 extends Float32Array {
- private typeVec2:number;
-
- /**
- * Creates a new, empty vec2
- *
- * @returns a new 2D vector
- */
- public static create(): vec2;
-
- /**
- * Creates a new vec2 initialized with values from an existing vector
- *
- * @param a a vector to clone
- * @returns a new 2D vector
- */
- public static clone(a: vec2): vec2;
-
- /**
- * Creates a new vec2 initialized with the given values
- *
- * @param x X component
- * @param y Y component
- * @returns a new 2D vector
- */
- public static fromValues(x: number, y: number): vec2;
-
- /**
- * Copy the values from one vec2 to another
- *
- * @param out the receiving vector
- * @param a the source vector
- * @returns out
- */
- public static copy(out: vec2, a: vec2): vec2;
-
- /**
- * Set the components of a vec2 to the given values
- *
- * @param out the receiving vector
- * @param x X component
- * @param y Y component
- * @returns out
- */
- public static set(out: vec2, x: number, y: number): vec2;
-
- /**
- * Adds two vec2's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static add(out: vec2, a: vec2, b: vec2): vec2;
-
- /**
- * Subtracts vector b from vector a
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static subtract(out: vec2, a: vec2, b: vec2): vec2;
-
- /**
- * Subtracts vector b from vector a
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static sub(out: vec2, a: vec2, b: vec2): vec2;
-
- /**
- * Multiplies two vec2's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static multiply(out: vec2, a: vec2, b: vec2): vec2;
-
- /**
- * Multiplies two vec2's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static mul(out: vec2, a: vec2, b: vec2): vec2;
-
- /**
- * Divides two vec2's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static divide(out: vec2, a: vec2, b: vec2): vec2;
-
- /**
- * Divides two vec2's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static div(out: vec2, a: vec2, b: vec2): vec2;
-
- /**
- * Math.ceil the components of a vec2
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a vector to ceil
- * @returns {vec2} out
- */
- public static ceil(out:vec2, a:vec2):vec2;
-
- /**
- * Math.floor the components of a vec2
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a vector to floor
- * @returns {vec2} out
- */
- public static floor (out:vec2, a:vec2):vec2;
-
- /**
- * Returns the minimum of two vec2's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static min(out: vec2, a: vec2, b: vec2): vec2;
-
- /**
- * Returns the maximum of two vec2's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static max(out: vec2, a: vec2, b: vec2): vec2;
-
- /**
- * Math.round the components of a vec2
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a vector to round
- * @returns {vec2} out
- */
- public static round(out:vec2, a:vec2):vec2;
-
-
- /**
- * Scales a vec2 by a scalar number
- *
- * @param out the receiving vector
- * @param a the vector to scale
- * @param b amount to scale the vector by
- * @returns out
- */
- public static scale(out: vec2, a: vec2, b: number): vec2;
-
- /**
- * Adds two vec2's after scaling the second operand by a scalar value
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @param scale the amount to scale b by before adding
- * @returns out
- */
- public static scaleAndAdd(out: vec2, a: vec2, b: vec2, scale: number): vec2;
-
- /**
- * Calculates the euclidian distance between two vec2's
- *
- * @param a the first operand
- * @param b the second operand
- * @returns distance between a and b
- */
- public static distance(a: vec2, b: vec2): number;
-
- /**
- * Calculates the euclidian distance between two vec2's
- *
- * @param a the first operand
- * @param b the second operand
- * @returns distance between a and b
- */
- public static dist(a: vec2, b: vec2): number;
-
- /**
- * Calculates the squared euclidian distance between two vec2's
- *
- * @param a the first operand
- * @param b the second operand
- * @returns squared distance between a and b
- */
- public static squaredDistance(a: vec2, b: vec2): number;
-
- /**
- * Calculates the squared euclidian distance between two vec2's
- *
- * @param a the first operand
- * @param b the second operand
- * @returns squared distance between a and b
- */
- public static sqrDist(a: vec2, b: vec2): number;
-
- /**
- * Calculates the length of a vec2
- *
- * @param a vector to calculate length of
- * @returns length of a
- */
- public static length(a: vec2): number;
-
- /**
- * Calculates the length of a vec2
- *
- * @param a vector to calculate length of
- * @returns length of a
- */
- public static len(a: vec2): number;
-
- /**
- * Calculates the squared length of a vec2
- *
- * @param a vector to calculate squared length of
- * @returns squared length of a
- */
- public static squaredLength(a: vec2): number;
-
- /**
- * Calculates the squared length of a vec2
- *
- * @param a vector to calculate squared length of
- * @returns squared length of a
- */
- public static sqrLen(a: vec2): number;
-
- /**
- * Negates the components of a vec2
- *
- * @param out the receiving vector
- * @param a vector to negate
- * @returns out
- */
- public static negate(out: vec2, a: vec2): vec2;
-
- /**
- * Returns the inverse of the components of a vec2
- *
- * @param out the receiving vector
- * @param a vector to invert
- * @returns out
- */
- public static inverse(out: vec2, a: vec2): vec2;
-
- /**
- * Normalize a vec2
- *
- * @param out the receiving vector
- * @param a vector to normalize
- * @returns out
- */
- public static normalize(out: vec2, a: vec2): vec2;
-
- /**
- * Calculates the dot product of two vec2's
- *
- * @param a the first operand
- * @param b the second operand
- * @returns dot product of a and b
- */
- public static dot(a: vec2, b: vec2): number;
-
- /**
- * Computes the cross product of two vec2's
- * Note that the cross product must by definition produce a 3D vector
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static cross(out: vec2, a: vec2, b: vec2): vec2;
-
- /**
- * Performs a linear interpolation between two vec2's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @param t interpolation amount between the two inputs
- * @returns out
- */
- public static lerp(out: vec2, a: vec2, b: vec2, t: number): vec2;
-
- /**
- * Generates a random unit vector
- *
- * @param out the receiving vector
- * @returns out
- */
- public static random(out: vec2): vec2;
-
- /**
- * Generates a random vector with the given scale
- *
- * @param out the receiving vector
- * @param scale Length of the resulting vector. If ommitted, a unit vector will be returned
- * @returns out
- */
- public static random(out: vec2, scale: number): vec2;
-
- /**
- * Transforms the vec2 with a mat2
- *
- * @param out the receiving vector
- * @param a the vector to transform
- * @param m matrix to transform with
- * @returns out
- */
- public static transformMat2(out: vec2, a: vec2, m: mat2): vec2;
-
- /**
- * Transforms the vec2 with a mat2d
- *
- * @param out the receiving vector
- * @param a the vector to transform
- * @param m matrix to transform with
- * @returns out
- */
- public static transformMat2d(out: vec2, a: vec2, m: mat2d): vec2;
-
- /**
- * Transforms the vec2 with a mat3
- * 3rd vector component is implicitly '1'
- *
- * @param out the receiving vector
- * @param a the vector to transform
- * @param m matrix to transform with
- * @returns out
- */
- public static transformMat3(out: vec2, a: vec2, m: mat3): vec2;
-
- /**
- * Transforms the vec2 with a mat4
- * 3rd vector component is implicitly '0'
- * 4th vector component is implicitly '1'
- *
- * @param out the receiving vector
- * @param a the vector to transform
- * @param m matrix to transform with
- * @returns out
- */
- public static transformMat4(out: vec2, a: vec2, m: mat4): vec2;
-
- /**
- * Perform some operation over an array of vec2s.
- *
- * @param a the array of vectors to iterate over
- * @param stride Number of elements between the start of each vec2. If 0 assumes tightly packed
- * @param offset Number of elements to skip at the beginning of the array
- * @param count Number of vec2s to iterate over. If 0 iterates over entire array
- * @param fn Function to call for each vector in the array
- * @param arg additional argument to pass to fn
- * @returns a
- */
- public static forEach(a: Float32Array, stride: number, offset: number, count: number,
- fn: (a: vec2, b: vec2, arg: any) => void, arg: any): Float32Array;
-
- /**
- * Perform some operation over an array of vec2s.
- *
- * @param a the array of vectors to iterate over
- * @param stride Number of elements between the start of each vec2. If 0 assumes tightly packed
- * @param offset Number of elements to skip at the beginning of the array
- * @param count Number of vec2s to iterate over. If 0 iterates over entire array
- * @param fn Function to call for each vector in the array
- * @returns a
- */
- public static forEach(a: Float32Array, stride: number, offset: number, count: number,
- fn: (a: vec2, b: vec2) => void): Float32Array;
-
- /**
- * Returns a string representation of a vector
- *
- * @param a vector to represent as a string
- * @returns string representation of the vector
- */
- public static str(a: vec2): string;
-
- /**
- * Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===)
- *
- * @param {vec2} a The first vector.
- * @param {vec2} b The second vector.
- * @returns {boolean} True if the vectors are equal, false otherwise.
- */
- public static exactEquals (a:vec2, b:vec2): boolean;
-
- /**
- * Returns whether or not the vectors have approximately the same elements in the same position.
- *
- * @param {vec2} a The first vector.
- * @param {vec2} b The second vector.
- * @returns {boolean} True if the vectors are equal, false otherwise.
- */
- public static equals (a:vec2, b:vec2) : boolean;
-}
-
-// vec3
-export class vec3 extends Float32Array {
- private typeVec3:number;
-
- /**
- * Creates a new, empty vec3
- *
- * @returns a new 3D vector
- */
- public static create(): vec3;
-
- /**
- * Creates a new vec3 initialized with values from an existing vector
- *
- * @param a vector to clone
- * @returns a new 3D vector
- */
- public static clone(a: vec3): vec3;
-
- /**
- * Creates a new vec3 initialized with the given values
- *
- * @param x X component
- * @param y Y component
- * @param z Z component
- * @returns a new 3D vector
- */
- public static fromValues(x: number, y: number, z: number): vec3;
-
- /**
- * Copy the values from one vec3 to another
- *
- * @param out the receiving vector
- * @param a the source vector
- * @returns out
- */
- public static copy(out: vec3, a: vec3): vec3;
-
- /**
- * Set the components of a vec3 to the given values
- *
- * @param out the receiving vector
- * @param x X component
- * @param y Y component
- * @param z Z component
- * @returns out
- */
- public static set(out: vec3, x: number, y: number, z: number): vec3;
-
- /**
- * Adds two vec3's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static add(out: vec3, a: vec3, b: vec3): vec3;
-
- /**
- * Subtracts vector b from vector a
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static subtract(out: vec3, a: vec3, b: vec3): vec3;
-
- /**
- * Subtracts vector b from vector a
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static sub(out: vec3, a: vec3, b: vec3): vec3
-
- /**
- * Multiplies two vec3's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static multiply(out: vec3, a: vec3, b: vec3): vec3;
-
- /**
- * Multiplies two vec3's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static mul(out: vec3, a: vec3, b: vec3): vec3;
-
- /**
- * Divides two vec3's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static divide(out: vec3, a: vec3, b: vec3): vec3;
-
- /**
- * Divides two vec3's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static div(out: vec3, a: vec3, b: vec3): vec3;
-
- /**
- * Math.ceil the components of a vec3
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a vector to ceil
- * @returns {vec3} out
- */
- public static ceil (out:vec3, a:vec3) : vec3;
-
- /**
- * Math.floor the components of a vec3
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a vector to floor
- * @returns {vec3} out
- */
- public static floor (out:vec3, a:vec3) :vec3;
-
- /**
- * Returns the minimum of two vec3's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static min(out: vec3, a: vec3, b: vec3): vec3;
-
- /**
- * Returns the maximum of two vec3's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static max(out: vec3, a: vec3, b: vec3): vec3;
-
- /**
- * Math.round the components of a vec3
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a vector to round
- * @returns {vec3} out
- */
- public static round (out:vec3, a:vec3) : vec3
-
- /**
- * Scales a vec3 by a scalar number
- *
- * @param out the receiving vector
- * @param a the vector to scale
- * @param b amount to scale the vector by
- * @returns out
- */
- public static scale(out: vec3, a: vec3, b: number): vec3;
-
- /**
- * Adds two vec3's after scaling the second operand by a scalar value
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @param scale the amount to scale b by before adding
- * @returns out
- */
- public static scaleAndAdd(out: vec3, a: vec3, b: vec3, scale: number): vec3;
-
- /**
- * Calculates the euclidian distance between two vec3's
- *
- * @param a the first operand
- * @param b the second operand
- * @returns distance between a and b
- */
- public static distance(a: vec3, b: vec3): number;
-
- /**
- * Calculates the euclidian distance between two vec3's
- *
- * @param a the first operand
- * @param b the second operand
- * @returns distance between a and b
- */
- public static dist(a: vec3, b: vec3): number;
-
- /**
- * Calculates the squared euclidian distance between two vec3's
- *
- * @param a the first operand
- * @param b the second operand
- * @returns squared distance between a and b
- */
- public static squaredDistance(a: vec3, b: vec3): number;
-
- /**
- * Calculates the squared euclidian distance between two vec3's
- *
- * @param a the first operand
- * @param b the second operand
- * @returns squared distance between a and b
- */
- public static sqrDist(a: vec3, b: vec3): number;
-
- /**
- * Calculates the length of a vec3
- *
- * @param a vector to calculate length of
- * @returns length of a
- */
- public static length(a: vec3): number;
-
- /**
- * Calculates the length of a vec3
- *
- * @param a vector to calculate length of
- * @returns length of a
- */
- public static len(a: vec3): number;
-
- /**
- * Calculates the squared length of a vec3
- *
- * @param a vector to calculate squared length of
- * @returns squared length of a
- */
- public static squaredLength(a: vec3): number;
-
- /**
- * Calculates the squared length of a vec3
- *
- * @param a vector to calculate squared length of
- * @returns squared length of a
- */
- public static sqrLen(a: vec3): number;
-
- /**
- * Negates the components of a vec3
- *
- * @param out the receiving vector
- * @param a vector to negate
- * @returns out
- */
- public static negate(out: vec3, a: vec3): vec3;
-
- /**
- * Returns the inverse of the components of a vec3
- *
- * @param out the receiving vector
- * @param a vector to invert
- * @returns out
- */
- public static inverse(out: vec3, a: vec3): vec3;
-
- /**
- * Normalize a vec3
- *
- * @param out the receiving vector
- * @param a vector to normalize
- * @returns out
- */
- public static normalize(out: vec3, a: vec3): vec3;
-
- /**
- * Calculates the dot product of two vec3's
- *
- * @param a the first operand
- * @param b the second operand
- * @returns dot product of a and b
- */
- public static dot(a: vec3, b: vec3): number;
-
- /**
- * Computes the cross product of two vec3's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static cross(out: vec3, a: vec3, b: vec3): vec3;
-
- /**
- * Performs a linear interpolation between two vec3's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @param t interpolation amount between the two inputs
- * @returns out
- */
- public static lerp(out: vec3, a: vec3, b: vec3, t: number): vec3;
-
- /**
- * Performs a hermite interpolation with two control points
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the first operand
- * @param {vec3} b the second operand
- * @param {vec3} c the third operand
- * @param {vec3} d the fourth operand
- * @param {number} t interpolation amount between the two inputs
- * @returns {vec3} out
- */
- public static hermite (out:vec3, a:vec3, b:vec3, c:vec3, d:vec3, t:number) : vec3;
-
- /**
- * Performs a bezier interpolation with two control points
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the first operand
- * @param {vec3} b the second operand
- * @param {vec3} c the third operand
- * @param {vec3} d the fourth operand
- * @param {number} t interpolation amount between the two inputs
- * @returns {vec3} out
- */
- public static bezier (out:vec3, a:vec3, b:vec3, c:vec3, d:vec3, t:number) :vec3;
-
- /**
- * Generates a random unit vector
- *
- * @param out the receiving vector
- * @returns out
- */
- public static random(out: vec3): vec3;
-
- /**
- * Generates a random vector with the given scale
- *
- * @param out the receiving vector
- * @param [scale] Length of the resulting vector. If omitted, a unit vector will be returned
- * @returns out
- */
- public static random(out: vec3, scale: number): vec3;
-
- /**
- * Transforms the vec3 with a mat3.
- *
- * @param out the receiving vector
- * @param a the vector to transform
- * @param m the 3x3 matrix to transform with
- * @returns out
- */
- public static transformMat3(out: vec3, a: vec3, m: mat3): vec3;
-
- /**
- * Transforms the vec3 with a mat4.
- * 4th vector component is implicitly '1'
- *
- * @param out the receiving vector
- * @param a the vector to transform
- * @param m matrix to transform with
- * @returns out
- */
- public static transformMat4(out: vec3, a: vec3, m: mat4): vec3;
-
- /**
- * Transforms the vec3 with a quat
- *
- * @param out the receiving vector
- * @param a the vector to transform
- * @param q quaternion to transform with
- * @returns out
- */
- public static transformQuat(out: vec3, a: vec3, q: quat): vec3;
-
-
- /**
- * Rotate a 3D vector around the x-axis
- * @param out The receiving vec3
- * @param a The vec3 point to rotate
- * @param b The origin of the rotation
- * @param c The angle of rotation
- * @returns out
- */
- public static rotateX(out: vec3, a: vec3, b: vec3, c: number): vec3;
-
- /**
- * Rotate a 3D vector around the y-axis
- * @param out The receiving vec3
- * @param a The vec3 point to rotate
- * @param b The origin of the rotation
- * @param c The angle of rotation
- * @returns out
- */
- public static rotateY(out: vec3, a: vec3, b: vec3, c: number): vec3;
-
- /**
- * Rotate a 3D vector around the z-axis
- * @param out The receiving vec3
- * @param a The vec3 point to rotate
- * @param b The origin of the rotation
- * @param c The angle of rotation
- * @returns out
- */
- public static rotateZ(out: vec3, a: vec3, b: vec3, c: number): vec3;
-
- /**
- * Perform some operation over an array of vec3s.
- *
- * @param a the array of vectors to iterate over
- * @param stride Number of elements between the start of each vec3. If 0 assumes tightly packed
- * @param offset Number of elements to skip at the beginning of the array
- * @param count Number of vec3s to iterate over. If 0 iterates over entire array
- * @param fn Function to call for each vector in the array
- * @param arg additional argument to pass to fn
- * @returns a
- * @function
- */
- public static forEach(a: Float32Array, stride: number, offset: number, count: number,
- fn: (a: vec3, b: vec3, arg: any) => void, arg: any): Float32Array;
-
- /**
- * Perform some operation over an array of vec3s.
- *
- * @param a the array of vectors to iterate over
- * @param stride Number of elements between the start of each vec3. If 0 assumes tightly packed
- * @param offset Number of elements to skip at the beginning of the array
- * @param count Number of vec3s to iterate over. If 0 iterates over entire array
- * @param fn Function to call for each vector in the array
- * @returns a
- * @function
- */
- public static forEach(a: Float32Array, stride: number, offset: number, count: number,
- fn: (a: vec3, b: vec3) => void): Float32Array;
-
- /**
- * Get the angle between two 3D vectors
- * @param a The first operand
- * @param b The second operand
- * @returns The angle in radians
- */
- public static angle(a: vec3, b: vec3): number;
-
- /**
- * Returns a string representation of a vector
- *
- * @param a vector to represent as a string
- * @returns string representation of the vector
- */
- public static str(a: vec3): string;
-
- /**
- * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)
- *
- * @param {vec3} a The first vector.
- * @param {vec3} b The second vector.
- * @returns {boolean} True if the vectors are equal, false otherwise.
- */
- public static exactEquals (a:vec3, b:vec3): boolean
-
- /**
- * Returns whether or not the vectors have approximately the same elements in the same position.
- *
- * @param {vec3} a The first vector.
- * @param {vec3} b The second vector.
- * @returns {boolean} True if the vectors are equal, false otherwise.
- */
- public static equals (a:vec3, b:vec3) : boolean
-}
-
-// vec4
-export class vec4 extends Float32Array {
- private typeVec3:number;
-
- /**
- * Creates a new, empty vec4
- *
- * @returns a new 4D vector
- */
- public static create(): vec4;
-
- /**
- * Creates a new vec4 initialized with values from an existing vector
- *
- * @param a vector to clone
- * @returns a new 4D vector
- */
- public static clone(a: vec4): vec4;
-
- /**
- * Creates a new vec4 initialized with the given values
- *
- * @param x X component
- * @param y Y component
- * @param z Z component
- * @param w W component
- * @returns a new 4D vector
- */
- public static fromValues(x: number, y: number, z: number, w: number): vec4;
-
- /**
- * Copy the values from one vec4 to another
- *
- * @param out the receiving vector
- * @param a the source vector
- * @returns out
- */
- public static copy(out: vec4, a: vec4): vec4;
-
- /**
- * Set the components of a vec4 to the given values
- *
- * @param out the receiving vector
- * @param x X component
- * @param y Y component
- * @param z Z component
- * @param w W component
- * @returns out
- */
- public static set(out: vec4, x: number, y: number, z: number, w: number): vec4;
-
- /**
- * Adds two vec4's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static add(out: vec4, a: vec4, b: vec4): vec4;
-
- /**
- * Subtracts vector b from vector a
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static subtract(out: vec4, a: vec4, b: vec4): vec4;
-
- /**
- * Subtracts vector b from vector a
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static sub(out: vec4, a: vec4, b: vec4): vec4;
-
- /**
- * Multiplies two vec4's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static multiply(out: vec4, a: vec4, b: vec4): vec4;
-
- /**
- * Multiplies two vec4's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static mul(out: vec4, a: vec4, b: vec4): vec4;
-
- /**
- * Divides two vec4's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static divide(out: vec4, a: vec4, b: vec4): vec4;
-
- /**
- * Divides two vec4's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static div(out: vec4, a: vec4, b: vec4): vec4;
-
- /**
- * Math.ceil the components of a vec4
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a vector to ceil
- * @returns {vec4} out
- */
- public static ceil (out:vec4, a:vec4) : vec4;
-
- /**
- * Math.floor the components of a vec4
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a vector to floor
- * @returns {vec4} out
- */
- public static floor (out:vec4, a:vec4) : vec4;
-
- /**
- * Returns the minimum of two vec4's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static min(out: vec4, a: vec4, b: vec4): vec4;
-
- /**
- * Returns the maximum of two vec4's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static max(out: vec4, a: vec4, b: vec4): vec4;
-
- /**
- * Math.round the components of a vec4
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a vector to round
- * @returns {vec4} out
- */
- public static round (out:vec4, a:vec4): vec4;
-
- /**
- * Scales a vec4 by a scalar number
- *
- * @param out the receiving vector
- * @param a the vector to scale
- * @param b amount to scale the vector by
- * @returns out
- */
- public static scale(out: vec4, a: vec4, b: number): vec4;
-
- /**
- * Adds two vec4's after scaling the second operand by a scalar value
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @param scale the amount to scale b by before adding
- * @returns out
- */
- public static scaleAndAdd(out: vec4, a: vec4, b: vec4, scale: number): vec4;
-
- /**
- * Calculates the euclidian distance between two vec4's
- *
- * @param a the first operand
- * @param b the second operand
- * @returns distance between a and b
- */
- public static distance(a: vec4, b: vec4): number;
-
- /**
- * Calculates the euclidian distance between two vec4's
- *
- * @param a the first operand
- * @param b the second operand
- * @returns distance between a and b
- */
- public static dist(a: vec4, b: vec4): number;
-
- /**
- * Calculates the squared euclidian distance between two vec4's
- *
- * @param a the first operand
- * @param b the second operand
- * @returns squared distance between a and b
- */
- public static squaredDistance(a: vec4, b: vec4): number;
-
- /**
- * Calculates the squared euclidian distance between two vec4's
- *
- * @param a the first operand
- * @param b the second operand
- * @returns squared distance between a and b
- */
- public static sqrDist(a: vec4, b: vec4): number;
-
- /**
- * Calculates the length of a vec4
- *
- * @param a vector to calculate length of
- * @returns length of a
- */
- public static length(a: vec4): number;
-
- /**
- * Calculates the length of a vec4
- *
- * @param a vector to calculate length of
- * @returns length of a
- */
- public static len(a: vec4): number;
-
- /**
- * Calculates the squared length of a vec4
- *
- * @param a vector to calculate squared length of
- * @returns squared length of a
- */
- public static squaredLength(a: vec4): number;
-
- /**
- * Calculates the squared length of a vec4
- *
- * @param a vector to calculate squared length of
- * @returns squared length of a
- */
- public static sqrLen(a: vec4): number;
-
- /**
- * Negates the components of a vec4
- *
- * @param out the receiving vector
- * @param a vector to negate
- * @returns out
- */
- public static negate(out: vec4, a: vec4): vec4;
-
- /**
- * Returns the inverse of the components of a vec4
- *
- * @param out the receiving vector
- * @param a vector to invert
- * @returns out
- */
- public static inverse(out: vec4, a: vec4): vec4;
-
- /**
- * Normalize a vec4
- *
- * @param out the receiving vector
- * @param a vector to normalize
- * @returns out
- */
- public static normalize(out: vec4, a: vec4): vec4;
-
- /**
- * Calculates the dot product of two vec4's
- *
- * @param a the first operand
- * @param b the second operand
- * @returns dot product of a and b
- */
- public static dot(a: vec4, b: vec4): number;
-
- /**
- * Performs a linear interpolation between two vec4's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @param t interpolation amount between the two inputs
- * @returns out
- */
- public static lerp(out: vec4, a: vec4, b: vec4, t: number): vec4;
-
- /**
- * Generates a random unit vector
- *
- * @param out the receiving vector
- * @returns out
- */
- public static random(out: vec4): vec4;
-
- /**
- * Generates a random vector with the given scale
- *
- * @param out the receiving vector
- * @param scale length of the resulting vector. If ommitted, a unit vector will be returned
- * @returns out
- */
- public static random(out: vec4, scale: number): vec4;
-
- /**
- * Transforms the vec4 with a mat4.
- *
- * @param out the receiving vector
- * @param a the vector to transform
- * @param m matrix to transform with
- * @returns out
- */
- public static transformMat4(out: vec4, a: vec4, m: mat4): vec4;
-
- /**
- * Transforms the vec4 with a quat
- *
- * @param out the receiving vector
- * @param a the vector to transform
- * @param q quaternion to transform with
- * @returns out
- */
-
- public static transformQuat(out: vec4, a: vec4, q: quat): vec4;
-
- /**
- * Perform some operation over an array of vec4s.
- *
- * @param a the array of vectors to iterate over
- * @param stride Number of elements between the start of each vec4. If 0 assumes tightly packed
- * @param offset Number of elements to skip at the beginning of the array
- * @param count Number of vec4s to iterate over. If 0 iterates over entire array
- * @param fn Function to call for each vector in the array
- * @param arg additional argument to pass to fn
- * @returns a
- * @function
- */
- public static forEach(a: Float32Array, stride: number, offset: number, count: number,
- fn: (a: vec4, b: vec4, arg: any) => void, arg: any): Float32Array;
-
- /**
- * Perform some operation over an array of vec4s.
- *
- * @param a the array of vectors to iterate over
- * @param stride Number of elements between the start of each vec4. If 0 assumes tightly packed
- * @param offset Number of elements to skip at the beginning of the array
- * @param count Number of vec4s to iterate over. If 0 iterates over entire array
- * @param fn Function to call for each vector in the array
- * @returns a
- * @function
- */
- public static forEach(a: Float32Array, stride: number, offset: number, count: number,
- fn: (a: vec4, b: vec4) => void): Float32Array;
-
- /**
- * Returns a string representation of a vector
- *
- * @param a vector to represent as a string
- * @returns string representation of the vector
- */
- public static str(a: vec4): string;
-
- /**
- * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)
- *
- * @param {vec4} a The first vector.
- * @param {vec4} b The second vector.
- * @returns {boolean} True if the vectors are equal, false otherwise.
- */
- public static exactEquals (a:vec4, b:vec4) : boolean;
-
- /**
- * Returns whether or not the vectors have approximately the same elements in the same position.
- *
- * @param {vec4} a The first vector.
- * @param {vec4} b The second vector.
- * @returns {boolean} True if the vectors are equal, false otherwise.
- */
- public static equals (a:vec4, b:vec4) : boolean;
-}
-
-// mat2
-export class mat2 extends Float32Array {
- private typeMat2:number;
-
- /**
- * Creates a new identity mat2
- *
- * @returns a new 2x2 matrix
- */
- public static create():mat2;
-
- /**
- * Creates a new mat2 initialized with values from an existing matrix
- *
- * @param a matrix to clone
- * @returns a new 2x2 matrix
- */
- public static clone(a:mat2):mat2;
-
- /**
- * Copy the values from one mat2 to another
- *
- * @param out the receiving matrix
- * @param a the source matrix
- * @returns out
- */
- public static copy(out:mat2, a:mat2):mat2;
-
- /**
- * Set a mat2 to the identity matrix
- *
- * @param out the receiving matrix
- * @returns out
- */
- public static identity(out:mat2):mat2;
-
- /**
- * Create a new mat2 with the given values
- *
- * @param {number} m00 Component in column 0, row 0 position (index 0)
- * @param {number} m01 Component in column 0, row 1 position (index 1)
- * @param {number} m10 Component in column 1, row 0 position (index 2)
- * @param {number} m11 Component in column 1, row 1 position (index 3)
- * @returns {mat2} out A new 2x2 matrix
- */
- public static fromValues(m00:number, m01:number, m10:number, m11:number):mat2;
-
- /**
- * Set the components of a mat2 to the given values
- *
- * @param {mat2} out the receiving matrix
- * @param {number} m00 Component in column 0, row 0 position (index 0)
- * @param {number} m01 Component in column 0, row 1 position (index 1)
- * @param {number} m10 Component in column 1, row 0 position (index 2)
- * @param {number} m11 Component in column 1, row 1 position (index 3)
- * @returns {mat2} out
- */
- public static set(out:mat2, m00:number, m01:number, m10:number, m11:number):mat2;
-
- /**
- * Transpose the values of a mat2
- *
- * @param out the receiving matrix
- * @param a the source matrix
- * @returns out
- */
- public static transpose(out:mat2, a:mat2):mat2;
-
- /**
- * Inverts a mat2
- *
- * @param out the receiving matrix
- * @param a the source matrix
- * @returns out
- */
- public static invert(out:mat2, a:mat2):mat2;
-
- /**
- * Calculates the adjugate of a mat2
- *
- * @param out the receiving matrix
- * @param a the source matrix
- * @returns out
- */
- public static adjoint(out:mat2, a:mat2):mat2;
-
- /**
- * Calculates the determinant of a mat2
- *
- * @param a the source matrix
- * @returns determinant of a
- */
- public static determinant(a:mat2):number;
-
- /**
- * Multiplies two mat2's
- *
- * @param out the receiving matrix
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static multiply(out:mat2, a:mat2, b:mat2):mat2;
-
- /**
- * Multiplies two mat2's
- *
- * @param out the receiving matrix
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static mul(out:mat2, a:mat2, b:mat2):mat2;
-
- /**
- * Rotates a mat2 by the given angle
- *
- * @param out the receiving matrix
- * @param a the matrix to rotate
- * @param rad the angle to rotate the matrix by
- * @returns out
- */
- public static rotate(out:mat2, a:mat2, rad:number):mat2;
-
- /**
- * Scales the mat2 by the dimensions in the given vec2
- *
- * @param out the receiving matrix
- * @param a the matrix to rotate
- * @param v the vec2 to scale the matrix by
- * @returns out
- **/
- public static scale(out:mat2, a:mat2, v:vec2):mat2;
-
- /**
- * Creates a matrix from a given angle
- * This is equivalent to (but much faster than):
- *
- * mat2.identity(dest);
- * mat2.rotate(dest, dest, rad);
- *
- * @param {mat2} out mat2 receiving operation result
- * @param {number} rad the angle to rotate the matrix by
- * @returns {mat2} out
- */
- public static fromRotation(out:mat2, rad:number):mat2;
-
- /**
- * Creates a matrix from a vector scaling
- * This is equivalent to (but much faster than):
- *
- * mat2.identity(dest);
- * mat2.scale(dest, dest, vec);
- *
- * @param {mat2} out mat2 receiving operation result
- * @param {vec2} v Scaling vector
- * @returns {mat2} out
- */
- public static fromScaling(out:mat2, v:vec2):mat2;
-
- /**
- * Returns a string representation of a mat2
- *
- * @param a matrix to represent as a string
- * @returns string representation of the matrix
- */
- public static str(a:mat2):string;
-
- /**
- * Returns Frobenius norm of a mat2
- *
- * @param a the matrix to calculate Frobenius norm of
- * @returns Frobenius norm
- */
- public static frob(a:mat2):number;
-
- /**
- * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix
- * @param L the lower triangular matrix
- * @param D the diagonal matrix
- * @param U the upper triangular matrix
- * @param a the input matrix to factorize
- */
- public static LDU(L:mat2, D:mat2, U:mat2, a:mat2):mat2;
-
- /**
- * Adds two mat2's
- *
- * @param {mat2} out the receiving matrix
- * @param {mat2} a the first operand
- * @param {mat2} b the second operand
- * @returns {mat2} out
- */
- public static add(out:mat2, a:mat2, b:mat2):mat2;
-
- /**
- * Subtracts matrix b from matrix a
- *
- * @param {mat2} out the receiving matrix
- * @param {mat2} a the first operand
- * @param {mat2} b the second operand
- * @returns {mat2} out
- */
- public static subtract (out:mat2, a:mat2, b:mat2):mat2;
-
- /**
- * Subtracts matrix b from matrix a
- *
- * @param {mat2} out the receiving matrix
- * @param {mat2} a the first operand
- * @param {mat2} b the second operand
- * @returns {mat2} out
- */
- public static sub (out:mat2, a:mat2, b:mat2):mat2;
-
- /**
- * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
- *
- * @param {mat2} a The first matrix.
- * @param {mat2} b The second matrix.
- * @returns {boolean} True if the matrices are equal, false otherwise.
- */
- public static exactEquals (a:mat2, b:mat2):boolean;
-
- /**
- * Returns whether or not the matrices have approximately the same elements in the same position.
- *
- * @param {mat2} a The first matrix.
- * @param {mat2} b The second matrix.
- * @returns {boolean} True if the matrices are equal, false otherwise.
- */
- public static equals (a:mat2, b:mat2) :boolean;
-
- /**
- * Multiply each element of the matrix by a scalar.
- *
- * @param {mat2} out the receiving matrix
- * @param {mat2} a the matrix to scale
- * @param {number} b amount to scale the matrix's elements by
- * @returns {mat2} out
- */
- public static multiplyScalar (out:mat2, a:mat2, b:number) :mat2
-
- /**
- * Adds two mat2's after multiplying each element of the second operand by a scalar value.
- *
- * @param {mat2} out the receiving vector
- * @param {mat2} a the first operand
- * @param {mat2} b the second operand
- * @param {number} scale the amount to scale b's elements by before adding
- * @returns {mat2} out
- */
- public static multiplyScalarAndAdd (out:mat2, a:mat2, b:mat2, scale:number): mat2
-
-
-
-}
-
-// mat2d
-export class mat2d extends Float32Array {
- private typeMat2d:number;
-
- /**
- * Creates a new identity mat2d
- *
- * @returns a new 2x3 matrix
- */
- public static create(): mat2d;
-
- /**
- * Creates a new mat2d initialized with values from an existing matrix
- *
- * @param a matrix to clone
- * @returns a new 2x3 matrix
- */
- public static clone(a: mat2d): mat2d;
-
- /**
- * Copy the values from one mat2d to another
- *
- * @param out the receiving matrix
- * @param a the source matrix
- * @returns out
- */
- public static copy(out: mat2d, a: mat2d): mat2d;
-
- /**
- * Set a mat2d to the identity matrix
- *
- * @param out the receiving matrix
- * @returns out
- */
- public static identity(out: mat2d): mat2d;
-
- /**
- * Create a new mat2d with the given values
- *
- * @param {number} a Component A (index 0)
- * @param {number} b Component B (index 1)
- * @param {number} c Component C (index 2)
- * @param {number} d Component D (index 3)
- * @param {number} tx Component TX (index 4)
- * @param {number} ty Component TY (index 5)
- * @returns {mat2d} A new mat2d
- */
- public static fromValues (a:number, b:number, c:number, d:number, tx:number, ty:number) : mat2d
-
-
- /**
- * Set the components of a mat2d to the given values
- *
- * @param {mat2d} out the receiving matrix
- * @param {number} a Component A (index 0)
- * @param {number} b Component B (index 1)
- * @param {number} c Component C (index 2)
- * @param {number} d Component D (index 3)
- * @param {number} tx Component TX (index 4)
- * @param {number} ty Component TY (index 5)
- * @returns {mat2d} out
- */
- public static set (out:mat2d, a:number, b:number, c:number, d:number, tx:number, ty:number) :mat2d
-
- /**
- * Inverts a mat2d
- *
- * @param out the receiving matrix
- * @param a the source matrix
- * @returns out
- */
- public static invert(out: mat2d, a: mat2d): mat2d;
-
- /**
- * Calculates the determinant of a mat2d
- *
- * @param a the source matrix
- * @returns determinant of a
- */
- public static determinant(a: mat2d): number;
-
- /**
- * Multiplies two mat2d's
- *
- * @param out the receiving matrix
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static multiply(out: mat2d, a: mat2d, b: mat2d): mat2d;
-
- /**
- * Multiplies two mat2d's
- *
- * @param out the receiving matrix
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static mul(out: mat2d, a: mat2d, b: mat2d): mat2d;
-
- /**
- * Rotates a mat2d by the given angle
- *
- * @param out the receiving matrix
- * @param a the matrix to rotate
- * @param rad the angle to rotate the matrix by
- * @returns out
- */
- public static rotate(out: mat2d, a: mat2d, rad: number): mat2d;
-
- /**
- * Scales the mat2d by the dimensions in the given vec2
- *
- * @param out the receiving matrix
- * @param a the matrix to translate
- * @param v the vec2 to scale the matrix by
- * @returns out
- **/
- public static scale(out: mat2d, a: mat2d, v: vec2): mat2d;
-
- /**
- * Translates the mat2d by the dimensions in the given vec2
- *
- * @param out the receiving matrix
- * @param a the matrix to translate
- * @param v the vec2 to translate the matrix by
- * @returns out
- **/
- public static translate(out: mat2d, a: mat2d, v: vec2): mat2d;
-
- /**
- * Creates a matrix from a given angle
- * This is equivalent to (but much faster than):
- *
- * mat2d.identity(dest);
- * mat2d.rotate(dest, dest, rad);
- *
- * @param {mat2d} out mat2d receiving operation result
- * @param {number} rad the angle to rotate the matrix by
- * @returns {mat2d} out
- */
- public static fromRotation (out:mat2d, rad:number): mat2d;
-
- /**
- * Creates a matrix from a vector scaling
- * This is equivalent to (but much faster than):
- *
- * mat2d.identity(dest);
- * mat2d.scale(dest, dest, vec);
- *
- * @param {mat2d} out mat2d receiving operation result
- * @param {vec2} v Scaling vector
- * @returns {mat2d} out
- */
- public static fromScaling (out:mat2d, v:vec2):mat2d;
-
- /**
- * Creates a matrix from a vector translation
- * This is equivalent to (but much faster than):
- *
- * mat2d.identity(dest);
- * mat2d.translate(dest, dest, vec);
- *
- * @param {mat2d} out mat2d receiving operation result
- * @param {vec2} v Translation vector
- * @returns {mat2d} out
- */
- public static fromTranslation (out:mat2d, v:vec2):mat2d
-
- /**
- * Returns a string representation of a mat2d
- *
- * @param a matrix to represent as a string
- * @returns string representation of the matrix
- */
- public static str(a: mat2d): string;
-
- /**
- * Returns Frobenius norm of a mat2d
- *
- * @param a the matrix to calculate Frobenius norm of
- * @returns Frobenius norm
- */
- public static frob(a: mat2d): number;
-
- /**
- * Adds two mat2d's
- *
- * @param {mat2d} out the receiving matrix
- * @param {mat2d} a the first operand
- * @param {mat2d} b the second operand
- * @returns {mat2d} out
- */
- public static add (out: mat2d, a: mat2d, b: mat2d): mat2d
-
- /**
- * Subtracts matrix b from matrix a
- *
- * @param {mat2d} out the receiving matrix
- * @param {mat2d} a the first operand
- * @param {mat2d} b the second operand
- * @returns {mat2d} out
- */
- public static subtract(out: mat2d, a: mat2d, b: mat2d): mat2d
-
- /**
- * Subtracts matrix b from matrix a
- *
- * @param {mat2d} out the receiving matrix
- * @param {mat2d} a the first operand
- * @param {mat2d} b the second operand
- * @returns {mat2d} out
- */
- public static sub(out: mat2d, a: mat2d, b: mat2d): mat2d
-
- /**
- * Multiply each element of the matrix by a scalar.
- *
- * @param {mat2d} out the receiving matrix
- * @param {mat2d} a the matrix to scale
- * @param {number} b amount to scale the matrix's elements by
- * @returns {mat2d} out
- */
- public static multiplyScalar (out: mat2d, a: mat2d, b: number): mat2d;
-
- /**
- * Adds two mat2d's after multiplying each element of the second operand by a scalar value.
- *
- * @param {mat2d} out the receiving vector
- * @param {mat2d} a the first operand
- * @param {mat2d} b the second operand
- * @param {number} scale the amount to scale b's elements by before adding
- * @returns {mat2d} out
- */
- public static multiplyScalarAndAdd (out: mat2d, a: mat2d, b: mat2d, scale:number) : mat2d
-
- /**
- * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
- *
- * @param {mat2d} a The first matrix.
- * @param {mat2d} b The second matrix.
- * @returns {boolean} True if the matrices are equal, false otherwise.
- */
- public static exactEquals (a: mat2d, b: mat2d): boolean;
-
- /**
- * Returns whether or not the matrices have approximately the same elements in the same position.
- *
- * @param {mat2d} a The first matrix.
- * @param {mat2d} b The second matrix.
- * @returns {boolean} True if the matrices are equal, false otherwise.
- */
- public static equals (a: mat2d, b: mat2d): boolean
-}
-
-// mat3
-export class mat3 extends Float32Array {
- private typeMat3:number;
-
- /**
- * Creates a new identity mat3
- *
- * @returns a new 3x3 matrix
- */
- public static create():mat3;
-
- /**
- * Copies the upper-left 3x3 values into the given mat3.
- *
- * @param {mat3} out the receiving 3x3 matrix
- * @param {mat4} a the source 4x4 matrix
- * @returns {mat3} out
- */
- public static fromMat4(out:mat3, a:mat4):mat3
-
- /**
- * Creates a new mat3 initialized with values from an existing matrix
- *
- * @param a matrix to clone
- * @returns a new 3x3 matrix
- */
- public static clone(a:mat3):mat3;
-
- /**
- * Copy the values from one mat3 to another
- *
- * @param out the receiving matrix
- * @param a the source matrix
- * @returns out
- */
- public static copy(out:mat3, a:mat3):mat3;
-
- /**
- * Create a new mat3 with the given values
- *
- * @param {number} m00 Component in column 0, row 0 position (index 0)
- * @param {number} m01 Component in column 0, row 1 position (index 1)
- * @param {number} m02 Component in column 0, row 2 position (index 2)
- * @param {number} m10 Component in column 1, row 0 position (index 3)
- * @param {number} m11 Component in column 1, row 1 position (index 4)
- * @param {number} m12 Component in column 1, row 2 position (index 5)
- * @param {number} m20 Component in column 2, row 0 position (index 6)
- * @param {number} m21 Component in column 2, row 1 position (index 7)
- * @param {number} m22 Component in column 2, row 2 position (index 8)
- * @returns {mat3} A new mat3
- */
- public static fromValues(m00:number, m01:number, m02:number, m10:number, m11:number, m12:number, m20:number, m21:number, m22:number):mat3;
-
-
- /**
- * Set the components of a mat3 to the given values
- *
- * @param {mat3} out the receiving matrix
- * @param {number} m00 Component in column 0, row 0 position (index 0)
- * @param {number} m01 Component in column 0, row 1 position (index 1)
- * @param {number} m02 Component in column 0, row 2 position (index 2)
- * @param {number} m10 Component in column 1, row 0 position (index 3)
- * @param {number} m11 Component in column 1, row 1 position (index 4)
- * @param {number} m12 Component in column 1, row 2 position (index 5)
- * @param {number} m20 Component in column 2, row 0 position (index 6)
- * @param {number} m21 Component in column 2, row 1 position (index 7)
- * @param {number} m22 Component in column 2, row 2 position (index 8)
- * @returns {mat3} out
- */
- public static set(out:mat3, m00:number, m01:number, m02:number, m10:number, m11:number, m12:number, m20:number, m21:number, m22:number):mat3
-
- /**
- * Set a mat3 to the identity matrix
- *
- * @param out the receiving matrix
- * @returns out
- */
- public static identity(out:mat3):mat3;
-
- /**
- * Transpose the values of a mat3
- *
- * @param out the receiving matrix
- * @param a the source matrix
- * @returns out
- */
- public static transpose(out:mat3, a:mat3):mat3;
-
- /**
- * Inverts a mat3
- *
- * @param out the receiving matrix
- * @param a the source matrix
- * @returns out
- */
- public static invert(out:mat3, a:mat3):mat3;
-
- /**
- * Calculates the adjugate of a mat3
- *
- * @param out the receiving matrix
- * @param a the source matrix
- * @returns out
- */
- public static adjoint(out:mat3, a:mat3):mat3;
-
- /**
- * Calculates the determinant of a mat3
- *
- * @param a the source matrix
- * @returns determinant of a
- */
- public static determinant(a:mat3):number;
-
- /**
- * Multiplies two mat3's
- *
- * @param out the receiving matrix
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static multiply(out:mat3, a:mat3, b:mat3):mat3;
-
- /**
- * Multiplies two mat3's
- *
- * @param out the receiving matrix
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static mul(out:mat3, a:mat3, b:mat3):mat3;
-
-
- /**
- * Translate a mat3 by the given vector
- *
- * @param out the receiving matrix
- * @param a the matrix to translate
- * @param v vector to translate by
- * @returns out
- */
- public static translate(out:mat3, a:mat3, v:vec3):mat3;
-
- /**
- * Rotates a mat3 by the given angle
- *
- * @param out the receiving matrix
- * @param a the matrix to rotate
- * @param rad the angle to rotate the matrix by
- * @returns out
- */
- public static rotate(out:mat3, a:mat3, rad:number):mat3;
-
- /**
- * Scales the mat3 by the dimensions in the given vec2
- *
- * @param out the receiving matrix
- * @param a the matrix to rotate
- * @param v the vec2 to scale the matrix by
- * @returns out
- **/
- public static scale(out:mat3, a:mat3, v:vec2):mat3;
-
- /**
- * Creates a matrix from a vector translation
- * This is equivalent to (but much faster than):
- *
- * mat3.identity(dest);
- * mat3.translate(dest, dest, vec);
- *
- * @param {mat3} out mat3 receiving operation result
- * @param {vec2} v Translation vector
- * @returns {mat3} out
- */
- public static fromTranslation(out:mat3, v:vec2):mat3
-
- /**
- * Creates a matrix from a given angle
- * This is equivalent to (but much faster than):
- *
- * mat3.identity(dest);
- * mat3.rotate(dest, dest, rad);
- *
- * @param {mat3} out mat3 receiving operation result
- * @param {number} rad the angle to rotate the matrix by
- * @returns {mat3} out
- */
- public static fromRotation(out:mat3, rad:number):mat3
-
- /**
- * Creates a matrix from a vector scaling
- * This is equivalent to (but much faster than):
- *
- * mat3.identity(dest);
- * mat3.scale(dest, dest, vec);
- *
- * @param {mat3} out mat3 receiving operation result
- * @param {vec2} v Scaling vector
- * @returns {mat3} out
- */
- public static fromScaling(out:mat3, v:vec2):mat3
-
- /**
- * Copies the values from a mat2d into a mat3
- *
- * @param out the receiving matrix
- * @param {mat2d} a the matrix to copy
- * @returns out
- **/
- public static fromMat2d(out:mat3, a:mat2d):mat3;
-
- /**
- * Calculates a 3x3 matrix from the given quaternion
- *
- * @param out mat3 receiving operation result
- * @param q Quaternion to create matrix from
- *
- * @returns out
- */
- public static fromQuat(out:mat3, q:quat):mat3;
-
- /**
- * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix
- *
- * @param out mat3 receiving operation result
- * @param a Mat4 to derive the normal matrix from
- *
- * @returns out
- */
- public static normalFromMat4(out:mat3, a:mat4):mat3;
-
- /**
- * Returns a string representation of a mat3
- *
- * @param mat matrix to represent as a string
- * @returns string representation of the matrix
- */
- public static str(mat:mat3):string;
-
- /**
- * Returns Frobenius norm of a mat3
- *
- * @param a the matrix to calculate Frobenius norm of
- * @returns Frobenius norm
- */
- public static frob(a:mat3):number;
-
- /**
- * Adds two mat3's
- *
- * @param {mat3} out the receiving matrix
- * @param {mat3} a the first operand
- * @param {mat3} b the second operand
- * @returns {mat3} out
- */
- public static add(out:mat3, a:mat3, b:mat3):mat3
-
- /**
- * Subtracts matrix b from matrix a
- *
- * @param {mat3} out the receiving matrix
- * @param {mat3} a the first operand
- * @param {mat3} b the second operand
- * @returns {mat3} out
- */
- public static subtract(out:mat3, a:mat3, b:mat3):mat3
-
- /**
- * Subtracts matrix b from matrix a
- *
- * @param {mat3} out the receiving matrix
- * @param {mat3} a the first operand
- * @param {mat3} b the second operand
- * @returns {mat3} out
- */
- public static sub(out:mat3, a:mat3, b:mat3):mat3
-
- /**
- * Multiply each element of the matrix by a scalar.
- *
- * @param {mat3} out the receiving matrix
- * @param {mat3} a the matrix to scale
- * @param {number} b amount to scale the matrix's elements by
- * @returns {mat3} out
- */
- public static multiplyScalar(out:mat3, a:mat3, b:number):mat3
-
- /**
- * Adds two mat3's after multiplying each element of the second operand by a scalar value.
- *
- * @param {mat3} out the receiving vector
- * @param {mat3} a the first operand
- * @param {mat3} b the second operand
- * @param {number} scale the amount to scale b's elements by before adding
- * @returns {mat3} out
- */
- public static multiplyScalarAndAdd(out:mat3, a:mat3, b:mat3, scale:number):mat3
-
- /**
- * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
- *
- * @param {mat3} a The first matrix.
- * @param {mat3} b The second matrix.
- * @returns {boolean} True if the matrices are equal, false otherwise.
- */
- public static exactEquals(a:mat3, b:mat3):boolean;
-
- /**
- * Returns whether or not the matrices have approximately the same elements in the same position.
- *
- * @param {mat3} a The first matrix.
- * @param {mat3} b The second matrix.
- * @returns {boolean} True if the matrices are equal, false otherwise.
- */
- public static equals(a:mat3, b:mat3):boolean
-}
-
-// mat4
-export class mat4 extends Float32Array {
- private typeMat4:number;
-
- /**
- * Creates a new identity mat4
- *
- * @returns a new 4x4 matrix
- */
- public static create():mat4;
-
- /**
- * Creates a new mat4 initialized with values from an existing matrix
- *
- * @param a matrix to clone
- * @returns a new 4x4 matrix
- */
- public static clone(a:mat4):mat4;
-
- /**
- * Copy the values from one mat4 to another
- *
- * @param out the receiving matrix
- * @param a the source matrix
- * @returns out
- */
- public static copy(out:mat4, a:mat4):mat4;
-
-
- /**
- * Create a new mat4 with the given values
- *
- * @param {number} m00 Component in column 0, row 0 position (index 0)
- * @param {number} m01 Component in column 0, row 1 position (index 1)
- * @param {number} m02 Component in column 0, row 2 position (index 2)
- * @param {number} m03 Component in column 0, row 3 position (index 3)
- * @param {number} m10 Component in column 1, row 0 position (index 4)
- * @param {number} m11 Component in column 1, row 1 position (index 5)
- * @param {number} m12 Component in column 1, row 2 position (index 6)
- * @param {number} m13 Component in column 1, row 3 position (index 7)
- * @param {number} m20 Component in column 2, row 0 position (index 8)
- * @param {number} m21 Component in column 2, row 1 position (index 9)
- * @param {number} m22 Component in column 2, row 2 position (index 10)
- * @param {number} m23 Component in column 2, row 3 position (index 11)
- * @param {number} m30 Component in column 3, row 0 position (index 12)
- * @param {number} m31 Component in column 3, row 1 position (index 13)
- * @param {number} m32 Component in column 3, row 2 position (index 14)
- * @param {number} m33 Component in column 3, row 3 position (index 15)
- * @returns {mat4} A new mat4
- */
- public static fromValues(m00:number, m01:number, m02:number, m03:number, m10:number, m11:number, m12:number, m13:number, m20:number, m21:number, m22:number, m23:number, m30:number, m31:number, m32:number, m33:number):mat4;
-
- /**
- * Set the components of a mat4 to the given values
- *
- * @param {mat4} out the receiving matrix
- * @param {number} m00 Component in column 0, row 0 position (index 0)
- * @param {number} m01 Component in column 0, row 1 position (index 1)
- * @param {number} m02 Component in column 0, row 2 position (index 2)
- * @param {number} m03 Component in column 0, row 3 position (index 3)
- * @param {number} m10 Component in column 1, row 0 position (index 4)
- * @param {number} m11 Component in column 1, row 1 position (index 5)
- * @param {number} m12 Component in column 1, row 2 position (index 6)
- * @param {number} m13 Component in column 1, row 3 position (index 7)
- * @param {number} m20 Component in column 2, row 0 position (index 8)
- * @param {number} m21 Component in column 2, row 1 position (index 9)
- * @param {number} m22 Component in column 2, row 2 position (index 10)
- * @param {number} m23 Component in column 2, row 3 position (index 11)
- * @param {number} m30 Component in column 3, row 0 position (index 12)
- * @param {number} m31 Component in column 3, row 1 position (index 13)
- * @param {number} m32 Component in column 3, row 2 position (index 14)
- * @param {number} m33 Component in column 3, row 3 position (index 15)
- * @returns {mat4} out
- */
- public static set(out:mat4, m00:number, m01:number, m02:number, m03:number, m10:number, m11:number, m12:number, m13:number, m20:number, m21:number, m22:number, m23:number, m30:number, m31:number, m32:number, m33:number):mat4;
-
- /**
- * Set a mat4 to the identity matrix
- *
- * @param out the receiving matrix
- * @returns out
- */
- public static identity(out:mat4):mat4;
-
- /**
- * Transpose the values of a mat4
- *
- * @param out the receiving matrix
- * @param a the source matrix
- * @returns out
- */
- public static transpose(out:mat4, a:mat4):mat4;
-
- /**
- * Inverts a mat4
- *
- * @param out the receiving matrix
- * @param a the source matrix
- * @returns out
- */
- public static invert(out:mat4, a:mat4):mat4;
-
- /**
- * Calculates the adjugate of a mat4
- *
- * @param out the receiving matrix
- * @param a the source matrix
- * @returns out
- */
- public static adjoint(out:mat4, a:mat4):mat4;
-
- /**
- * Calculates the determinant of a mat4
- *
- * @param a the source matrix
- * @returns determinant of a
- */
- public static determinant(a:mat4):number;
-
- /**
- * Multiplies two mat4's
- *
- * @param out the receiving matrix
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static multiply(out:mat4, a:mat4, b:mat4):mat4;
-
- /**
- * Multiplies two mat4's
- *
- * @param out the receiving matrix
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static mul(out:mat4, a:mat4, b:mat4):mat4;
-
- /**
- * Translate a mat4 by the given vector
- *
- * @param out the receiving matrix
- * @param a the matrix to translate
- * @param v vector to translate by
- * @returns out
- */
- public static translate(out:mat4, a:mat4, v:vec3):mat4;
-
- /**
- * Scales the mat4 by the dimensions in the given vec3
- *
- * @param out the receiving matrix
- * @param a the matrix to scale
- * @param v the vec3 to scale the matrix by
- * @returns out
- **/
- public static scale(out:mat4, a:mat4, v:vec3):mat4;
-
- /**
- * Rotates a mat4 by the given angle
- *
- * @param out the receiving matrix
- * @param a the matrix to rotate
- * @param rad the angle to rotate the matrix by
- * @param axis the axis to rotate around
- * @returns out
- */
- public static rotate(out:mat4, a:mat4, rad:number, axis:vec3):mat4;
-
- /**
- * Rotates a matrix by the given angle around the X axis
- *
- * @param out the receiving matrix
- * @param a the matrix to rotate
- * @param rad the angle to rotate the matrix by
- * @returns out
- */
- public static rotateX(out:mat4, a:mat4, rad:number):mat4;
-
- /**
- * Rotates a matrix by the given angle around the Y axis
- *
- * @param out the receiving matrix
- * @param a the matrix to rotate
- * @param rad the angle to rotate the matrix by
- * @returns out
- */
- public static rotateY(out:mat4, a:mat4, rad:number):mat4;
-
- /**
- * Rotates a matrix by the given angle around the Z axis
- *
- * @param out the receiving matrix
- * @param a the matrix to rotate
- * @param rad the angle to rotate the matrix by
- * @returns out
- */
- public static rotateZ(out:mat4, a:mat4, rad:number):mat4;
-
- /**
- * Creates a matrix from a vector translation
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.translate(dest, dest, vec);
- *
- * @param {mat4} out mat4 receiving operation result
- * @param {vec3} v Translation vector
- * @returns {mat4} out
- */
- public static fromTranslation(out:mat4, v:vec3):mat4
-
- /**
- * Creates a matrix from a vector scaling
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.scale(dest, dest, vec);
- *
- * @param {mat4} out mat4 receiving operation result
- * @param {vec3} v Scaling vector
- * @returns {mat4} out
- */
- public static fromScaling(out:mat4, v:vec3):mat4
-
- /**
- * Creates a matrix from a given angle around a given axis
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.rotate(dest, dest, rad, axis);
- *
- * @param {mat4} out mat4 receiving operation result
- * @param {number} rad the angle to rotate the matrix by
- * @param {vec3} axis the axis to rotate around
- * @returns {mat4} out
- */
- public static fromRotation(out:mat4, rad:number, axis:vec3):mat4
-
- /**
- * Creates a matrix from the given angle around the X axis
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.rotateX(dest, dest, rad);
- *
- * @param {mat4} out mat4 receiving operation result
- * @param {number} rad the angle to rotate the matrix by
- * @returns {mat4} out
- */
- public static fromXRotation(out:mat4, rad:number):mat4
-
- /**
- * Creates a matrix from the given angle around the Y axis
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.rotateY(dest, dest, rad);
- *
- * @param {mat4} out mat4 receiving operation result
- * @param {number} rad the angle to rotate the matrix by
- * @returns {mat4} out
- */
- public static fromYRotation(out:mat4, rad:number):mat4
-
-
- /**
- * Creates a matrix from the given angle around the Z axis
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.rotateZ(dest, dest, rad);
- *
- * @param {mat4} out mat4 receiving operation result
- * @param {number} rad the angle to rotate the matrix by
- * @returns {mat4} out
- */
- public static fromZRotation(out:mat4, rad:number):mat4
-
- /**
- * Creates a matrix from a quaternion rotation and vector translation
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.translate(dest, vec);
- * var quatMat = mat4.create();
- * quat4.toMat4(quat, quatMat);
- * mat4.multiply(dest, quatMat);
- *
- * @param out mat4 receiving operation result
- * @param q Rotation quaternion
- * @param v Translation vector
- * @returns out
- */
- public static fromRotationTranslation(out:mat4, q:quat, v:vec3):mat4;
-
- /**
- * Returns the translation vector component of a transformation
- * matrix. If a matrix is built with fromRotationTranslation,
- * the returned vector will be the same as the translation vector
- * originally supplied.
- * @param {vec3} out Vector to receive translation component
- * @param {mat4} mat Matrix to be decomposed (input)
- * @return {vec3} out
- */
- public static getTranslation(out:vec3, mat:mat4):vec3;
-
- /**
- * Returns a quaternion representing the rotational component
- * of a transformation matrix. If a matrix is built with
- * fromRotationTranslation, the returned quaternion will be the
- * same as the quaternion originally supplied.
- * @param {quat} out Quaternion to receive the rotation component
- * @param {mat4} mat Matrix to be decomposed (input)
- * @return {quat} out
- */
- public static getRotation(out:quat, mat:mat4):quat;
-
- /**
- * Creates a matrix from a quaternion rotation, vector translation and vector scale
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.translate(dest, vec);
- * var quatMat = mat4.create();
- * quat4.toMat4(quat, quatMat);
- * mat4.multiply(dest, quatMat);
- * mat4.scale(dest, scale)
- *
- * @param out mat4 receiving operation result
- * @param q Rotation quaternion
- * @param v Translation vector
- * @param s Scaling vector
- * @returns out
- */
- public static fromRotationTranslationScale(out:mat4, q:quat, v:vec3, s:vec3):mat4;
-
- /**
- * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.translate(dest, vec);
- * mat4.translate(dest, origin);
- * var quatMat = mat4.create();
- * quat4.toMat4(quat, quatMat);
- * mat4.multiply(dest, quatMat);
- * mat4.scale(dest, scale)
- * mat4.translate(dest, negativeOrigin);
- *
- * @param {mat4} out mat4 receiving operation result
- * @param {quat} q Rotation quaternion
- * @param {vec3} v Translation vector
- * @param {vec3} s Scaling vector
- * @param {vec3} o The origin vector around which to scale and rotate
- * @returns {mat4} out
- */
- public static fromRotationTranslationScaleOrigin(out:mat4, q:quat, v:vec3, s:vec3, o:vec3):mat4
-
- /**
- * Calculates a 4x4 matrix from the given quaternion
- *
- * @param {mat4} out mat4 receiving operation result
- * @param {quat} q Quaternion to create matrix from
- *
- * @returns {mat4} out
- */
- public static fromQuat(out:mat4, q:quat):mat4
-
- /**
- * Generates a frustum matrix with the given bounds
- *
- * @param out mat4 frustum matrix will be written into
- * @param left Left bound of the frustum
- * @param right Right bound of the frustum
- * @param bottom Bottom bound of the frustum
- * @param top Top bound of the frustum
- * @param near Near bound of the frustum
- * @param far Far bound of the frustum
- * @returns out
- */
- public static frustum(out:mat4, left:number, right:number,
- bottom:number, top:number, near:number, far:number):mat4;
-
- /**
- * Generates a perspective projection matrix with the given bounds
- *
- * @param out mat4 frustum matrix will be written into
- * @param fovy Vertical field of view in radians
- * @param aspect Aspect ratio. typically viewport width/height
- * @param near Near bound of the frustum
- * @param far Far bound of the frustum
- * @returns out
- */
- public static perspective(out:mat4, fovy:number, aspect:number,
- near:number, far:number):mat4;
-
- /**
- * Generates a perspective projection matrix with the given field of view.
- * This is primarily useful for generating projection matrices to be used
- * with the still experimental WebVR API.
- *
- * @param {mat4} out mat4 frustum matrix will be written into
- * @param {Object} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees
- * @param {number} near Near bound of the frustum
- * @param {number} far Far bound of the frustum
- * @returns {mat4} out
- */
- public static perspectiveFromFieldOfView(out:mat4,
- fov:{upDegrees:number, downDegrees:number, leftDegrees:number, rightDegrees:number},
- near:number, far:number):mat4
-
- /**
- * Generates a orthogonal projection matrix with the given bounds
- *
- * @param out mat4 frustum matrix will be written into
- * @param left Left bound of the frustum
- * @param right Right bound of the frustum
- * @param bottom Bottom bound of the frustum
- * @param top Top bound of the frustum
- * @param near Near bound of the frustum
- * @param far Far bound of the frustum
- * @returns out
- */
- public static ortho(out:mat4, left:number, right:number,
- bottom:number, top:number, near:number, far:number):mat4;
-
- /**
- * Generates a look-at matrix with the given eye position, focal point, and up axis
- *
- * @param out mat4 frustum matrix will be written into
- * @param eye Position of the viewer
- * @param center Point the viewer is looking at
- * @param up vec3 pointing up
- * @returns out
- */
- public static lookAt(out:mat4, eye:vec3, center:vec3, up:vec3):mat4;
-
- /**
- * Returns a string representation of a mat4
- *
- * @param mat matrix to represent as a string
- * @returns string representation of the matrix
- */
- public static str(mat:mat4):string;
-
- /**
- * Returns Frobenius norm of a mat4
- *
- * @param a the matrix to calculate Frobenius norm of
- * @returns Frobenius norm
- */
- public static frob(a:mat4):number;
-
- /**
- * Adds two mat4's
- *
- * @param {mat4} out the receiving matrix
- * @param {mat4} a the first operand
- * @param {mat4} b the second operand
- * @returns {mat4} out
- */
- public static add(out:mat4, a:mat4, b:mat4):mat4
-
- /**
- * Subtracts matrix b from matrix a
- *
- * @param {mat4} out the receiving matrix
- * @param {mat4} a the first operand
- * @param {mat4} b the second operand
- * @returns {mat4} out
- */
- public static subtract(out:mat4, a:mat4, b:mat4):mat4
-
- /**
- * Subtracts matrix b from matrix a
- *
- * @param {mat4} out the receiving matrix
- * @param {mat4} a the first operand
- * @param {mat4} b the second operand
- * @returns {mat4} out
- */
- public static sub(out:mat4, a:mat4, b:mat4):mat4
-
- /**
- * Multiply each element of the matrix by a scalar.
- *
- * @param {mat4} out the receiving matrix
- * @param {mat4} a the matrix to scale
- * @param {number} b amount to scale the matrix's elements by
- * @returns {mat4} out
- */
- public static multiplyScalar(out:mat4, a:mat4, b:number):mat4
-
- /**
- * Adds two mat4's after multiplying each element of the second operand by a scalar value.
- *
- * @param {mat4} out the receiving vector
- * @param {mat4} a the first operand
- * @param {mat4} b the second operand
- * @param {number} scale the amount to scale b's elements by before adding
- * @returns {mat4} out
- */
- public static multiplyScalarAndAdd (out:mat4, a:mat4, b:mat4, scale:number):mat4
-
- /**
- * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
- *
- * @param {mat4} a The first matrix.
- * @param {mat4} b The second matrix.
- * @returns {boolean} True if the matrices are equal, false otherwise.
- */
- public static exactEquals (a:mat4, b:mat4) :boolean
-
- /**
- * Returns whether or not the matrices have approximately the same elements in the same position.
- *
- * @param {mat4} a The first matrix.
- * @param {mat4} b The second matrix.
- * @returns {boolean} True if the matrices are equal, false otherwise.
- */
- public static equals (a:mat4, b:mat4): boolean
-
-}
-
-// quat
-export class quat extends Float32Array {
- private typeQuat:number;
-
- /**
- * Creates a new identity quat
- *
- * @returns a new quaternion
- */
- public static create(): quat;
-
- /**
- * Creates a new quat initialized with values from an existing quaternion
- *
- * @param a quaternion to clone
- * @returns a new quaternion
- * @function
- */
- public static clone(a: quat): quat;
-
- /**
- * Creates a new quat initialized with the given values
- *
- * @param x X component
- * @param y Y component
- * @param z Z component
- * @param w W component
- * @returns a new quaternion
- * @function
- */
- public static fromValues(x: number, y: number, z: number, w: number): quat;
-
- /**
- * Copy the values from one quat to another
- *
- * @param out the receiving quaternion
- * @param a the source quaternion
- * @returns out
- * @function
- */
- public static copy(out: quat, a: quat): quat;
-
- /**
- * Set the components of a quat to the given values
- *
- * @param out the receiving quaternion
- * @param x X component
- * @param y Y component
- * @param z Z component
- * @param w W component
- * @returns out
- * @function
- */
- public static set(out: quat, x: number, y: number, z: number, w: number): quat;
-
- /**
- * Set a quat to the identity quaternion
- *
- * @param out the receiving quaternion
- * @returns out
- */
- public static identity(out: quat): quat;
-
- /**
- * Sets a quaternion to represent the shortest rotation from one
- * vector to another.
- *
- * Both vectors are assumed to be unit length.
- *
- * @param {quat} out the receiving quaternion.
- * @param {vec3} a the initial vector
- * @param {vec3} b the destination vector
- * @returns {quat} out
- */
- public static rotationTo (out:quat, a:vec3, b:vec3): quat;
-
- /**
- * Sets the specified quaternion with values corresponding to the given
- * axes. Each axis is a vec3 and is expected to be unit length and
- * perpendicular to all other specified axes.
- *
- * @param {vec3} view the vector representing the viewing direction
- * @param {vec3} right the vector representing the local "right" direction
- * @param {vec3} up the vector representing the local "up" direction
- * @returns {quat} out
- */
- public static setAxes (out:quat, view:vec3, right:vec3, up:vec3):quat
-
-
-
- /**
- * Sets a quat from the given angle and rotation axis,
- * then returns it.
- *
- * @param out the receiving quaternion
- * @param axis the axis around which to rotate
- * @param rad the angle in radians
- * @returns out
- **/
- public static setAxisAngle(out: quat, axis: vec3, rad: number): quat;
-
- /**
- * Gets the rotation axis and angle for a given
- * quaternion. If a quaternion is created with
- * setAxisAngle, this method will return the same
- * values as providied in the original parameter list
- * OR functionally equivalent values.
- * Example: The quaternion formed by axis [0, 0, 1] and
- * angle -90 is the same as the quaternion formed by
- * [0, 0, 1] and 270. This method favors the latter.
- * @param {vec3} out_axis Vector receiving the axis of rotation
- * @param {quat} q Quaternion to be decomposed
- * @return {number} Angle, in radians, of the rotation
- */
- public static getAxisAngle (out_axis:vec3, q:quat) :number
-
- /**
- * Adds two quat's
- *
- * @param out the receiving quaternion
- * @param a the first operand
- * @param b the second operand
- * @returns out
- * @function
- */
- public static add(out: quat, a: quat, b: quat): quat;
-
- /**
- * Multiplies two quat's
- *
- * @param out the receiving quaternion
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static multiply(out: quat, a: quat, b: quat): quat;
-
- /**
- * Multiplies two quat's
- *
- * @param out the receiving quaternion
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static mul(out: quat, a: quat, b: quat): quat;
-
- /**
- * Scales a quat by a scalar number
- *
- * @param out the receiving vector
- * @param a the vector to scale
- * @param b amount to scale the vector by
- * @returns out
- * @function
- */
- public static scale(out: quat, a: quat, b: number): quat;
-
- /**
- * Calculates the length of a quat
- *
- * @param a vector to calculate length of
- * @returns length of a
- * @function
- */
- public static length(a: quat): number;
-
- /**
- * Calculates the length of a quat
- *
- * @param a vector to calculate length of
- * @returns length of a
- * @function
- */
- public static len(a: quat): number;
-
- /**
- * Calculates the squared length of a quat
- *
- * @param a vector to calculate squared length of
- * @returns squared length of a
- * @function
- */
- public static squaredLength(a: quat): number;
-
- /**
- * Calculates the squared length of a quat
- *
- * @param a vector to calculate squared length of
- * @returns squared length of a
- * @function
- */
- public static sqrLen(a: quat): number;
-
- /**
- * Normalize a quat
- *
- * @param out the receiving quaternion
- * @param a quaternion to normalize
- * @returns out
- * @function
- */
- public static normalize(out: quat, a: quat): quat;
-
- /**
- * Calculates the dot product of two quat's
- *
- * @param a the first operand
- * @param b the second operand
- * @returns dot product of a and b
- * @function
- */
- public static dot(a: quat, b: quat): number;
-
- /**
- * Performs a linear interpolation between two quat's
- *
- * @param out the receiving quaternion
- * @param a the first operand
- * @param b the second operand
- * @param t interpolation amount between the two inputs
- * @returns out
- * @function
- */
- public static lerp(out: quat, a: quat, b: quat, t: number): quat;
-
- /**
- * Performs a spherical linear interpolation between two quat
- *
- * @param out the receiving quaternion
- * @param a the first operand
- * @param b the second operand
- * @param t interpolation amount between the two inputs
- * @returns out
- */
- public static slerp(out:quat, a:quat, b:quat, t:number): quat;
-
- /**
- * Performs a spherical linear interpolation with two control points
- *
- * @param {quat} out the receiving quaternion
- * @param {quat} a the first operand
- * @param {quat} b the second operand
- * @param {quat} c the third operand
- * @param {quat} d the fourth operand
- * @param {number} t interpolation amount
- * @returns {quat} out
- */
- public static sqlerp(out: quat, a: quat, b: quat, c: quat, d: quat, t: number): quat;
-
- /**
- * Calculates the inverse of a quat
- *
- * @param out the receiving quaternion
- * @param a quat to calculate inverse of
- * @returns out
- */
- public static invert(out: quat, a: quat): quat;
-
- /**
- * Calculates the conjugate of a quat
- * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result.
- *
- * @param out the receiving quaternion
- * @param a quat to calculate conjugate of
- * @returns out
- */
- public static conjugate(out: quat, a: quat): quat;
-
- /**
- * Returns a string representation of a quaternion
- *
- * @param a quat to represent as a string
- * @returns string representation of the quat
- */
- public static str(a: quat): string;
-
- /**
- * Rotates a quaternion by the given angle about the X axis
- *
- * @param out quat receiving operation result
- * @param a quat to rotate
- * @param rad angle (in radians) to rotate
- * @returns out
- */
- public static rotateX(out: quat, a: quat, rad: number): quat;
-
- /**
- * Rotates a quaternion by the given angle about the Y axis
- *
- * @param out quat receiving operation result
- * @param a quat to rotate
- * @param rad angle (in radians) to rotate
- * @returns out
- */
- public static rotateY(out: quat, a: quat, rad: number): quat;
-
- /**
- * Rotates a quaternion by the given angle about the Z axis
- *
- * @param out quat receiving operation result
- * @param a quat to rotate
- * @param rad angle (in radians) to rotate
- * @returns out
- */
- public static rotateZ(out: quat, a: quat, rad: number): quat;
-
- /**
- * Creates a quaternion from the given 3x3 rotation matrix.
- *
- * NOTE: The resultant quaternion is not normalized, so you should be sure
- * to renormalize the quaternion yourself where necessary.
- *
- * @param out the receiving quaternion
- * @param m rotation matrix
- * @returns out
- * @function
- */
- public static fromMat3(out: quat, m: mat3): quat;
-
- /**
- * Sets the specified quaternion with values corresponding to the given
- * axes. Each axis is a vec3 and is expected to be unit length and
- * perpendicular to all other specified axes.
- *
- * @param out the receiving quat
- * @param view the vector representing the viewing direction
- * @param right the vector representing the local "right" direction
- * @param up the vector representing the local "up" direction
- * @returns out
- */
- public static setAxes(out: quat, view: vec3, right: vec3, up: vec3): quat;
-
- /**
- * Sets a quaternion to represent the shortest rotation from one
- * vector to another.
- *
- * Both vectors are assumed to be unit length.
- *
- * @param out the receiving quaternion.
- * @param a the initial vector
- * @param b the destination vector
- * @returns out
- */
- public static rotationTo(out: quat, a: vec3, b: vec3): quat;
-
- /**
- * Calculates the W component of a quat from the X, Y, and Z components.
- * Assumes that quaternion is 1 unit in length.
- * Any existing W component will be ignored.
- *
- * @param out the receiving quaternion
- * @param a quat to calculate W component of
- * @returns out
- */
- public static calculateW(out: quat, a: quat): quat;
-
- /**
- * Returns whether or not the quaternions have exactly the same elements in the same position (when compared with ===)
- *
- * @param {quat} a The first vector.
- * @param {quat} b The second vector.
- * @returns {boolean} True if the quaternions are equal, false otherwise.
- */
- public static exactEquals (a:quat, b:quat) : boolean;
-
- /**
- * Returns whether or not the quaternions have approximately the same elements in the same position.
- *
- * @param {quat} a The first vector.
- * @param {quat} b The second vector.
- * @returns {boolean} True if the quaternions are equal, false otherwise.
- */
- public static equals (a:quat, b:quat) : boolean;
-}
diff --git a/gl-matrix/index.d.ts b/gl-matrix/index.d.ts
index 16366f263a..2edbbd8bb5 100644
--- a/gl-matrix/index.d.ts
+++ b/gl-matrix/index.d.ts
@@ -1,36 +1,18 @@
// Type definitions for gl-matrix 2.2.2
// Project: https://github.com/toji/gl-matrix
-// Definitions by: Tat
+// Definitions by: Mattijs Kneppers , based on definitions by Tat
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-declare namespace GLM {
- interface IArray
- {
- /**
- * Must be indexable like an array
- */
- [index: number]: number;
- }
-}
-
-// Common
-declare namespace glMatrix {
- /**
- * Convert Degree To Radian
- *
- * @param a Angle in Degrees
- */
- export function toRadian(a: number): number;
-}
-
// vec2
-declare namespace vec2 {
+export class vec2 extends Float32Array {
+ private typeVec2: number;
+
/**
* Creates a new, empty vec2
*
* @returns a new 2D vector
*/
- export function create(): GLM.IArray;
+ public static create(): vec2;
/**
* Creates a new vec2 initialized with values from an existing vector
@@ -38,7 +20,7 @@ declare namespace vec2 {
* @param a a vector to clone
* @returns a new 2D vector
*/
- export function clone(a: GLM.IArray): GLM.IArray;
+ public static clone(a: vec2 | number[]): vec2;
/**
* Creates a new vec2 initialized with the given values
@@ -47,7 +29,7 @@ declare namespace vec2 {
* @param y Y component
* @returns a new 2D vector
*/
- export function fromValues(x: number, y: number): GLM.IArray;
+ public static fromValues(x: number, y: number): vec2;
/**
* Copy the values from one vec2 to another
@@ -56,7 +38,7 @@ declare namespace vec2 {
* @param a the source vector
* @returns out
*/
- export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static copy(out: vec2, a: vec2 | number[]): vec2;
/**
* Set the components of a vec2 to the given values
@@ -66,7 +48,7 @@ declare namespace vec2 {
* @param y Y component
* @returns out
*/
- export function set(out: GLM.IArray, x: number, y: number): GLM.IArray;
+ public static set(out: vec2, x: number, y: number): vec2;
/**
* Adds two vec2's
@@ -76,7 +58,7 @@ declare namespace vec2 {
* @param b the second operand
* @returns out
*/
- export function add(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static add(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2;
/**
* Subtracts vector b from vector a
@@ -86,7 +68,7 @@ declare namespace vec2 {
* @param b the second operand
* @returns out
*/
- export function subtract(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static subtract(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2;
/**
* Subtracts vector b from vector a
@@ -96,7 +78,7 @@ declare namespace vec2 {
* @param b the second operand
* @returns out
*/
- export function sub(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static sub(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2;
/**
* Multiplies two vec2's
@@ -106,7 +88,7 @@ declare namespace vec2 {
* @param b the second operand
* @returns out
*/
- export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static multiply(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2;
/**
* Multiplies two vec2's
@@ -116,7 +98,7 @@ declare namespace vec2 {
* @param b the second operand
* @returns out
*/
- export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static mul(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2;
/**
* Divides two vec2's
@@ -126,7 +108,7 @@ declare namespace vec2 {
* @param b the second operand
* @returns out
*/
- export function divide(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static divide(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2;
/**
* Divides two vec2's
@@ -136,7 +118,25 @@ declare namespace vec2 {
* @param b the second operand
* @returns out
*/
- export function div(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static div(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2;
+
+ /**
+ * Math.ceil the components of a vec2
+ *
+ * @param {vec2} out the receiving vector
+ * @param {vec2} a vector to ceil
+ * @returns {vec2} out
+ */
+ public static ceil(out: vec2, a: vec2 | number[]): vec2;
+
+ /**
+ * Math.floor the components of a vec2
+ *
+ * @param {vec2} out the receiving vector
+ * @param {vec2} a vector to floor
+ * @returns {vec2} out
+ */
+ public static floor (out: vec2, a: vec2 | number[]): vec2;
/**
* Returns the minimum of two vec2's
@@ -146,7 +146,7 @@ declare namespace vec2 {
* @param b the second operand
* @returns out
*/
- export function min(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static min(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2;
/**
* Returns the maximum of two vec2's
@@ -156,7 +156,17 @@ declare namespace vec2 {
* @param b the second operand
* @returns out
*/
- export function max(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static max(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2;
+
+ /**
+ * Math.round the components of a vec2
+ *
+ * @param {vec2} out the receiving vector
+ * @param {vec2} a vector to round
+ * @returns {vec2} out
+ */
+ public static round(out: vec2, a: vec2 | number[]): vec2;
+
/**
* Scales a vec2 by a scalar number
@@ -166,7 +176,7 @@ declare namespace vec2 {
* @param b amount to scale the vector by
* @returns out
*/
- export function scale(out: GLM.IArray, a: GLM.IArray, b: number): GLM.IArray;
+ public static scale(out: vec2, a: vec2 | number[], b: number): vec2;
/**
* Adds two vec2's after scaling the second operand by a scalar value
@@ -177,7 +187,7 @@ declare namespace vec2 {
* @param scale the amount to scale b by before adding
* @returns out
*/
- export function scaleAndAdd(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, scale: number): GLM.IArray;
+ public static scaleAndAdd(out: vec2, a: vec2 | number[], b: vec2 | number[], scale: number): vec2;
/**
* Calculates the euclidian distance between two vec2's
@@ -186,7 +196,7 @@ declare namespace vec2 {
* @param b the second operand
* @returns distance between a and b
*/
- export function distance(a: GLM.IArray, b: GLM.IArray): number;
+ public static distance(a: vec2 | number[], b: vec2 | number[]): number;
/**
* Calculates the euclidian distance between two vec2's
@@ -195,7 +205,7 @@ declare namespace vec2 {
* @param b the second operand
* @returns distance between a and b
*/
- export function dist(a: GLM.IArray, b: GLM.IArray): number;
+ public static dist(a: vec2 | number[], b: vec2 | number[]): number;
/**
* Calculates the squared euclidian distance between two vec2's
@@ -204,7 +214,7 @@ declare namespace vec2 {
* @param b the second operand
* @returns squared distance between a and b
*/
- export function squaredDistance(a: GLM.IArray, b: GLM.IArray): number;
+ public static squaredDistance(a: vec2 | number[], b: vec2 | number[]): number;
/**
* Calculates the squared euclidian distance between two vec2's
@@ -213,7 +223,7 @@ declare namespace vec2 {
* @param b the second operand
* @returns squared distance between a and b
*/
- export function sqrDist(a: GLM.IArray, b: GLM.IArray): number;
+ public static sqrDist(a: vec2 | number[], b: vec2 | number[]): number;
/**
* Calculates the length of a vec2
@@ -221,7 +231,7 @@ declare namespace vec2 {
* @param a vector to calculate length of
* @returns length of a
*/
- export function length(a: GLM.IArray): number;
+ public static length(a: vec2 | number[]): number;
/**
* Calculates the length of a vec2
@@ -229,7 +239,7 @@ declare namespace vec2 {
* @param a vector to calculate length of
* @returns length of a
*/
- export function len(a: GLM.IArray): number;
+ public static len(a: vec2 | number[]): number;
/**
* Calculates the squared length of a vec2
@@ -237,7 +247,7 @@ declare namespace vec2 {
* @param a vector to calculate squared length of
* @returns squared length of a
*/
- export function squaredLength(a: GLM.IArray): number;
+ public static squaredLength(a: vec2 | number[]): number;
/**
* Calculates the squared length of a vec2
@@ -245,7 +255,7 @@ declare namespace vec2 {
* @param a vector to calculate squared length of
* @returns squared length of a
*/
- export function sqrLen(a: GLM.IArray): number;
+ public static sqrLen(a: vec2 | number[]): number;
/**
* Negates the components of a vec2
@@ -254,7 +264,7 @@ declare namespace vec2 {
* @param a vector to negate
* @returns out
*/
- export function negate(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static negate(out: vec2, a: vec2 | number[]): vec2;
/**
* Returns the inverse of the components of a vec2
@@ -263,7 +273,7 @@ declare namespace vec2 {
* @param a vector to invert
* @returns out
*/
- export function inverse(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static inverse(out: vec2, a: vec2 | number[]): vec2;
/**
* Normalize a vec2
@@ -272,7 +282,7 @@ declare namespace vec2 {
* @param a vector to normalize
* @returns out
*/
- export function normalize(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static normalize(out: vec2, a: vec2 | number[]): vec2;
/**
* Calculates the dot product of two vec2's
@@ -281,7 +291,7 @@ declare namespace vec2 {
* @param b the second operand
* @returns dot product of a and b
*/
- export function dot(a: GLM.IArray, b: GLM.IArray): number;
+ public static dot(a: vec2 | number[], b: vec2 | number[]): number;
/**
* Computes the cross product of two vec2's
@@ -292,7 +302,7 @@ declare namespace vec2 {
* @param b the second operand
* @returns out
*/
- export function cross(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static cross(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2;
/**
* Performs a linear interpolation between two vec2's
@@ -303,7 +313,7 @@ declare namespace vec2 {
* @param t interpolation amount between the two inputs
* @returns out
*/
- export function lerp(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, t: number): GLM.IArray;
+ public static lerp(out: vec2, a: vec2 | number[], b: vec2 | number[], t: number): vec2;
/**
* Generates a random unit vector
@@ -311,7 +321,7 @@ declare namespace vec2 {
* @param out the receiving vector
* @returns out
*/
- export function random(out: GLM.IArray): GLM.IArray;
+ public static random(out: vec2): vec2;
/**
* Generates a random vector with the given scale
@@ -320,7 +330,7 @@ declare namespace vec2 {
* @param scale Length of the resulting vector. If ommitted, a unit vector will be returned
* @returns out
*/
- export function random(out: GLM.IArray, scale: number): GLM.IArray;
+ public static random(out: vec2, scale: number): vec2;
/**
* Transforms the vec2 with a mat2
@@ -330,7 +340,7 @@ declare namespace vec2 {
* @param m matrix to transform with
* @returns out
*/
- export function transformMat2(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray;
+ public static transformMat2(out: vec2, a: vec2 | number[], m: mat2): vec2;
/**
* Transforms the vec2 with a mat2d
@@ -340,7 +350,7 @@ declare namespace vec2 {
* @param m matrix to transform with
* @returns out
*/
- export function transformMat2d(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray;
+ public static transformMat2d(out: vec2, a: vec2 | number[], m: mat2d): vec2;
/**
* Transforms the vec2 with a mat3
@@ -351,7 +361,7 @@ declare namespace vec2 {
* @param m matrix to transform with
* @returns out
*/
- export function transformMat3(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray;
+ public static transformMat3(out: vec2, a: vec2 | number[], m: mat3): vec2;
/**
* Transforms the vec2 with a mat4
@@ -363,7 +373,7 @@ declare namespace vec2 {
* @param m matrix to transform with
* @returns out
*/
- export function transformMat4(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray;
+ public static transformMat4(out: vec2, a: vec2 | number[], m: mat4): vec2;
/**
* Perform some operation over an array of vec2s.
@@ -376,8 +386,8 @@ declare namespace vec2 {
* @param arg additional argument to pass to fn
* @returns a
*/
- export function forEach(a: GLM.IArray, stride: number, offset: number, count: number,
- fn: (a: GLM.IArray, b: GLM.IArray, arg: any) => void, arg: any): GLM.IArray;
+ public static forEach(a: Float32Array, stride: number, offset: number, count: number,
+ fn: (a: vec2 | number[], b: vec2 | number[], arg: any) => void, arg: any): Float32Array;
/**
* Perform some operation over an array of vec2s.
@@ -389,27 +399,46 @@ declare namespace vec2 {
* @param fn Function to call for each vector in the array
* @returns a
*/
- export function forEach(a: GLM.IArray, stride: number, offset: number, count: number,
- fn: (a: GLM.IArray, b: GLM.IArray) => void): GLM.IArray;
+ public static forEach(a: Float32Array, stride: number, offset: number, count: number,
+ fn: (a: vec2 | number[], b: vec2 | number[]) => void): Float32Array;
/**
* Returns a string representation of a vector
*
- * @param vec vector to represent as a string
+ * @param a vector to represent as a string
* @returns string representation of the vector
*/
- export function str(a: GLM.IArray): string;
+ public static str(a: vec2 | number[]): string;
+
+ /**
+ * Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===)
+ *
+ * @param {vec2} a The first vector.
+ * @param {vec2} b The second vector.
+ * @returns {boolean} True if the vectors are equal, false otherwise.
+ */
+ public static exactEquals (a: vec2 | number[], b: vec2 | number[]): boolean;
+
+ /**
+ * Returns whether or not the vectors have approximately the same elements in the same position.
+ *
+ * @param {vec2} a The first vector.
+ * @param {vec2} b The second vector.
+ * @returns {boolean} True if the vectors are equal, false otherwise.
+ */
+ public static equals (a: vec2 | number[], b: vec2 | number[]): boolean;
}
// vec3
-declare namespace vec3 {
+export class vec3 extends Float32Array {
+ private typeVec3: number;
/**
* Creates a new, empty vec3
*
* @returns a new 3D vector
*/
- export function create(): GLM.IArray;
+ public static create(): vec3;
/**
* Creates a new vec3 initialized with values from an existing vector
@@ -417,7 +446,7 @@ declare namespace vec3 {
* @param a vector to clone
* @returns a new 3D vector
*/
- export function clone(a: GLM.IArray): GLM.IArray;
+ public static clone(a: vec3 | number[]): vec3;
/**
* Creates a new vec3 initialized with the given values
@@ -427,7 +456,7 @@ declare namespace vec3 {
* @param z Z component
* @returns a new 3D vector
*/
- export function fromValues(x: number, y: number, z: number): GLM.IArray;
+ public static fromValues(x: number, y: number, z: number): vec3;
/**
* Copy the values from one vec3 to another
@@ -436,7 +465,7 @@ declare namespace vec3 {
* @param a the source vector
* @returns out
*/
- export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static copy(out: vec3, a: vec3 | number[]): vec3;
/**
* Set the components of a vec3 to the given values
@@ -447,7 +476,7 @@ declare namespace vec3 {
* @param z Z component
* @returns out
*/
- export function set(out: GLM.IArray, x: number, y: number, z: number): GLM.IArray;
+ public static set(out: vec3, x: number, y: number, z: number): vec3;
/**
* Adds two vec3's
@@ -457,7 +486,7 @@ declare namespace vec3 {
* @param b the second operand
* @returns out
*/
- export function add(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static add(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3;
/**
* Subtracts vector b from vector a
@@ -467,7 +496,7 @@ declare namespace vec3 {
* @param b the second operand
* @returns out
*/
- export function subtract(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static subtract(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3;
/**
* Subtracts vector b from vector a
@@ -477,7 +506,7 @@ declare namespace vec3 {
* @param b the second operand
* @returns out
*/
- export function sub(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray
+ public static sub(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3
/**
* Multiplies two vec3's
@@ -487,7 +516,7 @@ declare namespace vec3 {
* @param b the second operand
* @returns out
*/
- export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static multiply(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3;
/**
* Multiplies two vec3's
@@ -497,7 +526,7 @@ declare namespace vec3 {
* @param b the second operand
* @returns out
*/
- export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static mul(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3;
/**
* Divides two vec3's
@@ -507,7 +536,7 @@ declare namespace vec3 {
* @param b the second operand
* @returns out
*/
- export function divide(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static divide(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3;
/**
* Divides two vec3's
@@ -517,7 +546,25 @@ declare namespace vec3 {
* @param b the second operand
* @returns out
*/
- export function div(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static div(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3;
+
+ /**
+ * Math.ceil the components of a vec3
+ *
+ * @param {vec3} out the receiving vector
+ * @param {vec3} a vector to ceil
+ * @returns {vec3} out
+ */
+ public static ceil (out: vec3, a: vec3 | number[]): vec3;
+
+ /**
+ * Math.floor the components of a vec3
+ *
+ * @param {vec3} out the receiving vector
+ * @param {vec3} a vector to floor
+ * @returns {vec3} out
+ */
+ public static floor (out: vec3, a: vec3 | number[]): vec3;
/**
* Returns the minimum of two vec3's
@@ -527,7 +574,7 @@ declare namespace vec3 {
* @param b the second operand
* @returns out
*/
- export function min(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static min(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3;
/**
* Returns the maximum of two vec3's
@@ -537,7 +584,16 @@ declare namespace vec3 {
* @param b the second operand
* @returns out
*/
- export function max(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static max(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3;
+
+ /**
+ * Math.round the components of a vec3
+ *
+ * @param {vec3} out the receiving vector
+ * @param {vec3} a vector to round
+ * @returns {vec3} out
+ */
+ public static round (out: vec3, a: vec3 | number[]): vec3
/**
* Scales a vec3 by a scalar number
@@ -547,7 +603,7 @@ declare namespace vec3 {
* @param b amount to scale the vector by
* @returns out
*/
- export function scale(out: GLM.IArray, a: GLM.IArray, b: number): GLM.IArray;
+ public static scale(out: vec3, a: vec3 | number[], b: number): vec3;
/**
* Adds two vec3's after scaling the second operand by a scalar value
@@ -558,7 +614,7 @@ declare namespace vec3 {
* @param scale the amount to scale b by before adding
* @returns out
*/
- export function scaleAndAdd(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, scale: number): GLM.IArray;
+ public static scaleAndAdd(out: vec3, a: vec3 | number[], b: vec3 | number[], scale: number): vec3;
/**
* Calculates the euclidian distance between two vec3's
@@ -567,7 +623,7 @@ declare namespace vec3 {
* @param b the second operand
* @returns distance between a and b
*/
- export function distance(a: GLM.IArray, b: GLM.IArray): number;
+ public static distance(a: vec3 | number[], b: vec3 | number[]): number;
/**
* Calculates the euclidian distance between two vec3's
@@ -576,7 +632,7 @@ declare namespace vec3 {
* @param b the second operand
* @returns distance between a and b
*/
- export function dist(a: GLM.IArray, b: GLM.IArray): number;
+ public static dist(a: vec3 | number[], b: vec3 | number[]): number;
/**
* Calculates the squared euclidian distance between two vec3's
@@ -585,7 +641,7 @@ declare namespace vec3 {
* @param b the second operand
* @returns squared distance between a and b
*/
- export function squaredDistance(a: GLM.IArray, b: GLM.IArray): number;
+ public static squaredDistance(a: vec3 | number[], b: vec3 | number[]): number;
/**
* Calculates the squared euclidian distance between two vec3's
@@ -594,7 +650,7 @@ declare namespace vec3 {
* @param b the second operand
* @returns squared distance between a and b
*/
- export function sqrDist(a: GLM.IArray, b: GLM.IArray): number;
+ public static sqrDist(a: vec3 | number[], b: vec3 | number[]): number;
/**
* Calculates the length of a vec3
@@ -602,7 +658,7 @@ declare namespace vec3 {
* @param a vector to calculate length of
* @returns length of a
*/
- export function length(a: GLM.IArray): number;
+ public static length(a: vec3 | number[]): number;
/**
* Calculates the length of a vec3
@@ -610,7 +666,7 @@ declare namespace vec3 {
* @param a vector to calculate length of
* @returns length of a
*/
- export function len(a: GLM.IArray): number;
+ public static len(a: vec3 | number[]): number;
/**
* Calculates the squared length of a vec3
@@ -618,7 +674,7 @@ declare namespace vec3 {
* @param a vector to calculate squared length of
* @returns squared length of a
*/
- export function squaredLength(a: GLM.IArray): number;
+ public static squaredLength(a: vec3 | number[]): number;
/**
* Calculates the squared length of a vec3
@@ -626,7 +682,7 @@ declare namespace vec3 {
* @param a vector to calculate squared length of
* @returns squared length of a
*/
- export function sqrLen(a: GLM.IArray): number;
+ public static sqrLen(a: vec3 | number[]): number;
/**
* Negates the components of a vec3
@@ -635,7 +691,7 @@ declare namespace vec3 {
* @param a vector to negate
* @returns out
*/
- export function negate(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static negate(out: vec3, a: vec3 | number[]): vec3;
/**
* Returns the inverse of the components of a vec3
@@ -644,7 +700,7 @@ declare namespace vec3 {
* @param a vector to invert
* @returns out
*/
- export function inverse(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static inverse(out: vec3, a: vec3 | number[]): vec3;
/**
* Normalize a vec3
@@ -653,7 +709,7 @@ declare namespace vec3 {
* @param a vector to normalize
* @returns out
*/
- export function normalize(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static normalize(out: vec3, a: vec3 | number[]): vec3;
/**
* Calculates the dot product of two vec3's
@@ -662,7 +718,7 @@ declare namespace vec3 {
* @param b the second operand
* @returns dot product of a and b
*/
- export function dot(a: GLM.IArray, b: GLM.IArray): number;
+ public static dot(a: vec3 | number[], b: vec3 | number[]): number;
/**
* Computes the cross product of two vec3's
@@ -672,7 +728,7 @@ declare namespace vec3 {
* @param b the second operand
* @returns out
*/
- export function cross(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static cross(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3;
/**
* Performs a linear interpolation between two vec3's
@@ -683,7 +739,33 @@ declare namespace vec3 {
* @param t interpolation amount between the two inputs
* @returns out
*/
- export function lerp(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, t: number): GLM.IArray;
+ public static lerp(out: vec3, a: vec3 | number[], b: vec3 | number[], t: number): vec3;
+
+ /**
+ * Performs a hermite interpolation with two control points
+ *
+ * @param {vec3} out the receiving vector
+ * @param {vec3} a the first operand
+ * @param {vec3} b the second operand
+ * @param {vec3} c the third operand
+ * @param {vec3} d the fourth operand
+ * @param {number} t interpolation amount between the two inputs
+ * @returns {vec3} out
+ */
+ public static hermite (out: vec3, a: vec3 | number[], b: vec3 | number[], c: vec3 | number[], d: vec3 | number[], t: number): vec3;
+
+ /**
+ * Performs a bezier interpolation with two control points
+ *
+ * @param {vec3} out the receiving vector
+ * @param {vec3} a the first operand
+ * @param {vec3} b the second operand
+ * @param {vec3} c the third operand
+ * @param {vec3} d the fourth operand
+ * @param {number} t interpolation amount between the two inputs
+ * @returns {vec3} out
+ */
+ public static bezier (out: vec3, a: vec3 | number[], b: vec3 | number[], c: vec3 | number[], d: vec3 | number[], t: number): vec3;
/**
* Generates a random unit vector
@@ -691,46 +773,16 @@ declare namespace vec3 {
* @param out the receiving vector
* @returns out
*/
- export function random(out: GLM.IArray): GLM.IArray;
+ public static random(out: vec3): vec3;
/**
* Generates a random vector with the given scale
*
* @param out the receiving vector
- * @param [scale] Length of the resulting vector. If ommitted, a unit vector will be returned
+ * @param [scale] Length of the resulting vector. If omitted, a unit vector will be returned
* @returns out
*/
- export function random(out: GLM.IArray, scale: number): GLM.IArray;
-
- /**
- * Rotate a 3D vector around the x-axis
- * @param out The receiving vec3
- * @param a The vec3 point to rotate
- * @param b The origin of the rotation
- * @param c The angle of rotation
- * @returns out
- */
- export function rotateX(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, c: number): GLM.IArray;
-
- /**
- * Rotate a 3D vector around the y-axis
- * @param out The receiving vec3
- * @param a The vec3 point to rotate
- * @param b The origin of the rotation
- * @param c The angle of rotation
- * @returns out
- */
- export function rotateY(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, c: number): GLM.IArray;
-
- /**
- * Rotate a 3D vector around the z-axis
- * @param out The receiving vec3
- * @param a The vec3 point to rotate
- * @param b The origin of the rotation
- * @param c The angle of rotation
- * @returns out
- */
- export function rotateZ(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, c: number): GLM.IArray;
+ public static random(out: vec3, scale: number): vec3;
/**
* Transforms the vec3 with a mat3.
@@ -740,7 +792,7 @@ declare namespace vec3 {
* @param m the 3x3 matrix to transform with
* @returns out
*/
- export function transformMat3(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray;
+ public static transformMat3(out: vec3, a: vec3 | number[], m: mat3): vec3;
/**
* Transforms the vec3 with a mat4.
@@ -751,9 +803,9 @@ declare namespace vec3 {
* @param m matrix to transform with
* @returns out
*/
- export function transformMat4(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray;
+ public static transformMat4(out: vec3, a: vec3 | number[], m: mat4): vec3;
- /**
+ /**
* Transforms the vec3 with a quat
*
* @param out the receiving vector
@@ -761,9 +813,39 @@ declare namespace vec3 {
* @param q quaternion to transform with
* @returns out
*/
- export function transformQuat(out: GLM.IArray, a: GLM.IArray, q: GLM.IArray): GLM.IArray;
+ public static transformQuat(out: vec3, a: vec3 | number[], q: quat): vec3;
+ /**
+ * Rotate a 3D vector around the x-axis
+ * @param out The receiving vec3
+ * @param a The vec3 point to rotate
+ * @param b The origin of the rotation
+ * @param c The angle of rotation
+ * @returns out
+ */
+ public static rotateX(out: vec3, a: vec3 | number[], b: vec3 | number[], c: number): vec3;
+
+ /**
+ * Rotate a 3D vector around the y-axis
+ * @param out The receiving vec3
+ * @param a The vec3 point to rotate
+ * @param b The origin of the rotation
+ * @param c The angle of rotation
+ * @returns out
+ */
+ public static rotateY(out: vec3, a: vec3 | number[], b: vec3 | number[], c: number): vec3;
+
+ /**
+ * Rotate a 3D vector around the z-axis
+ * @param out The receiving vec3
+ * @param a The vec3 point to rotate
+ * @param b The origin of the rotation
+ * @param c The angle of rotation
+ * @returns out
+ */
+ public static rotateZ(out: vec3, a: vec3 | number[], b: vec3 | number[], c: number): vec3;
+
/**
* Perform some operation over an array of vec3s.
*
@@ -776,8 +858,8 @@ declare namespace vec3 {
* @returns a
* @function
*/
- export function forEach(out: GLM.IArray, string: number, offset: number, count: number,
- fn: (a: GLM.IArray, b: GLM.IArray, arg: any) => void, arg: any): GLM.IArray;
+ public static forEach(a: Float32Array, stride: number, offset: number, count: number,
+ fn: (a: vec3 | number[], b: vec3 | number[], arg: any) => void, arg: any): Float32Array;
/**
* Perform some operation over an array of vec3s.
@@ -790,8 +872,8 @@ declare namespace vec3 {
* @returns a
* @function
*/
- export function forEach(out: GLM.IArray, string: number, offset: number, count: number,
- fn: (a: GLM.IArray, b: GLM.IArray) => void): GLM.IArray;
+ public static forEach(a: Float32Array, stride: number, offset: number, count: number,
+ fn: (a: vec3 | number[], b: vec3 | number[]) => void): Float32Array;
/**
* Get the angle between two 3D vectors
@@ -799,26 +881,45 @@ declare namespace vec3 {
* @param b The second operand
* @returns The angle in radians
*/
- export function angle(a: GLM.IArray, b: GLM.IArray): number;
+ public static angle(a: vec3 | number[], b: vec3 | number[]): number;
/**
* Returns a string representation of a vector
*
- * @param vec vector to represent as a string
+ * @param a vector to represent as a string
* @returns string representation of the vector
*/
- export function str(a: GLM.IArray): string;
+ public static str(a: vec3 | number[]): string;
+
+ /**
+ * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)
+ *
+ * @param {vec3} a The first vector.
+ * @param {vec3} b The second vector.
+ * @returns {boolean} True if the vectors are equal, false otherwise.
+ */
+ public static exactEquals (a: vec3 | number[], b: vec3 | number[]): boolean
+
+ /**
+ * Returns whether or not the vectors have approximately the same elements in the same position.
+ *
+ * @param {vec3} a The first vector.
+ * @param {vec3} b The second vector.
+ * @returns {boolean} True if the vectors are equal, false otherwise.
+ */
+ public static equals (a: vec3 | number[], b: vec3 | number[]): boolean
}
// vec4
-declare namespace vec4 {
+export class vec4 extends Float32Array {
+ private typeVec3: number;
/**
* Creates a new, empty vec4
*
* @returns a new 4D vector
*/
- export function create(): GLM.IArray;
+ public static create(): vec4;
/**
* Creates a new vec4 initialized with values from an existing vector
@@ -826,7 +927,7 @@ declare namespace vec4 {
* @param a vector to clone
* @returns a new 4D vector
*/
- export function clone(a: GLM.IArray): GLM.IArray;
+ public static clone(a: vec4 | number[]): vec4;
/**
* Creates a new vec4 initialized with the given values
@@ -837,7 +938,7 @@ declare namespace vec4 {
* @param w W component
* @returns a new 4D vector
*/
- export function fromValues(x: number, y: number, z: number, w: number): GLM.IArray;
+ public static fromValues(x: number, y: number, z: number, w: number): vec4;
/**
* Copy the values from one vec4 to another
@@ -846,7 +947,7 @@ declare namespace vec4 {
* @param a the source vector
* @returns out
*/
- export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static copy(out: vec4, a: vec4 | number[]): vec4;
/**
* Set the components of a vec4 to the given values
@@ -858,7 +959,7 @@ declare namespace vec4 {
* @param w W component
* @returns out
*/
- export function set(out: GLM.IArray, x: number, y: number, z: number, w: number): GLM.IArray;
+ public static set(out: vec4, x: number, y: number, z: number, w: number): vec4;
/**
* Adds two vec4's
@@ -868,7 +969,7 @@ declare namespace vec4 {
* @param b the second operand
* @returns out
*/
- export function add(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static add(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4;
/**
* Subtracts vector b from vector a
@@ -878,7 +979,7 @@ declare namespace vec4 {
* @param b the second operand
* @returns out
*/
- export function subtract(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static subtract(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4;
/**
* Subtracts vector b from vector a
@@ -888,7 +989,7 @@ declare namespace vec4 {
* @param b the second operand
* @returns out
*/
- export function sub(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static sub(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4;
/**
* Multiplies two vec4's
@@ -898,7 +999,7 @@ declare namespace vec4 {
* @param b the second operand
* @returns out
*/
- export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static multiply(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4;
/**
* Multiplies two vec4's
@@ -908,7 +1009,7 @@ declare namespace vec4 {
* @param b the second operand
* @returns out
*/
- export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static mul(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4;
/**
* Divides two vec4's
@@ -918,7 +1019,7 @@ declare namespace vec4 {
* @param b the second operand
* @returns out
*/
- export function divide(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static divide(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4;
/**
* Divides two vec4's
@@ -928,7 +1029,25 @@ declare namespace vec4 {
* @param b the second operand
* @returns out
*/
- export function div(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static div(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4;
+
+ /**
+ * Math.ceil the components of a vec4
+ *
+ * @param {vec4} out the receiving vector
+ * @param {vec4} a vector to ceil
+ * @returns {vec4} out
+ */
+ public static ceil (out: vec4, a: vec4 | number[]): vec4;
+
+ /**
+ * Math.floor the components of a vec4
+ *
+ * @param {vec4} out the receiving vector
+ * @param {vec4} a vector to floor
+ * @returns {vec4} out
+ */
+ public static floor (out: vec4, a: vec4 | number[]): vec4;
/**
* Returns the minimum of two vec4's
@@ -938,7 +1057,7 @@ declare namespace vec4 {
* @param b the second operand
* @returns out
*/
- export function min(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static min(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4;
/**
* Returns the maximum of two vec4's
@@ -948,7 +1067,16 @@ declare namespace vec4 {
* @param b the second operand
* @returns out
*/
- export function max(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static max(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4;
+
+ /**
+ * Math.round the components of a vec4
+ *
+ * @param {vec4} out the receiving vector
+ * @param {vec4} a vector to round
+ * @returns {vec4} out
+ */
+ public static round (out: vec4, a: vec4 | number[]): vec4;
/**
* Scales a vec4 by a scalar number
@@ -958,7 +1086,7 @@ declare namespace vec4 {
* @param b amount to scale the vector by
* @returns out
*/
- export function scale(out: GLM.IArray, a: GLM.IArray, b: number): GLM.IArray;
+ public static scale(out: vec4, a: vec4 | number[], b: number): vec4;
/**
* Adds two vec4's after scaling the second operand by a scalar value
@@ -969,7 +1097,7 @@ declare namespace vec4 {
* @param scale the amount to scale b by before adding
* @returns out
*/
- export function scaleAndAdd(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, scale: number): GLM.IArray;
+ public static scaleAndAdd(out: vec4, a: vec4 | number[], b: vec4 | number[], scale: number): vec4;
/**
* Calculates the euclidian distance between two vec4's
@@ -978,7 +1106,7 @@ declare namespace vec4 {
* @param b the second operand
* @returns distance between a and b
*/
- export function distance(a: GLM.IArray, b: GLM.IArray): number;
+ public static distance(a: vec4 | number[], b: vec4 | number[]): number;
/**
* Calculates the euclidian distance between two vec4's
@@ -987,7 +1115,7 @@ declare namespace vec4 {
* @param b the second operand
* @returns distance between a and b
*/
- export function dist(a: GLM.IArray, b: GLM.IArray): number;
+ public static dist(a: vec4 | number[], b: vec4 | number[]): number;
/**
* Calculates the squared euclidian distance between two vec4's
@@ -996,7 +1124,7 @@ declare namespace vec4 {
* @param b the second operand
* @returns squared distance between a and b
*/
- export function squaredDistance(a: GLM.IArray, b: GLM.IArray): number;
+ public static squaredDistance(a: vec4 | number[], b: vec4 | number[]): number;
/**
* Calculates the squared euclidian distance between two vec4's
@@ -1005,7 +1133,7 @@ declare namespace vec4 {
* @param b the second operand
* @returns squared distance between a and b
*/
- export function sqrDist(a: GLM.IArray, b: GLM.IArray): number;
+ public static sqrDist(a: vec4 | number[], b: vec4 | number[]): number;
/**
* Calculates the length of a vec4
@@ -1013,7 +1141,7 @@ declare namespace vec4 {
* @param a vector to calculate length of
* @returns length of a
*/
- export function length(a: GLM.IArray): number;
+ public static length(a: vec4 | number[]): number;
/**
* Calculates the length of a vec4
@@ -1021,7 +1149,7 @@ declare namespace vec4 {
* @param a vector to calculate length of
* @returns length of a
*/
- export function len(a: GLM.IArray): number;
+ public static len(a: vec4 | number[]): number;
/**
* Calculates the squared length of a vec4
@@ -1029,7 +1157,7 @@ declare namespace vec4 {
* @param a vector to calculate squared length of
* @returns squared length of a
*/
- export function squaredLength(a: GLM.IArray): number;
+ public static squaredLength(a: vec4 | number[]): number;
/**
* Calculates the squared length of a vec4
@@ -1037,7 +1165,7 @@ declare namespace vec4 {
* @param a vector to calculate squared length of
* @returns squared length of a
*/
- export function sqrLen(a: GLM.IArray): number;
+ public static sqrLen(a: vec4 | number[]): number;
/**
* Negates the components of a vec4
@@ -1046,7 +1174,7 @@ declare namespace vec4 {
* @param a vector to negate
* @returns out
*/
- export function negate(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static negate(out: vec4, a: vec4 | number[]): vec4;
/**
* Returns the inverse of the components of a vec4
@@ -1055,7 +1183,7 @@ declare namespace vec4 {
* @param a vector to invert
* @returns out
*/
- export function inverse(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static inverse(out: vec4, a: vec4 | number[]): vec4;
/**
* Normalize a vec4
@@ -1064,7 +1192,7 @@ declare namespace vec4 {
* @param a vector to normalize
* @returns out
*/
- export function normalize(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static normalize(out: vec4, a: vec4 | number[]): vec4;
/**
* Calculates the dot product of two vec4's
@@ -1073,7 +1201,7 @@ declare namespace vec4 {
* @param b the second operand
* @returns dot product of a and b
*/
- export function dot(a: GLM.IArray, b: GLM.IArray): number;
+ public static dot(a: vec4 | number[], b: vec4 | number[]): number;
/**
* Performs a linear interpolation between two vec4's
@@ -1084,7 +1212,7 @@ declare namespace vec4 {
* @param t interpolation amount between the two inputs
* @returns out
*/
- export function lerp(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, t: number): GLM.IArray;
+ public static lerp(out: vec4, a: vec4 | number[], b: vec4 | number[], t: number): vec4;
/**
* Generates a random unit vector
@@ -1092,16 +1220,16 @@ declare namespace vec4 {
* @param out the receiving vector
* @returns out
*/
- export function random(out: GLM.IArray): GLM.IArray;
+ public static random(out: vec4): vec4;
/**
* Generates a random vector with the given scale
*
* @param out the receiving vector
- * @param Length of the resulting vector. If ommitted, a unit vector will be returned
+ * @param scale length of the resulting vector. If ommitted, a unit vector will be returned
* @returns out
*/
- export function random(out: GLM.IArray, scale: number): GLM.IArray;
+ public static random(out: vec4, scale: number): vec4;
/**
* Transforms the vec4 with a mat4.
@@ -1111,7 +1239,7 @@ declare namespace vec4 {
* @param m matrix to transform with
* @returns out
*/
- export function transformMat4(out: GLM.IArray, a: GLM.IArray, mat: GLM.IArray): GLM.IArray;
+ public static transformMat4(out: vec4, a: vec4 | number[], m: mat4): vec4;
/**
* Transforms the vec4 with a quat
@@ -1121,7 +1249,8 @@ declare namespace vec4 {
* @param q quaternion to transform with
* @returns out
*/
- export function transformQuat(out: GLM.IArray, a: GLM.IArray, quat: GLM.IArray): GLM.IArray;
+
+ public static transformQuat(out: vec4, a: vec4 | number[], q: quat): vec4;
/**
* Perform some operation over an array of vec4s.
@@ -1131,12 +1260,12 @@ declare namespace vec4 {
* @param offset Number of elements to skip at the beginning of the array
* @param count Number of vec4s to iterate over. If 0 iterates over entire array
* @param fn Function to call for each vector in the array
- * @param additional argument to pass to fn
+ * @param arg additional argument to pass to fn
* @returns a
* @function
*/
- export function forEach(out: GLM.IArray, string: number, offset: number, count: number,
- callback: (a: GLM.IArray, b: GLM.IArray, arg: any) => void, arg: any): GLM.IArray;
+ public static forEach(a: Float32Array, stride: number, offset: number, count: number,
+ fn: (a: vec4 | number[], b: vec4 | number[], arg: any) => void, arg: any): Float32Array;
/**
* Perform some operation over an array of vec4s.
@@ -1149,27 +1278,46 @@ declare namespace vec4 {
* @returns a
* @function
*/
- export function forEach(out: GLM.IArray, string: number, offset: number, count: number,
- callback: (a: GLM.IArray, b: GLM.IArray) => void): GLM.IArray;
+ public static forEach(a: Float32Array, stride: number, offset: number, count: number,
+ fn: (a: vec4 | number[], b: vec4 | number[]) => void): Float32Array;
/**
* Returns a string representation of a vector
*
- * @param vec vector to represent as a string
+ * @param a vector to represent as a string
* @returns string representation of the vector
*/
- export function str(a: GLM.IArray): string;
+ public static str(a: vec4 | number[]): string;
+
+ /**
+ * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)
+ *
+ * @param {vec4} a The first vector.
+ * @param {vec4} b The second vector.
+ * @returns {boolean} True if the vectors are equal, false otherwise.
+ */
+ public static exactEquals (a: vec4 | number[], b: vec4 | number[]): boolean;
+
+ /**
+ * Returns whether or not the vectors have approximately the same elements in the same position.
+ *
+ * @param {vec4} a The first vector.
+ * @param {vec4} b The second vector.
+ * @returns {boolean} True if the vectors are equal, false otherwise.
+ */
+ public static equals (a: vec4 | number[], b: vec4 | number[]): boolean;
}
// mat2
-declare namespace mat2 {
+export class mat2 extends Float32Array {
+ private typeMat2: number;
/**
* Creates a new identity mat2
*
* @returns a new 2x2 matrix
*/
- export function create(): GLM.IArray;
+ public static create(): mat2;
/**
* Creates a new mat2 initialized with values from an existing matrix
@@ -1177,7 +1325,7 @@ declare namespace mat2 {
* @param a matrix to clone
* @returns a new 2x2 matrix
*/
- export function clone(a: GLM.IArray): GLM.IArray;
+ public static clone(a: mat2): mat2;
/**
* Copy the values from one mat2 to another
@@ -1186,7 +1334,7 @@ declare namespace mat2 {
* @param a the source matrix
* @returns out
*/
- export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static copy(out: mat2, a: mat2): mat2;
/**
* Set a mat2 to the identity matrix
@@ -1194,7 +1342,30 @@ declare namespace mat2 {
* @param out the receiving matrix
* @returns out
*/
- export function identity(out: GLM.IArray): GLM.IArray;
+ public static identity(out: mat2): mat2;
+
+ /**
+ * Create a new mat2 with the given values
+ *
+ * @param {number} m00 Component in column 0, row 0 position (index 0)
+ * @param {number} m01 Component in column 0, row 1 position (index 1)
+ * @param {number} m10 Component in column 1, row 0 position (index 2)
+ * @param {number} m11 Component in column 1, row 1 position (index 3)
+ * @returns {mat2} out A new 2x2 matrix
+ */
+ public static fromValues(m00: number, m01: number, m10: number, m11: number): mat2;
+
+ /**
+ * Set the components of a mat2 to the given values
+ *
+ * @param {mat2} out the receiving matrix
+ * @param {number} m00 Component in column 0, row 0 position (index 0)
+ * @param {number} m01 Component in column 0, row 1 position (index 1)
+ * @param {number} m10 Component in column 1, row 0 position (index 2)
+ * @param {number} m11 Component in column 1, row 1 position (index 3)
+ * @returns {mat2} out
+ */
+ public static set(out: mat2, m00: number, m01: number, m10: number, m11: number): mat2;
/**
* Transpose the values of a mat2
@@ -1203,7 +1374,7 @@ declare namespace mat2 {
* @param a the source matrix
* @returns out
*/
- export function transpose(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static transpose(out: mat2, a: mat2): mat2;
/**
* Inverts a mat2
@@ -1212,7 +1383,7 @@ declare namespace mat2 {
* @param a the source matrix
* @returns out
*/
- export function invert(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static invert(out: mat2, a: mat2): mat2;
/**
* Calculates the adjugate of a mat2
@@ -1221,7 +1392,7 @@ declare namespace mat2 {
* @param a the source matrix
* @returns out
*/
- export function adjoint(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static adjoint(out: mat2, a: mat2): mat2;
/**
* Calculates the determinant of a mat2
@@ -1229,7 +1400,7 @@ declare namespace mat2 {
* @param a the source matrix
* @returns determinant of a
*/
- export function determinant(a: GLM.IArray): number;
+ public static determinant(a: mat2): number;
/**
* Multiplies two mat2's
@@ -1239,7 +1410,7 @@ declare namespace mat2 {
* @param b the second operand
* @returns out
*/
- export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static multiply(out: mat2, a: mat2, b: mat2): mat2;
/**
* Multiplies two mat2's
@@ -1249,7 +1420,7 @@ declare namespace mat2 {
* @param b the second operand
* @returns out
*/
- export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static mul(out: mat2, a: mat2, b: mat2): mat2;
/**
* Rotates a mat2 by the given angle
@@ -1259,7 +1430,7 @@ declare namespace mat2 {
* @param rad the angle to rotate the matrix by
* @returns out
*/
- export function rotate(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+ public static rotate(out: mat2, a: mat2, rad: number): mat2;
/**
* Scales the mat2 by the dimensions in the given vec2
@@ -1269,7 +1440,33 @@ declare namespace mat2 {
* @param v the vec2 to scale the matrix by
* @returns out
**/
- export function scale(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray;
+ public static scale(out: mat2, a: mat2, v: vec2 | number[]): mat2;
+
+ /**
+ * Creates a matrix from a given angle
+ * This is equivalent to (but much faster than):
+ *
+ * mat2.identity(dest);
+ * mat2.rotate(dest, dest, rad);
+ *
+ * @param {mat2} out mat2 receiving operation result
+ * @param {number} rad the angle to rotate the matrix by
+ * @returns {mat2} out
+ */
+ public static fromRotation(out: mat2, rad: number): mat2;
+
+ /**
+ * Creates a matrix from a vector scaling
+ * This is equivalent to (but much faster than):
+ *
+ * mat2.identity(dest);
+ * mat2.scale(dest, dest, vec);
+ *
+ * @param {mat2} out mat2 receiving operation result
+ * @param {vec2} v Scaling vector
+ * @returns {mat2} out
+ */
+ public static fromScaling(out: mat2, v: vec2 | number[]): mat2;
/**
* Returns a string representation of a mat2
@@ -1277,7 +1474,7 @@ declare namespace mat2 {
* @param a matrix to represent as a string
* @returns string representation of the matrix
*/
- export function str(a: GLM.IArray): string;
+ public static str(a: mat2): string;
/**
* Returns Frobenius norm of a mat2
@@ -1285,7 +1482,7 @@ declare namespace mat2 {
* @param a the matrix to calculate Frobenius norm of
* @returns Frobenius norm
*/
- export function frob(a: GLM.IArray): number;
+ public static frob(a: mat2): number;
/**
* Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix
@@ -1294,18 +1491,91 @@ declare namespace mat2 {
* @param U the upper triangular matrix
* @param a the input matrix to factorize
*/
- export function LDU(L: GLM.IArray, D: GLM.IArray, U: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static LDU(L: mat2, D: mat2, U: mat2, a: mat2): mat2;
+
+ /**
+ * Adds two mat2's
+ *
+ * @param {mat2} out the receiving matrix
+ * @param {mat2} a the first operand
+ * @param {mat2} b the second operand
+ * @returns {mat2} out
+ */
+ public static add(out: mat2, a: mat2, b: mat2): mat2;
+
+ /**
+ * Subtracts matrix b from matrix a
+ *
+ * @param {mat2} out the receiving matrix
+ * @param {mat2} a the first operand
+ * @param {mat2} b the second operand
+ * @returns {mat2} out
+ */
+ public static subtract (out: mat2, a: mat2, b: mat2): mat2;
+
+ /**
+ * Subtracts matrix b from matrix a
+ *
+ * @param {mat2} out the receiving matrix
+ * @param {mat2} a the first operand
+ * @param {mat2} b the second operand
+ * @returns {mat2} out
+ */
+ public static sub (out: mat2, a: mat2, b: mat2): mat2;
+
+ /**
+ * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
+ *
+ * @param {mat2} a The first matrix.
+ * @param {mat2} b The second matrix.
+ * @returns {boolean} True if the matrices are equal, false otherwise.
+ */
+ public static exactEquals (a: mat2, b: mat2): boolean;
+
+ /**
+ * Returns whether or not the matrices have approximately the same elements in the same position.
+ *
+ * @param {mat2} a The first matrix.
+ * @param {mat2} b The second matrix.
+ * @returns {boolean} True if the matrices are equal, false otherwise.
+ */
+ public static equals (a: mat2, b: mat2): boolean;
+
+ /**
+ * Multiply each element of the matrix by a scalar.
+ *
+ * @param {mat2} out the receiving matrix
+ * @param {mat2} a the matrix to scale
+ * @param {number} b amount to scale the matrix's elements by
+ * @returns {mat2} out
+ */
+ public static multiplyScalar (out: mat2, a: mat2, b: number): mat2
+
+ /**
+ * Adds two mat2's after multiplying each element of the second operand by a scalar value.
+ *
+ * @param {mat2} out the receiving vector
+ * @param {mat2} a the first operand
+ * @param {mat2} b the second operand
+ * @param {number} scale the amount to scale b's elements by before adding
+ * @returns {mat2} out
+ */
+ public static multiplyScalarAndAdd (out: mat2, a: mat2, b: mat2, scale: number): mat2
+
+
+
}
// mat2d
-declare namespace mat2d {
+export class mat2d extends Float32Array {
+ private typeMat2d: number;
/**
* Creates a new identity mat2d
*
* @returns a new 2x3 matrix
*/
- export function create(): GLM.IArray;
+ public static create(): mat2d;
/**
* Creates a new mat2d initialized with values from an existing matrix
@@ -1313,7 +1583,7 @@ declare namespace mat2d {
* @param a matrix to clone
* @returns a new 2x3 matrix
*/
- export function clone(a: GLM.IArray): GLM.IArray;
+ public static clone(a: mat2d): mat2d;
/**
* Copy the values from one mat2d to another
@@ -1322,7 +1592,7 @@ declare namespace mat2d {
* @param a the source matrix
* @returns out
*/
- export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static copy(out: mat2d, a: mat2d): mat2d;
/**
* Set a mat2d to the identity matrix
@@ -1330,7 +1600,35 @@ declare namespace mat2d {
* @param out the receiving matrix
* @returns out
*/
- export function identity(out: GLM.IArray): GLM.IArray;
+ public static identity(out: mat2d): mat2d;
+
+ /**
+ * Create a new mat2d with the given values
+ *
+ * @param {number} a Component A (index 0)
+ * @param {number} b Component B (index 1)
+ * @param {number} c Component C (index 2)
+ * @param {number} d Component D (index 3)
+ * @param {number} tx Component TX (index 4)
+ * @param {number} ty Component TY (index 5)
+ * @returns {mat2d} A new mat2d
+ */
+ public static fromValues (a: number, b: number, c: number, d: number, tx: number, ty: number): mat2d
+
+
+ /**
+ * Set the components of a mat2d to the given values
+ *
+ * @param {mat2d} out the receiving matrix
+ * @param {number} a Component A (index 0)
+ * @param {number} b Component B (index 1)
+ * @param {number} c Component C (index 2)
+ * @param {number} d Component D (index 3)
+ * @param {number} tx Component TX (index 4)
+ * @param {number} ty Component TY (index 5)
+ * @returns {mat2d} out
+ */
+ public static set (out: mat2d, a: number, b: number, c: number, d: number, tx: number, ty: number): mat2d
/**
* Inverts a mat2d
@@ -1339,7 +1637,7 @@ declare namespace mat2d {
* @param a the source matrix
* @returns out
*/
- export function invert(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static invert(out: mat2d, a: mat2d): mat2d;
/**
* Calculates the determinant of a mat2d
@@ -1347,7 +1645,7 @@ declare namespace mat2d {
* @param a the source matrix
* @returns determinant of a
*/
- export function determinant(a: GLM.IArray): number;
+ public static determinant(a: mat2d): number;
/**
* Multiplies two mat2d's
@@ -1357,7 +1655,7 @@ declare namespace mat2d {
* @param b the second operand
* @returns out
*/
- export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static multiply(out: mat2d, a: mat2d, b: mat2d): mat2d;
/**
* Multiplies two mat2d's
@@ -1367,7 +1665,7 @@ declare namespace mat2d {
* @param b the second operand
* @returns out
*/
- export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static mul(out: mat2d, a: mat2d, b: mat2d): mat2d;
/**
* Rotates a mat2d by the given angle
@@ -1377,7 +1675,7 @@ declare namespace mat2d {
* @param rad the angle to rotate the matrix by
* @returns out
*/
- export function rotate(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+ public static rotate(out: mat2d, a: mat2d, rad: number): mat2d;
/**
* Scales the mat2d by the dimensions in the given vec2
@@ -1387,7 +1685,7 @@ declare namespace mat2d {
* @param v the vec2 to scale the matrix by
* @returns out
**/
- export function scale(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray;
+ public static scale(out: mat2d, a: mat2d, v: vec2 | number[]): mat2d;
/**
* Translates the mat2d by the dimensions in the given vec2
@@ -1397,7 +1695,46 @@ declare namespace mat2d {
* @param v the vec2 to translate the matrix by
* @returns out
**/
- export function translate(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray;
+ public static translate(out: mat2d, a: mat2d, v: vec2 | number[]): mat2d;
+
+ /**
+ * Creates a matrix from a given angle
+ * This is equivalent to (but much faster than):
+ *
+ * mat2d.identity(dest);
+ * mat2d.rotate(dest, dest, rad);
+ *
+ * @param {mat2d} out mat2d receiving operation result
+ * @param {number} rad the angle to rotate the matrix by
+ * @returns {mat2d} out
+ */
+ public static fromRotation (out: mat2d, rad: number): mat2d;
+
+ /**
+ * Creates a matrix from a vector scaling
+ * This is equivalent to (but much faster than):
+ *
+ * mat2d.identity(dest);
+ * mat2d.scale(dest, dest, vec);
+ *
+ * @param {mat2d} out mat2d receiving operation result
+ * @param {vec2} v Scaling vector
+ * @returns {mat2d} out
+ */
+ public static fromScaling (out: mat2d, v: vec2 | number[]): mat2d;
+
+ /**
+ * Creates a matrix from a vector translation
+ * This is equivalent to (but much faster than):
+ *
+ * mat2d.identity(dest);
+ * mat2d.translate(dest, dest, vec);
+ *
+ * @param {mat2d} out mat2d receiving operation result
+ * @param {vec2} v Translation vector
+ * @returns {mat2d} out
+ */
+ public static fromTranslation (out: mat2d, v: vec2 | number[]): mat2d
/**
* Returns a string representation of a mat2d
@@ -1405,7 +1742,7 @@ declare namespace mat2d {
* @param a matrix to represent as a string
* @returns string representation of the matrix
*/
- export function str(a: GLM.IArray): string;
+ public static str(a: mat2d): string;
/**
* Returns Frobenius norm of a mat2d
@@ -1413,18 +1750,97 @@ declare namespace mat2d {
* @param a the matrix to calculate Frobenius norm of
* @returns Frobenius norm
*/
- export function frob(a: GLM.IArray): number;
+ public static frob(a: mat2d): number;
+
+ /**
+ * Adds two mat2d's
+ *
+ * @param {mat2d} out the receiving matrix
+ * @param {mat2d} a the first operand
+ * @param {mat2d} b the second operand
+ * @returns {mat2d} out
+ */
+ public static add (out: mat2d, a: mat2d, b: mat2d): mat2d
+
+ /**
+ * Subtracts matrix b from matrix a
+ *
+ * @param {mat2d} out the receiving matrix
+ * @param {mat2d} a the first operand
+ * @param {mat2d} b the second operand
+ * @returns {mat2d} out
+ */
+ public static subtract(out: mat2d, a: mat2d, b: mat2d): mat2d
+
+ /**
+ * Subtracts matrix b from matrix a
+ *
+ * @param {mat2d} out the receiving matrix
+ * @param {mat2d} a the first operand
+ * @param {mat2d} b the second operand
+ * @returns {mat2d} out
+ */
+ public static sub(out: mat2d, a: mat2d, b: mat2d): mat2d
+
+ /**
+ * Multiply each element of the matrix by a scalar.
+ *
+ * @param {mat2d} out the receiving matrix
+ * @param {mat2d} a the matrix to scale
+ * @param {number} b amount to scale the matrix's elements by
+ * @returns {mat2d} out
+ */
+ public static multiplyScalar (out: mat2d, a: mat2d, b: number): mat2d;
+
+ /**
+ * Adds two mat2d's after multiplying each element of the second operand by a scalar value.
+ *
+ * @param {mat2d} out the receiving vector
+ * @param {mat2d} a the first operand
+ * @param {mat2d} b the second operand
+ * @param {number} scale the amount to scale b's elements by before adding
+ * @returns {mat2d} out
+ */
+ public static multiplyScalarAndAdd (out: mat2d, a: mat2d, b: mat2d, scale: number): mat2d
+
+ /**
+ * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
+ *
+ * @param {mat2d} a The first matrix.
+ * @param {mat2d} b The second matrix.
+ * @returns {boolean} True if the matrices are equal, false otherwise.
+ */
+ public static exactEquals (a: mat2d, b: mat2d): boolean;
+
+ /**
+ * Returns whether or not the matrices have approximately the same elements in the same position.
+ *
+ * @param {mat2d} a The first matrix.
+ * @param {mat2d} b The second matrix.
+ * @returns {boolean} True if the matrices are equal, false otherwise.
+ */
+ public static equals (a: mat2d, b: mat2d): boolean
}
// mat3
-declare namespace mat3 {
+export class mat3 extends Float32Array {
+ private typeMat3: number;
/**
* Creates a new identity mat3
*
* @returns a new 3x3 matrix
*/
- export function create(): GLM.IArray;
+ public static create(): mat3;
+
+ /**
+ * Copies the upper-left 3x3 values into the given mat3.
+ *
+ * @param {mat3} out the receiving 3x3 matrix
+ * @param {mat4} a the source 4x4 matrix
+ * @returns {mat3} out
+ */
+ public static fromMat4(out: mat3, a: mat4): mat3
/**
* Creates a new mat3 initialized with values from an existing matrix
@@ -1432,7 +1848,7 @@ declare namespace mat3 {
* @param a matrix to clone
* @returns a new 3x3 matrix
*/
- export function clone(a: GLM.IArray): GLM.IArray;
+ public static clone(a: mat3): mat3;
/**
* Copy the values from one mat3 to another
@@ -1441,7 +1857,41 @@ declare namespace mat3 {
* @param a the source matrix
* @returns out
*/
- export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static copy(out: mat3, a: mat3): mat3;
+
+ /**
+ * Create a new mat3 with the given values
+ *
+ * @param {number} m00 Component in column 0, row 0 position (index 0)
+ * @param {number} m01 Component in column 0, row 1 position (index 1)
+ * @param {number} m02 Component in column 0, row 2 position (index 2)
+ * @param {number} m10 Component in column 1, row 0 position (index 3)
+ * @param {number} m11 Component in column 1, row 1 position (index 4)
+ * @param {number} m12 Component in column 1, row 2 position (index 5)
+ * @param {number} m20 Component in column 2, row 0 position (index 6)
+ * @param {number} m21 Component in column 2, row 1 position (index 7)
+ * @param {number} m22 Component in column 2, row 2 position (index 8)
+ * @returns {mat3} A new mat3
+ */
+ public static fromValues(m00: number, m01: number, m02: number, m10: number, m11: number, m12: number, m20: number, m21: number, m22: number): mat3;
+
+
+ /**
+ * Set the components of a mat3 to the given values
+ *
+ * @param {mat3} out the receiving matrix
+ * @param {number} m00 Component in column 0, row 0 position (index 0)
+ * @param {number} m01 Component in column 0, row 1 position (index 1)
+ * @param {number} m02 Component in column 0, row 2 position (index 2)
+ * @param {number} m10 Component in column 1, row 0 position (index 3)
+ * @param {number} m11 Component in column 1, row 1 position (index 4)
+ * @param {number} m12 Component in column 1, row 2 position (index 5)
+ * @param {number} m20 Component in column 2, row 0 position (index 6)
+ * @param {number} m21 Component in column 2, row 1 position (index 7)
+ * @param {number} m22 Component in column 2, row 2 position (index 8)
+ * @returns {mat3} out
+ */
+ public static set(out: mat3, m00: number, m01: number, m02: number, m10: number, m11: number, m12: number, m20: number, m21: number, m22: number): mat3
/**
* Set a mat3 to the identity matrix
@@ -1449,7 +1899,7 @@ declare namespace mat3 {
* @param out the receiving matrix
* @returns out
*/
- export function identity(out: GLM.IArray): GLM.IArray;
+ public static identity(out: mat3): mat3;
/**
* Transpose the values of a mat3
@@ -1458,7 +1908,7 @@ declare namespace mat3 {
* @param a the source matrix
* @returns out
*/
- export function transpose(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static transpose(out: mat3, a: mat3): mat3;
/**
* Inverts a mat3
@@ -1467,7 +1917,7 @@ declare namespace mat3 {
* @param a the source matrix
* @returns out
*/
- export function invert(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static invert(out: mat3, a: mat3): mat3;
/**
* Calculates the adjugate of a mat3
@@ -1476,7 +1926,7 @@ declare namespace mat3 {
* @param a the source matrix
* @returns out
*/
- export function adjoint(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static adjoint(out: mat3, a: mat3): mat3;
/**
* Calculates the determinant of a mat3
@@ -1484,7 +1934,7 @@ declare namespace mat3 {
* @param a the source matrix
* @returns determinant of a
*/
- export function determinant(a: GLM.IArray): number;
+ public static determinant(a: mat3): number;
/**
* Multiplies two mat3's
@@ -1494,7 +1944,7 @@ declare namespace mat3 {
* @param b the second operand
* @returns out
*/
- export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static multiply(out: mat3, a: mat3, b: mat3): mat3;
/**
* Multiplies two mat3's
@@ -1504,71 +1954,8 @@ declare namespace mat3 {
* @param b the second operand
* @returns out
*/
- export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static mul(out: mat3, a: mat3, b: mat3): mat3;
- /**
- * Returns a string representation of a mat3
- *
- * @param mat matrix to represent as a string
- * @returns string representation of the matrix
- */
- export function str(mat: GLM.IArray): string;
-
- /**
- * Returns Frobenius norm of a mat3
- *
- * @param a the matrix to calculate Frobenius norm of
- * @returns Frobenius norm
- */
- export function frob(a: GLM.IArray): number;
-
- /**
- * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix
- *
- * @param out mat3 receiving operation result
- * @param a Mat4 to derive the normal matrix from
- *
- * @returns out
- */
- export function normalFromMat4(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
-
- /**
- * Calculates a 3x3 matrix from the given quaternion
- *
- * @param out mat3 receiving operation result
- * @param q Quaternion to create matrix from
- *
- * @returns out
- */
- export function fromQuat(out: GLM.IArray, q: GLM.IArray): GLM.IArray;
-
- /**
- * Copies the upper-left 3x3 values into the given mat3.
- *
- * @param out the receiving 3x3 matrix
- * @param a the source 4x4 matrix
- * @returns out
- */
- export function fromMat4(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
-
- /**
- * Scales the mat3 by the dimensions in the given vec2
- *
- * @param out the receiving matrix
- * @param a the matrix to rotate
- * @param v the vec2 to scale the matrix by
- * @returns out
- **/
- export function scale(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray;
-
- /**
- * Copies the values from a mat2d into a mat3
- *
- * @param out the receiving matrix
- * @param {mat2d} a the matrix to copy
- * @returns out
- **/
- export function fromMat2d(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
/**
* Translate a mat3 by the given vector
@@ -1578,7 +1965,7 @@ declare namespace mat3 {
* @param v vector to translate by
* @returns out
*/
- export function translate(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray;
+ public static translate(out: mat3, a: mat3, v: vec3 | number[]): mat3;
/**
* Rotates a mat3 by the given angle
@@ -1588,18 +1975,182 @@ declare namespace mat3 {
* @param rad the angle to rotate the matrix by
* @returns out
*/
- export function rotate(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+ public static rotate(out: mat3, a: mat3, rad: number): mat3;
+
+ /**
+ * Scales the mat3 by the dimensions in the given vec2
+ *
+ * @param out the receiving matrix
+ * @param a the matrix to rotate
+ * @param v the vec2 to scale the matrix by
+ * @returns out
+ **/
+ public static scale(out: mat3, a: mat3, v: vec2 | number[]): mat3;
+
+ /**
+ * Creates a matrix from a vector translation
+ * This is equivalent to (but much faster than):
+ *
+ * mat3.identity(dest);
+ * mat3.translate(dest, dest, vec);
+ *
+ * @param {mat3} out mat3 receiving operation result
+ * @param {vec2} v Translation vector
+ * @returns {mat3} out
+ */
+ public static fromTranslation(out: mat3, v: vec2 | number[]): mat3
+
+ /**
+ * Creates a matrix from a given angle
+ * This is equivalent to (but much faster than):
+ *
+ * mat3.identity(dest);
+ * mat3.rotate(dest, dest, rad);
+ *
+ * @param {mat3} out mat3 receiving operation result
+ * @param {number} rad the angle to rotate the matrix by
+ * @returns {mat3} out
+ */
+ public static fromRotation(out: mat3, rad: number): mat3
+
+ /**
+ * Creates a matrix from a vector scaling
+ * This is equivalent to (but much faster than):
+ *
+ * mat3.identity(dest);
+ * mat3.scale(dest, dest, vec);
+ *
+ * @param {mat3} out mat3 receiving operation result
+ * @param {vec2} v Scaling vector
+ * @returns {mat3} out
+ */
+ public static fromScaling(out: mat3, v: vec2 | number[]): mat3
+
+ /**
+ * Copies the values from a mat2d into a mat3
+ *
+ * @param out the receiving matrix
+ * @param {mat2d} a the matrix to copy
+ * @returns out
+ **/
+ public static fromMat2d(out: mat3, a: mat2d): mat3;
+
+ /**
+ * Calculates a 3x3 matrix from the given quaternion
+ *
+ * @param out mat3 receiving operation result
+ * @param q Quaternion to create matrix from
+ *
+ * @returns out
+ */
+ public static fromQuat(out: mat3, q: quat): mat3;
+
+ /**
+ * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix
+ *
+ * @param out mat3 receiving operation result
+ * @param a Mat4 to derive the normal matrix from
+ *
+ * @returns out
+ */
+ public static normalFromMat4(out: mat3, a: mat4): mat3;
+
+ /**
+ * Returns a string representation of a mat3
+ *
+ * @param mat matrix to represent as a string
+ * @returns string representation of the matrix
+ */
+ public static str(mat: mat3): string;
+
+ /**
+ * Returns Frobenius norm of a mat3
+ *
+ * @param a the matrix to calculate Frobenius norm of
+ * @returns Frobenius norm
+ */
+ public static frob(a: mat3): number;
+
+ /**
+ * Adds two mat3's
+ *
+ * @param {mat3} out the receiving matrix
+ * @param {mat3} a the first operand
+ * @param {mat3} b the second operand
+ * @returns {mat3} out
+ */
+ public static add(out: mat3, a: mat3, b: mat3): mat3
+
+ /**
+ * Subtracts matrix b from matrix a
+ *
+ * @param {mat3} out the receiving matrix
+ * @param {mat3} a the first operand
+ * @param {mat3} b the second operand
+ * @returns {mat3} out
+ */
+ public static subtract(out: mat3, a: mat3, b: mat3): mat3
+
+ /**
+ * Subtracts matrix b from matrix a
+ *
+ * @param {mat3} out the receiving matrix
+ * @param {mat3} a the first operand
+ * @param {mat3} b the second operand
+ * @returns {mat3} out
+ */
+ public static sub(out: mat3, a: mat3, b: mat3): mat3
+
+ /**
+ * Multiply each element of the matrix by a scalar.
+ *
+ * @param {mat3} out the receiving matrix
+ * @param {mat3} a the matrix to scale
+ * @param {number} b amount to scale the matrix's elements by
+ * @returns {mat3} out
+ */
+ public static multiplyScalar(out: mat3, a: mat3, b: number): mat3
+
+ /**
+ * Adds two mat3's after multiplying each element of the second operand by a scalar value.
+ *
+ * @param {mat3} out the receiving vector
+ * @param {mat3} a the first operand
+ * @param {mat3} b the second operand
+ * @param {number} scale the amount to scale b's elements by before adding
+ * @returns {mat3} out
+ */
+ public static multiplyScalarAndAdd(out: mat3, a: mat3, b: mat3, scale: number): mat3
+
+ /**
+ * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
+ *
+ * @param {mat3} a The first matrix.
+ * @param {mat3} b The second matrix.
+ * @returns {boolean} True if the matrices are equal, false otherwise.
+ */
+ public static exactEquals(a: mat3, b: mat3): boolean;
+
+ /**
+ * Returns whether or not the matrices have approximately the same elements in the same position.
+ *
+ * @param {mat3} a The first matrix.
+ * @param {mat3} b The second matrix.
+ * @returns {boolean} True if the matrices are equal, false otherwise.
+ */
+ public static equals(a: mat3, b: mat3): boolean
}
// mat4
-declare namespace mat4 {
+export class mat4 extends Float32Array {
+ private typeMat4: number;
/**
* Creates a new identity mat4
*
* @returns a new 4x4 matrix
*/
- export function create(): GLM.IArray;
+ public static create(): mat4;
/**
* Creates a new mat4 initialized with values from an existing matrix
@@ -1607,7 +2158,7 @@ declare namespace mat4 {
* @param a matrix to clone
* @returns a new 4x4 matrix
*/
- export function clone(a: GLM.IArray): GLM.IArray;
+ public static clone(a: mat4): mat4;
/**
* Copy the values from one mat4 to another
@@ -1616,7 +2167,55 @@ declare namespace mat4 {
* @param a the source matrix
* @returns out
*/
- export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static copy(out: mat4, a: mat4): mat4;
+
+
+ /**
+ * Create a new mat4 with the given values
+ *
+ * @param {number} m00 Component in column 0, row 0 position (index 0)
+ * @param {number} m01 Component in column 0, row 1 position (index 1)
+ * @param {number} m02 Component in column 0, row 2 position (index 2)
+ * @param {number} m03 Component in column 0, row 3 position (index 3)
+ * @param {number} m10 Component in column 1, row 0 position (index 4)
+ * @param {number} m11 Component in column 1, row 1 position (index 5)
+ * @param {number} m12 Component in column 1, row 2 position (index 6)
+ * @param {number} m13 Component in column 1, row 3 position (index 7)
+ * @param {number} m20 Component in column 2, row 0 position (index 8)
+ * @param {number} m21 Component in column 2, row 1 position (index 9)
+ * @param {number} m22 Component in column 2, row 2 position (index 10)
+ * @param {number} m23 Component in column 2, row 3 position (index 11)
+ * @param {number} m30 Component in column 3, row 0 position (index 12)
+ * @param {number} m31 Component in column 3, row 1 position (index 13)
+ * @param {number} m32 Component in column 3, row 2 position (index 14)
+ * @param {number} m33 Component in column 3, row 3 position (index 15)
+ * @returns {mat4} A new mat4
+ */
+ public static fromValues(m00: number, m01: number, m02: number, m03: number, m10: number, m11: number, m12: number, m13: number, m20: number, m21: number, m22: number, m23: number, m30: number, m31: number, m32: number, m33: number): mat4;
+
+ /**
+ * Set the components of a mat4 to the given values
+ *
+ * @param {mat4} out the receiving matrix
+ * @param {number} m00 Component in column 0, row 0 position (index 0)
+ * @param {number} m01 Component in column 0, row 1 position (index 1)
+ * @param {number} m02 Component in column 0, row 2 position (index 2)
+ * @param {number} m03 Component in column 0, row 3 position (index 3)
+ * @param {number} m10 Component in column 1, row 0 position (index 4)
+ * @param {number} m11 Component in column 1, row 1 position (index 5)
+ * @param {number} m12 Component in column 1, row 2 position (index 6)
+ * @param {number} m13 Component in column 1, row 3 position (index 7)
+ * @param {number} m20 Component in column 2, row 0 position (index 8)
+ * @param {number} m21 Component in column 2, row 1 position (index 9)
+ * @param {number} m22 Component in column 2, row 2 position (index 10)
+ * @param {number} m23 Component in column 2, row 3 position (index 11)
+ * @param {number} m30 Component in column 3, row 0 position (index 12)
+ * @param {number} m31 Component in column 3, row 1 position (index 13)
+ * @param {number} m32 Component in column 3, row 2 position (index 14)
+ * @param {number} m33 Component in column 3, row 3 position (index 15)
+ * @returns {mat4} out
+ */
+ public static set(out: mat4, m00: number, m01: number, m02: number, m03: number, m10: number, m11: number, m12: number, m13: number, m20: number, m21: number, m22: number, m23: number, m30: number, m31: number, m32: number, m33: number): mat4;
/**
* Set a mat4 to the identity matrix
@@ -1624,7 +2223,7 @@ declare namespace mat4 {
* @param out the receiving matrix
* @returns out
*/
- export function identity(a: GLM.IArray): GLM.IArray;
+ public static identity(out: mat4): mat4;
/**
* Transpose the values of a mat4
@@ -1633,7 +2232,7 @@ declare namespace mat4 {
* @param a the source matrix
* @returns out
*/
- export function transpose(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static transpose(out: mat4, a: mat4): mat4;
/**
* Inverts a mat4
@@ -1642,7 +2241,7 @@ declare namespace mat4 {
* @param a the source matrix
* @returns out
*/
- export function invert(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static invert(out: mat4, a: mat4): mat4;
/**
* Calculates the adjugate of a mat4
@@ -1651,7 +2250,7 @@ declare namespace mat4 {
* @param a the source matrix
* @returns out
*/
- export function adjoint(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static adjoint(out: mat4, a: mat4): mat4;
/**
* Calculates the determinant of a mat4
@@ -1659,7 +2258,7 @@ declare namespace mat4 {
* @param a the source matrix
* @returns determinant of a
*/
- export function determinant(a: GLM.IArray): number;
+ public static determinant(a: mat4): number;
/**
* Multiplies two mat4's
@@ -1669,7 +2268,7 @@ declare namespace mat4 {
* @param b the second operand
* @returns out
*/
- export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static multiply(out: mat4, a: mat4, b: mat4): mat4;
/**
* Multiplies two mat4's
@@ -1679,7 +2278,7 @@ declare namespace mat4 {
* @param b the second operand
* @returns out
*/
- export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static mul(out: mat4, a: mat4, b: mat4): mat4;
/**
* Translate a mat4 by the given vector
@@ -1689,7 +2288,7 @@ declare namespace mat4 {
* @param v vector to translate by
* @returns out
*/
- export function translate(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray;
+ public static translate(out: mat4, a: mat4, v: vec3 | number[]): mat4;
/**
* Scales the mat4 by the dimensions in the given vec3
@@ -1699,7 +2298,7 @@ declare namespace mat4 {
* @param v the vec3 to scale the matrix by
* @returns out
**/
- export function scale(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray;
+ public static scale(out: mat4, a: mat4, v: vec3 | number[]): mat4;
/**
* Rotates a mat4 by the given angle
@@ -1710,7 +2309,7 @@ declare namespace mat4 {
* @param axis the axis to rotate around
* @returns out
*/
- export function rotate(out: GLM.IArray, a: GLM.IArray, rad: number, axis: GLM.IArray): GLM.IArray;
+ public static rotate(out: mat4, a: mat4, rad: number, axis: vec3 | number[]): mat4;
/**
* Rotates a matrix by the given angle around the X axis
@@ -1720,7 +2319,7 @@ declare namespace mat4 {
* @param rad the angle to rotate the matrix by
* @returns out
*/
- export function rotateX(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+ public static rotateX(out: mat4, a: mat4, rad: number): mat4;
/**
* Rotates a matrix by the given angle around the Y axis
@@ -1730,7 +2329,7 @@ declare namespace mat4 {
* @param rad the angle to rotate the matrix by
* @returns out
*/
- export function rotateY(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+ public static rotateY(out: mat4, a: mat4, rad: number): mat4;
/**
* Rotates a matrix by the given angle around the Z axis
@@ -1740,78 +2339,87 @@ declare namespace mat4 {
* @param rad the angle to rotate the matrix by
* @returns out
*/
- export function rotateZ(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+ public static rotateZ(out: mat4, a: mat4, rad: number): mat4;
/**
- * Generates a frustum matrix with the given bounds
+ * Creates a matrix from a vector translation
+ * This is equivalent to (but much faster than):
*
- * @param out mat4 frustum matrix will be written into
- * @param left Left bound of the frustum
- * @param right Right bound of the frustum
- * @param bottom Bottom bound of the frustum
- * @param top Top bound of the frustum
- * @param near Near bound of the frustum
- * @param far Far bound of the frustum
- * @returns out
+ * mat4.identity(dest);
+ * mat4.translate(dest, dest, vec);
+ *
+ * @param {mat4} out mat4 receiving operation result
+ * @param {vec3} v Translation vector
+ * @returns {mat4} out
*/
- export function frustum(out: GLM.IArray, left: number, right: number,
- bottom: number, top: number, near: number, far: number): GLM.IArray;
+ public static fromTranslation(out: mat4, v: vec3 | number[]): mat4
/**
- * Generates a perspective projection matrix with the given bounds
+ * Creates a matrix from a vector scaling
+ * This is equivalent to (but much faster than):
*
- * @param out mat4 frustum matrix will be written into
- * @param fovy Vertical field of view in radians
- * @param aspect Aspect ratio. typically viewport width/height
- * @param near Near bound of the frustum
- * @param far Far bound of the frustum
- * @returns out
+ * mat4.identity(dest);
+ * mat4.scale(dest, dest, vec);
+ *
+ * @param {mat4} out mat4 receiving operation result
+ * @param {vec3} v Scaling vector
+ * @returns {mat4} out
*/
- export function perspective(out: GLM.IArray, fovy: number, aspect: number,
- near: number, far: number): GLM.IArray;
+ public static fromScaling(out: mat4, v: vec3 | number[]): mat4
/**
- * Generates a orthogonal projection matrix with the given bounds
+ * Creates a matrix from a given angle around a given axis
+ * This is equivalent to (but much faster than):
*
- * @param out mat4 frustum matrix will be written into
- * @param left Left bound of the frustum
- * @param right Right bound of the frustum
- * @param bottom Bottom bound of the frustum
- * @param top Top bound of the frustum
- * @param near Near bound of the frustum
- * @param far Far bound of the frustum
- * @returns out
+ * mat4.identity(dest);
+ * mat4.rotate(dest, dest, rad, axis);
+ *
+ * @param {mat4} out mat4 receiving operation result
+ * @param {number} rad the angle to rotate the matrix by
+ * @param {vec3} axis the axis to rotate around
+ * @returns {mat4} out
*/
- export function ortho(out: GLM.IArray, left: number, right: number,
- bottom: number, top: number, near: number, far: number): GLM.IArray;
+ public static fromRotation(out: mat4, rad: number, axis: vec3 | number[]): mat4
/**
- * Generates a look-at matrix with the given eye position, focal point, and up axis
+ * Creates a matrix from the given angle around the X axis
+ * This is equivalent to (but much faster than):
*
- * @param out mat4 frustum matrix will be written into
- * @param eye Position of the viewer
- * @param center Point the viewer is looking at
- * @param up vec3 pointing up
- * @returns out
+ * mat4.identity(dest);
+ * mat4.rotateX(dest, dest, rad);
+ *
+ * @param {mat4} out mat4 receiving operation result
+ * @param {number} rad the angle to rotate the matrix by
+ * @returns {mat4} out
*/
- export function lookAt(out: GLM.IArray, eye: GLM.IArray,
- center: GLM.IArray, up: GLM.IArray): GLM.IArray;
+ public static fromXRotation(out: mat4, rad: number): mat4
/**
- * Returns a string representation of a mat4
+ * Creates a matrix from the given angle around the Y axis
+ * This is equivalent to (but much faster than):
*
- * @param mat matrix to represent as a string
- * @returns string representation of the matrix
+ * mat4.identity(dest);
+ * mat4.rotateY(dest, dest, rad);
+ *
+ * @param {mat4} out mat4 receiving operation result
+ * @param {number} rad the angle to rotate the matrix by
+ * @returns {mat4} out
*/
- export function str(mat: GLM.IArray): string;
+ public static fromYRotation(out: mat4, rad: number): mat4
+
/**
- * Returns Frobenius norm of a mat4
+ * Creates a matrix from the given angle around the Z axis
+ * This is equivalent to (but much faster than):
*
- * @param a the matrix to calculate Frobenius norm of
- * @returns Frobenius norm
+ * mat4.identity(dest);
+ * mat4.rotateZ(dest, dest, rad);
+ *
+ * @param {mat4} out mat4 receiving operation result
+ * @param {number} rad the angle to rotate the matrix by
+ * @returns {mat4} out
*/
- export function frob(a: GLM.IArray): number;
+ public static fromZRotation(out: mat4, rad: number): mat4
/**
* Creates a matrix from a quaternion rotation and vector translation
@@ -1828,47 +2436,247 @@ declare namespace mat4 {
* @param v Translation vector
* @returns out
*/
- export function fromRotationTranslation(out: GLM.IArray, q: GLM.IArray, v: GLM.IArray): GLM.IArray;
-
- /**
- * Creates a matrix from a quaternion rotation, vector translation and vector scale.
- *
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.translate(dest, vec);
- * var quatMat = mat4.create();
- * quat4.toMat4(quat, quatMat);
- * mat4.multiply(dest, quatMat);
- * mat4.scale(dest, scale)
- *
- * @param out mat4 receiving operation result
- * @param q Rotation quaternion
- * @param v Translation vector
- * @param s Scale vector
- * @returns out
- */
- export function fromRotationTranslationScale(out: GLM.IArray, q: GLM.IArray, v: GLM.IArray, s: GLM.IArray): GLM.IArray
+ public static fromRotationTranslation(out: mat4, q: quat, v: vec3 | number[]): mat4;
/**
- * Creates a matrix from a quaternion
+ * Returns the translation vector component of a transformation
+ * matrix. If a matrix is built with fromRotationTranslation,
+ * the returned vector will be the same as the translation vector
+ * originally supplied.
+ * @param {vec3} out Vector to receive translation component
+ * @param {mat4} mat Matrix to be decomposed (input)
+ * @return {vec3} out
+ */
+ public static getTranslation(out: vec3, mat: mat4): vec3;
+
+ /**
+ * Returns a quaternion representing the rotational component
+ * of a transformation matrix. If a matrix is built with
+ * fromRotationTranslation, the returned quaternion will be the
+ * same as the quaternion originally supplied.
+ * @param {quat} out Quaternion to receive the rotation component
+ * @param {mat4} mat Matrix to be decomposed (input)
+ * @return {quat} out
+ */
+ public static getRotation(out: quat, mat: mat4): quat;
+
+ /**
+ * Creates a matrix from a quaternion rotation, vector translation and vector scale
+ * This is equivalent to (but much faster than):
+ *
+ * mat4.identity(dest);
+ * mat4.translate(dest, vec);
+ * var quatMat = mat4.create();
+ * quat4.toMat4(quat, quatMat);
+ * mat4.multiply(dest, quatMat);
+ * mat4.scale(dest, scale)
*
* @param out mat4 receiving operation result
* @param q Rotation quaternion
+ * @param v Translation vector
+ * @param s Scaling vector
* @returns out
*/
- export function fromQuat(out: GLM.IArray, q: GLM.IArray): GLM.IArray;
+ public static fromRotationTranslationScale(out: mat4, q: quat, v: vec3 | number[], s: vec3 | number[]): mat4;
+
+ /**
+ * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin
+ * This is equivalent to (but much faster than):
+ *
+ * mat4.identity(dest);
+ * mat4.translate(dest, vec);
+ * mat4.translate(dest, origin);
+ * var quatMat = mat4.create();
+ * quat4.toMat4(quat, quatMat);
+ * mat4.multiply(dest, quatMat);
+ * mat4.scale(dest, scale)
+ * mat4.translate(dest, negativeOrigin);
+ *
+ * @param {mat4} out mat4 receiving operation result
+ * @param {quat} q Rotation quaternion
+ * @param {vec3} v Translation vector
+ * @param {vec3} s Scaling vector
+ * @param {vec3} o The origin vector around which to scale and rotate
+ * @returns {mat4} out
+ */
+ public static fromRotationTranslationScaleOrigin(out: mat4, q: quat, v: vec3 | number[], s: vec3 | number[], o: vec3 | number[]): mat4
+
+ /**
+ * Calculates a 4x4 matrix from the given quaternion
+ *
+ * @param {mat4} out mat4 receiving operation result
+ * @param {quat} q Quaternion to create matrix from
+ *
+ * @returns {mat4} out
+ */
+ public static fromQuat(out: mat4, q: quat): mat4
+
+ /**
+ * Generates a frustum matrix with the given bounds
+ *
+ * @param out mat4 frustum matrix will be written into
+ * @param left Left bound of the frustum
+ * @param right Right bound of the frustum
+ * @param bottom Bottom bound of the frustum
+ * @param top Top bound of the frustum
+ * @param near Near bound of the frustum
+ * @param far Far bound of the frustum
+ * @returns out
+ */
+ public static frustum(out: mat4, left: number, right: number,
+ bottom: number, top: number, near: number, far: number): mat4;
+
+ /**
+ * Generates a perspective projection matrix with the given bounds
+ *
+ * @param out mat4 frustum matrix will be written into
+ * @param fovy Vertical field of view in radians
+ * @param aspect Aspect ratio. typically viewport width/height
+ * @param near Near bound of the frustum
+ * @param far Far bound of the frustum
+ * @returns out
+ */
+ public static perspective(out: mat4, fovy: number, aspect: number,
+ near: number, far: number): mat4;
+
+ /**
+ * Generates a perspective projection matrix with the given field of view.
+ * This is primarily useful for generating projection matrices to be used
+ * with the still experimental WebVR API.
+ *
+ * @param {mat4} out mat4 frustum matrix will be written into
+ * @param {Object} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees
+ * @param {number} near Near bound of the frustum
+ * @param {number} far Far bound of the frustum
+ * @returns {mat4} out
+ */
+ public static perspectiveFromFieldOfView(out: mat4,
+ fov:{upDegrees: number, downDegrees: number, leftDegrees: number, rightDegrees: number},
+ near: number, far: number): mat4
+
+ /**
+ * Generates a orthogonal projection matrix with the given bounds
+ *
+ * @param out mat4 frustum matrix will be written into
+ * @param left Left bound of the frustum
+ * @param right Right bound of the frustum
+ * @param bottom Bottom bound of the frustum
+ * @param top Top bound of the frustum
+ * @param near Near bound of the frustum
+ * @param far Far bound of the frustum
+ * @returns out
+ */
+ public static ortho(out: mat4, left: number, right: number,
+ bottom: number, top: number, near: number, far: number): mat4;
+
+ /**
+ * Generates a look-at matrix with the given eye position, focal point, and up axis
+ *
+ * @param out mat4 frustum matrix will be written into
+ * @param eye Position of the viewer
+ * @param center Point the viewer is looking at
+ * @param up vec3 pointing up
+ * @returns out
+ */
+ public static lookAt(out: mat4, eye: vec3 | number[], center: vec3 | number[], up: vec3 | number[]): mat4;
+
+ /**
+ * Returns a string representation of a mat4
+ *
+ * @param mat matrix to represent as a string
+ * @returns string representation of the matrix
+ */
+ public static str(mat: mat4): string;
+
+ /**
+ * Returns Frobenius norm of a mat4
+ *
+ * @param a the matrix to calculate Frobenius norm of
+ * @returns Frobenius norm
+ */
+ public static frob(a: mat4): number;
+
+ /**
+ * Adds two mat4's
+ *
+ * @param {mat4} out the receiving matrix
+ * @param {mat4} a the first operand
+ * @param {mat4} b the second operand
+ * @returns {mat4} out
+ */
+ public static add(out: mat4, a: mat4, b: mat4): mat4
+
+ /**
+ * Subtracts matrix b from matrix a
+ *
+ * @param {mat4} out the receiving matrix
+ * @param {mat4} a the first operand
+ * @param {mat4} b the second operand
+ * @returns {mat4} out
+ */
+ public static subtract(out: mat4, a: mat4, b: mat4): mat4
+
+ /**
+ * Subtracts matrix b from matrix a
+ *
+ * @param {mat4} out the receiving matrix
+ * @param {mat4} a the first operand
+ * @param {mat4} b the second operand
+ * @returns {mat4} out
+ */
+ public static sub(out: mat4, a: mat4, b: mat4): mat4
+
+ /**
+ * Multiply each element of the matrix by a scalar.
+ *
+ * @param {mat4} out the receiving matrix
+ * @param {mat4} a the matrix to scale
+ * @param {number} b amount to scale the matrix's elements by
+ * @returns {mat4} out
+ */
+ public static multiplyScalar(out: mat4, a: mat4, b: number): mat4
+
+ /**
+ * Adds two mat4's after multiplying each element of the second operand by a scalar value.
+ *
+ * @param {mat4} out the receiving vector
+ * @param {mat4} a the first operand
+ * @param {mat4} b the second operand
+ * @param {number} scale the amount to scale b's elements by before adding
+ * @returns {mat4} out
+ */
+ public static multiplyScalarAndAdd (out: mat4, a: mat4, b: mat4, scale: number): mat4
+
+ /**
+ * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
+ *
+ * @param {mat4} a The first matrix.
+ * @param {mat4} b The second matrix.
+ * @returns {boolean} True if the matrices are equal, false otherwise.
+ */
+ public static exactEquals (a: mat4, b: mat4): boolean
+
+ /**
+ * Returns whether or not the matrices have approximately the same elements in the same position.
+ *
+ * @param {mat4} a The first matrix.
+ * @param {mat4} b The second matrix.
+ * @returns {boolean} True if the matrices are equal, false otherwise.
+ */
+ public static equals (a: mat4, b: mat4): boolean
+
}
// quat
-declare namespace quat {
+export class quat extends Float32Array {
+ private typeQuat: number;
/**
* Creates a new identity quat
*
* @returns a new quaternion
*/
- export function create(): GLM.IArray;
+ public static create(): quat;
/**
* Creates a new quat initialized with values from an existing quaternion
@@ -1877,7 +2685,7 @@ declare namespace quat {
* @returns a new quaternion
* @function
*/
- export function clone(a: GLM.IArray): GLM.IArray;
+ public static clone(a: quat): quat;
/**
* Creates a new quat initialized with the given values
@@ -1889,7 +2697,7 @@ declare namespace quat {
* @returns a new quaternion
* @function
*/
- export function fromValues(x: number, y: number, z: number, w: number): GLM.IArray;
+ public static fromValues(x: number, y: number, z: number, w: number): quat;
/**
* Copy the values from one quat to another
@@ -1899,7 +2707,7 @@ declare namespace quat {
* @returns out
* @function
*/
- export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static copy(out: quat, a: quat): quat;
/**
* Set the components of a quat to the given values
@@ -1912,7 +2720,7 @@ declare namespace quat {
* @returns out
* @function
*/
- export function set(out: GLM.IArray, x: number, y: number, z: number, w: number): GLM.IArray;
+ public static set(out: quat, x: number, y: number, z: number, w: number): quat;
/**
* Set a quat to the identity quaternion
@@ -1920,7 +2728,34 @@ declare namespace quat {
* @param out the receiving quaternion
* @returns out
*/
- export function identity(out: GLM.IArray): GLM.IArray;
+ public static identity(out: quat): quat;
+
+ /**
+ * Sets a quaternion to represent the shortest rotation from one
+ * vector to another.
+ *
+ * Both vectors are assumed to be unit length.
+ *
+ * @param {quat} out the receiving quaternion.
+ * @param {vec3} a the initial vector
+ * @param {vec3} b the destination vector
+ * @returns {quat} out
+ */
+ public static rotationTo (out: quat, a: vec3 | number[], b: vec3 | number[]): quat;
+
+ /**
+ * Sets the specified quaternion with values corresponding to the given
+ * axes. Each axis is a vec3 and is expected to be unit length and
+ * perpendicular to all other specified axes.
+ *
+ * @param {vec3} view the vector representing the viewing direction
+ * @param {vec3} right the vector representing the local "right" direction
+ * @param {vec3} up the vector representing the local "up" direction
+ * @returns {quat} out
+ */
+ public static setAxes (out: quat, view: vec3 | number[], right: vec3 | number[], up: vec3 | number[]): quat
+
+
/**
* Sets a quat from the given angle and rotation axis,
@@ -1931,7 +2766,22 @@ declare namespace quat {
* @param rad the angle in radians
* @returns out
**/
- export function setAxisAngle(out: GLM.IArray, axis: GLM.IArray, rad: number): GLM.IArray;
+ public static setAxisAngle(out: quat, axis: vec3 | number[], rad: number): quat;
+
+ /**
+ * Gets the rotation axis and angle for a given
+ * quaternion. If a quaternion is created with
+ * setAxisAngle, this method will return the same
+ * values as providied in the original parameter list
+ * OR functionally equivalent values.
+ * Example: The quaternion formed by axis [0, 0, 1] and
+ * angle -90 is the same as the quaternion formed by
+ * [0, 0, 1] and 270. This method favors the latter.
+ * @param {vec3} out_axis Vector receiving the axis of rotation
+ * @param {quat} q Quaternion to be decomposed
+ * @return {number} Angle, in radians, of the rotation
+ */
+ public static getAxisAngle (out_axis: vec3 | number[], q: quat): number
/**
* Adds two quat's
@@ -1942,7 +2792,7 @@ declare namespace quat {
* @returns out
* @function
*/
- export function add(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static add(out: quat, a: quat, b: quat): quat;
/**
* Multiplies two quat's
@@ -1952,7 +2802,7 @@ declare namespace quat {
* @param b the second operand
* @returns out
*/
- export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static multiply(out: quat, a: quat, b: quat): quat;
/**
* Multiplies two quat's
@@ -1962,7 +2812,7 @@ declare namespace quat {
* @param b the second operand
* @returns out
*/
- export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static mul(out: quat, a: quat, b: quat): quat;
/**
* Scales a quat by a scalar number
@@ -1973,7 +2823,7 @@ declare namespace quat {
* @returns out
* @function
*/
- export function scale(out: GLM.IArray, a: GLM.IArray, b: number): GLM.IArray;
+ public static scale(out: quat, a: quat, b: number): quat;
/**
* Calculates the length of a quat
@@ -1982,7 +2832,7 @@ declare namespace quat {
* @returns length of a
* @function
*/
- export function length(a: GLM.IArray): number;
+ public static length(a: quat): number;
/**
* Calculates the length of a quat
@@ -1991,7 +2841,7 @@ declare namespace quat {
* @returns length of a
* @function
*/
- export function len(a: GLM.IArray): number;
+ public static len(a: quat): number;
/**
* Calculates the squared length of a quat
@@ -2000,7 +2850,7 @@ declare namespace quat {
* @returns squared length of a
* @function
*/
- export function squaredLength(a: GLM.IArray): number;
+ public static squaredLength(a: quat): number;
/**
* Calculates the squared length of a quat
@@ -2009,7 +2859,7 @@ declare namespace quat {
* @returns squared length of a
* @function
*/
- export function sqrLen(a: GLM.IArray): number;
+ public static sqrLen(a: quat): number;
/**
* Normalize a quat
@@ -2019,7 +2869,7 @@ declare namespace quat {
* @returns out
* @function
*/
- export function normalize(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static normalize(out: quat, a: quat): quat;
/**
* Calculates the dot product of two quat's
@@ -2029,7 +2879,7 @@ declare namespace quat {
* @returns dot product of a and b
* @function
*/
- export function dot(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): number;
+ public static dot(a: quat, b: quat): number;
/**
* Performs a linear interpolation between two quat's
@@ -2041,7 +2891,7 @@ declare namespace quat {
* @returns out
* @function
*/
- export function lerp(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, t: number): GLM.IArray;
+ public static lerp(out: quat, a: quat, b: quat, t: number): quat;
/**
* Performs a spherical linear interpolation between two quat
@@ -2052,7 +2902,20 @@ declare namespace quat {
* @param t interpolation amount between the two inputs
* @returns out
*/
- export function slerp(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, t: number): GLM.IArray;
+ public static slerp(out: quat, a: quat, b: quat, t: number): quat;
+
+ /**
+ * Performs a spherical linear interpolation with two control points
+ *
+ * @param {quat} out the receiving quaternion
+ * @param {quat} a the first operand
+ * @param {quat} b the second operand
+ * @param {quat} c the third operand
+ * @param {quat} d the fourth operand
+ * @param {number} t interpolation amount
+ * @returns {quat} out
+ */
+ public static sqlerp(out: quat, a: quat, b: quat, c: quat, d: quat, t: number): quat;
/**
* Calculates the inverse of a quat
@@ -2061,7 +2924,7 @@ declare namespace quat {
* @param a quat to calculate inverse of
* @returns out
*/
- export function invert(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static invert(out: quat, a: quat): quat;
/**
* Calculates the conjugate of a quat
@@ -2071,15 +2934,15 @@ declare namespace quat {
* @param a quat to calculate conjugate of
* @returns out
*/
- export function conjugate(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static conjugate(out: quat, a: quat): quat;
/**
- * Returns a string representation of a quatenion
+ * Returns a string representation of a quaternion
*
- * @param vec vector to represent as a string
- * @returns string representation of the vector
+ * @param a quat to represent as a string
+ * @returns string representation of the quat
*/
- export function str(a: GLM.IArray): string;
+ public static str(a: quat): string;
/**
* Rotates a quaternion by the given angle about the X axis
@@ -2089,7 +2952,7 @@ declare namespace quat {
* @param rad angle (in radians) to rotate
* @returns out
*/
- export function rotateX(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+ public static rotateX(out: quat, a: quat, rad: number): quat;
/**
* Rotates a quaternion by the given angle about the Y axis
@@ -2099,7 +2962,7 @@ declare namespace quat {
* @param rad angle (in radians) to rotate
* @returns out
*/
- export function rotateY(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+ public static rotateY(out: quat, a: quat, rad: number): quat;
/**
* Rotates a quaternion by the given angle about the Z axis
@@ -2109,7 +2972,7 @@ declare namespace quat {
* @param rad angle (in radians) to rotate
* @returns out
*/
- export function rotateZ(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+ public static rotateZ(out: quat, a: quat, rad: number): quat;
/**
* Creates a quaternion from the given 3x3 rotation matrix.
@@ -2122,20 +2985,20 @@ declare namespace quat {
* @returns out
* @function
*/
- export function fromMat3(out: GLM.IArray, m: GLM.IArray): GLM.IArray;
+ public static fromMat3(out: quat, m: mat3): quat;
/**
* Sets the specified quaternion with values corresponding to the given
* axes. Each axis is a vec3 and is expected to be unit length and
* perpendicular to all other specified axes.
*
+ * @param out the receiving quat
* @param view the vector representing the viewing direction
* @param right the vector representing the local "right" direction
* @param up the vector representing the local "up" direction
* @returns out
*/
- export function setAxes(out: GLM.IArray, view: GLM.IArray, right: GLM.IArray,
- up: GLM.IArray): GLM.IArray;
+ public static setAxes(out: quat, view: vec3 | number[], right: vec3 | number[], up: vec3 | number[]): quat;
/**
* Sets a quaternion to represent the shortest rotation from one
@@ -2148,7 +3011,7 @@ declare namespace quat {
* @param b the destination vector
* @returns out
*/
- export function rotationTo(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static rotationTo(out: quat, a: vec3 | number[], b: vec3 | number[]): quat;
/**
* Calculates the W component of a quat from the X, Y, and Z components.
@@ -2159,5 +3022,23 @@ declare namespace quat {
* @param a quat to calculate W component of
* @returns out
*/
- export function calculateW(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static calculateW(out: quat, a: quat): quat;
+
+ /**
+ * Returns whether or not the quaternions have exactly the same elements in the same position (when compared with ===)
+ *
+ * @param {quat} a The first vector.
+ * @param {quat} b The second vector.
+ * @returns {boolean} True if the quaternions are equal, false otherwise.
+ */
+ public static exactEquals (a: quat, b: quat): boolean;
+
+ /**
+ * Returns whether or not the quaternions have approximately the same elements in the same position.
+ *
+ * @param {quat} a The first vector.
+ * @param {quat} b The second vector.
+ * @returns {boolean} True if the quaternions are equal, false otherwise.
+ */
+ public static equals (a: quat, b: quat): boolean;
}
diff --git a/heatmap.js/package.json b/heatmap.js/package.json
new file mode 100644
index 0000000000..711ba15e43
--- /dev/null
+++ b/heatmap.js/package.json
@@ -0,0 +1,5 @@
+{
+ "dependencies": {
+ "@types/leaflet": "^0.7"
+ }
+}
\ No newline at end of file
diff --git a/heatmap.js/tsconfig.json b/heatmap.js/tsconfig.json
index 9699c002a9..d1b8fbae24 100644
--- a/heatmap.js/tsconfig.json
+++ b/heatmap.js/tsconfig.json
@@ -5,9 +5,6 @@
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
- "typeRoots": [
- "../"
- ],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
diff --git a/jest/index.d.ts b/jest/index.d.ts
index b7ddcdf04e..d0660193f6 100644
--- a/jest/index.d.ts
+++ b/jest/index.d.ts
@@ -1,80 +1,150 @@
-// Type definitions for Jest 0.9.0
+// Type definitions for Jest 15.1.1
// Project: http://facebook.github.io/jest/
-// Definitions by: Asana
+// Definitions by: Asana , Ivo Stratev , jwbay
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-///
-
-declare function afterEach(fn: jest.EmptyFunction): void;
-declare function beforeEach(fn: jest.EmptyFunction): void;
-declare function describe(name: string, fn: jest.EmptyFunction): void;
+declare var beforeAll: jest.Lifecycle;
+declare var beforeEach: jest.Lifecycle;
+declare var afterAll: jest.Lifecycle;
+declare var afterEach: jest.Lifecycle;
+declare var describe: jest.Describe;
+declare var fdescribe: jest.Describe;
+declare var xdescribe: jest.Describe;
declare var it: jest.It;
+declare var fit: jest.It;
+declare var xit: jest.It;
declare var test: jest.It;
-declare function pit(name: string, fn: jest.EmptyFunction): void;
-
-declare function xdescribe(name: string, fn: jest.EmptyFunction): void;
-declare function xit(name: string, fn: jest.EmptyFunction): void;
+declare var xtest: jest.It;
declare function expect(actual: any): jest.Matchers;
interface NodeRequire {
+ /** Returns the actual module instead of a mock, bypassing all checks on whether the module should receive a mock implementation or not. */
requireActual(moduleName: string): any;
+ /** Returns a mock module instead of the actual module, bypassing all checks on whether the module should be required normally or not. */
+ requireMock(moduleName: string): any;
}
declare namespace jest {
- function addMatchers(matchers: CustomMatcherFactories): void;
+ function addMatchers(matchers: jasmine.CustomMatcherFactories): void;
+ /** Disables automatic mocking in the module loader. */
function autoMockOff(): void;
+ /** Enables automatic mocking in the module loader. */
function autoMockOn(): void;
+ /** Removes any pending timers from the timer system. If any timers have been scheduled, they will be cleared and will never have the opportunity to execute in the future. */
function clearAllTimers(): void;
- function currentTestPath(): string;
+ /** Indicates that the module system should never return a mocked version of the specified module, including all of the specificied module's dependencies. */
+ function deepUnmock(moduleName: string): void;
+ /** Disables automatic mocking in the module loader. */
function disableAutomock(): void;
- function fn(implementation?: Function): Mock;
+ /** Mocks a module with an auto-mocked version when it is being required. */
+ function doMock(moduleName: string): void;
+ /** Indicates that the module system should never return a mocked version of the specified module from require() (e.g. that it should always return the real module). */
function dontMock(moduleName: string): void;
- function genMockFromModule(moduleName: string): Mock;
- function mock(moduleName: string, factory?: Function): void;
+ /** Enables automatic mocking in the module loader. */
+ function enableAutomock(): void;
+ /** Creates a mock function. Optionally takes a mock implementation. */
+ function fn(implementation?: Function): Mock;
+ /** Use the automatic mocking system to generate a mocked version of the given module. */
+ function genMockFromModule(moduleName: string): T;
+ /** Returns whether the given function is a mock function. */
+ function isMockFunction(fn: any): fn is Mock;
+ /** Mocks a module with an auto-mocked version when it is being required. */
+ function mock(moduleName: string, factory?: any, options?: MockOptions): void;
+ /** Resets the module registry - the cache of all required modules. This is useful to isolate modules where local state might conflict between tests. */
+ function resetModuleRegistry(): void;
+ /** Resets the module registry - the cache of all required modules. This is useful to isolate modules where local state might conflict between tests. */
+ function resetModules(): void;
+ /** Exhausts tasks queued by setImmediate(). */
+ function runAllImmediates(): void;
+ /** Exhausts the micro-task queue (usually interfaced in node via process.nextTick). */
function runAllTicks(): void;
+ /** Exhausts the macro-task queue (i.e., all tasks queued by setTimeout() and setInterval()). */
function runAllTimers(): void;
+ /** Executes only the macro-tasks that are currently pending (i.e., only the tasks that have been queued by setTimeout() or setInterval() up to this point).
+ * If any of the currently pending macro-tasks schedule new macro-tasks, those new tasks will not be executed by this call. */
function runOnlyPendingTimers(): void;
+ /** Explicitly supplies the mock object that the module system should return for the specified module. */
function setMock(moduleName: string, moduleExports: T): void;
+ /** Indicates that the module system should never return a mocked version of the specified module from require() (e.g. that it should always return the real module). */
function unmock(moduleName: string): void;
+ /** Instructs Jest to use fake versions of the standard timer functions. */
+ function useFakeTimers(): void;
+ /** Instructs Jest to use the real versions of the standard timer functions. */
+ function useRealTimers(): void;
+
+ interface MockOptions {
+ virtual?: boolean;
+ }
interface EmptyFunction {
(): void;
}
- interface Matchers {
- not: Matchers;
- toThrow(expected?: any): boolean;
- toThrowError(expected?: any): boolean;
- toBe(expected: any): boolean;
- toEqual(expected: any): boolean;
- toBeFalsy(): boolean;
- toBeTruthy(): boolean;
- toBeNull(): boolean;
- toBeDefined(): boolean;
- toBeUndefined(): boolean;
- toMatch(expected: RegExp): boolean;
- toContain(expected: string): boolean;
- toBeCloseTo(expected: number, delta: number): boolean;
- toBeGreaterThan(expected: number): boolean;
- toBeLessThan(expected: number): boolean;
- toBeCalled(): boolean;
- toBeCalledWith(...args: any[]): boolean;
- lastCalledWith(...args: any[]): boolean;
+ interface DoneCallback {
+ (...args: any[]): any
+ fail(error?: string | { message: string }): any;
+ }
+
+ interface ProvidesCallback {
+ (cb?: DoneCallback): any;
+ }
+
+ interface Lifecycle {
+ (fn: ProvidesCallback): any;
}
interface It {
- (name: string, fn: EmptyFunction): void;
- only(name: string, fn: EmptyFunction): void;
+ (name: string, fn: ProvidesCallback): void;
+ only: It;
+ skip: It;
}
- interface Mock {
+ interface Describe {
+ (name: string, fn: EmptyFunction): void
+ only: Describe;
+ skip: Describe;
+ }
+
+ interface Matchers {
+ not: Matchers;
+ lastCalledWith(...args: any[]): void;
+ toBe(expected: any): void;
+ toBeCalled(): void;
+ toBeCalledWith(...args: any[]): void;
+ toBeCloseTo(expected: number, delta: number): void;
+ toBeDefined(): void;
+ toBeFalsy(): void;
+ toBeGreaterThan(expected: number): void;
+ toBeGreaterThanOrEqual(expected: number): void;
+ toBeInstanceOf(expected: any): void
+ toBeLessThan(expected: number): void;
+ toBeLessThanOrEqual(expected: number): void;
+ toBeNull(): void;
+ toBeTruthy(): void;
+ toBeUndefined(): void;
+ toContain(expected: any): void;
+ toEqual(expected: any): void;
+ toHaveBeenCalled(): boolean;
+ toHaveBeenCalledTimes(expected: number): boolean;
+ toHaveBeenCalledWith(...params: any[]): boolean;
+ toMatch(expected: string | RegExp): void;
+ toMatchSnapshot(): void;
+ toThrow(): void;
+ toThrowError(error?: string | Constructable | RegExp): void;
+ }
+
+ interface Constructable {
+ new (...args: any[]): any
+ }
+
+ interface Mock extends Function {
new (): T;
- (...args: any[]): any; // TODO please fix this line! added for TypeScript 1.1.0-1 https://github.com/DefinitelyTyped/DefinitelyTyped/pull/2932
+ (...args: any[]): any;
mock: MockContext;
mockClear(): void;
mockImplementation(fn: Function): Mock;
- mockImpl(fn: Function): Mock;
+ mockImplementationOnce(fn: Function): Mock;
mockReturnThis(): Mock;
mockReturnValue(value: any): Mock;
mockReturnValueOnce(value: any): Mock;
@@ -84,42 +154,138 @@ declare namespace jest {
calls: any[][];
instances: T[];
}
+}
+
+//Jest ships with a copy of Jasmine. They monkey-patch its APIs and divergence/deprecation are expected.
+//Relevant parts of Jasmine's API are below so they can be changed and removed over time.
+//This file can't reference jasmine.d.ts since the globals aren't compatible.
+
+declare function spyOn(object: any, method: string): jasmine.Spy;
+/** If you call the function pending anywhere in the spec body, no matter the expectations, the spec will be marked pending. */
+declare function pending(reason?: string): void;
+/** Fails a test when called within one. */
+declare function fail(error?: any): void;
+declare namespace jasmine {
+ var clock: () => Clock;
+ function any(aclass: any): Any;
+ function anything(): Any;
+ function arrayContaining(sample: any[]): ArrayContaining;
+ function objectContaining(sample: any): ObjectContaining;
+ function createSpy(name: string, originalFn?: Function): Spy;
+ function createSpyObj(baseName: string, methodNames: any[]): any;
+ function createSpyObj(baseName: string, methodNames: any[]): T;
+ function pp(value: any): string;
+ function addCustomEqualityTester(equalityTester: CustomEqualityTester): void;
+ function addMatchers(matchers: CustomMatcherFactories): void;
+ function stringMatching(value: string | RegExp): Any;
+
+ interface Clock {
+ install(): void;
+ uninstall(): void;
+ /** Calls to any registered callback are triggered when the clock is ticked forward via the jasmine.clock().tick function, which takes a number of milliseconds. */
+ tick(ms: number): void;
+ mockDate(date?: Date): void;
+ }
+
+ interface Any {
+ new (expectedClass: any): any;
+ jasmineMatches(other: any): boolean;
+ jasmineToString(): string;
+ }
+
+ interface ArrayContaining {
+ new (sample: any[]): any;
+ asymmetricMatch(other: any): boolean;
+ jasmineToString(): string;
+ }
+
+ interface ObjectContaining {
+ new (sample: any): any;
+ jasmineMatches(other: any, mismatchKeys: any[], mismatchValues: any[]): boolean;
+ jasmineToString(): string;
+ }
+
+ interface Spy {
+ (...params: any[]): any;
+ identity: string;
+ and: SpyAnd;
+ calls: Calls;
+ mostRecentCall: { args: any[]; };
+ argsForCall: any[];
+ wasCalled: boolean;
+ }
+
+ interface SpyAnd {
+ /** By chaining the spy with and.callThrough, the spy will still track all calls to it but in addition it will delegate to the actual implementation. */
+ callThrough(): Spy;
+ /** By chaining the spy with and.returnValue, all calls to the function will return a specific value. */
+ returnValue(val: any): Spy;
+ /** By chaining the spy with and.returnValues, all calls to the function will return specific values in order until it reaches the end of the return values list. */
+ returnValues(...values: any[]): Spy;
+ /** By chaining the spy with and.callFake, all calls to the spy will delegate to the supplied function. */
+ callFake(fn: Function): Spy;
+ /** By chaining the spy with and.throwError, all calls to the spy will throw the specified value. */
+ throwError(msg: string): Spy;
+ /** When a calling strategy is used for a spy, the original stubbing behavior can be returned at any time with and.stub. */
+ stub(): Spy;
+ }
+
+ interface Calls {
+ /** By chaining the spy with calls.any(), will return false if the spy has not been called at all, and then true once at least one call happens. */
+ any(): boolean;
+ /** By chaining the spy with calls.count(), will return the number of times the spy was called */
+ count(): number;
+ /** By chaining the spy with calls.argsFor(), will return the arguments passed to call number index */
+ argsFor(index: number): any[];
+ /** By chaining the spy with calls.allArgs(), will return the arguments to all calls */
+ allArgs(): any[];
+ /** By chaining the spy with calls.all(), will return the context (the this) and arguments passed all calls */
+ all(): CallInfo[];
+ /** By chaining the spy with calls.mostRecent(), will return the context (the this) and arguments for the most recent call */
+ mostRecent(): CallInfo;
+ /** By chaining the spy with calls.first(), will return the context (the this) and arguments for the first call */
+ first(): CallInfo;
+ /** By chaining the spy with calls.reset(), will clears all tracking for a spy */
+ reset(): void;
+ }
+
+ interface CallInfo {
+ /** The context (the this) for the call */
+ object: any;
+ /** All arguments passed to the call */
+ args: any[];
+ /** The return value of the call */
+ returnValue: any;
+ }
- // taken from Jasmine since addMatchers calls into the jasmine api
interface CustomMatcherFactories {
[index: string]: CustomMatcherFactory;
}
- // taken from Jasmine since addMatchers calls into the jasmine api
interface CustomMatcherFactory {
(util: MatchersUtil, customEqualityTesters: Array): CustomMatcher;
}
- // taken from Jasmine since addMatchers calls into the jasmine api
interface MatchersUtil {
equals(a: any, b: any, customTesters?: Array): boolean;
contains(haystack: ArrayLike | string, needle: any, customTesters?: Array): boolean;
buildFailureMessage(matcherName: string, isNot: boolean, actual: any, ...expected: Array): string;
}
- // taken from Jasmine since addMatchers calls into the jasmine api
interface CustomEqualityTester {
(first: any, second: any): boolean;
}
- // taken from Jasmine since addMatchers calls into the jasmine api
interface CustomMatcher {
compare(actual: T, expected: T): CustomMatcherResult;
compare(actual: any, expected: any): CustomMatcherResult;
}
- // taken from Jasmine since addMatchers calls into the jasmine api
interface CustomMatcherResult {
pass: boolean;
- message: string;
+ message: string | (() => string);
}
- // taken from Jasmine which takes from TypeScript lib.core.es6.d.ts, applicable to CustomMatchers.contains()
interface ArrayLike {
length: number;
[n: number]: T;
diff --git a/jest/jest-tests.ts b/jest/jest-tests.ts
index c35b5d19f2..e774ad1fb5 100644
--- a/jest/jest-tests.ts
+++ b/jest/jest-tests.ts
@@ -1,4 +1,4 @@
-
+///
// Tests based on the Jest website
jest.unmock('../sum');
@@ -37,8 +37,6 @@ describe('fetchCurrentUser', function() {
// unmock is the recommended approach for unmocking...
jest.unmock('../displayUser.js')
-// ...but dontMock also still works.
-jest.dontMock('jquery');
describe('displayUser', function() {
it('displays a user after a click', function() {
@@ -100,6 +98,157 @@ describe('CheckboxWithLabel', function() {
});
});
+jest.runAllTicks();
+xdescribe('Hooks and Suits', function () {
+ let tested: boolean;
+
+ beforeEach(function () {
+ tested = false;
+ });
+
+ afterEach(function () {
+ tested = true;
+ });
+
+ test('tested', function () {
+ expect(tested).toBeTruthy();
+ expect(tested).not.toBeFalsy();
+ });
+
+ fit('tested', function () {
+ expect(tested).toBeDefined();
+ expect(tested).not.toBeUndefined();
+ });
+
+ xit('expect null to be null', function () {
+ expect(null).toBeNull();
+ });
+});
+
+describe('compartion', function () {
+ var sum: (a: number, b: number) => number = require.requireMock('../sum');
+
+ it('compares is 7 + 2 greater than 3', function () {
+ expect(sum(7, 2)).toBeGreaterThan(3);
+ });
+
+ it('compares is 2 + 7 greater than or equal to 3', function () {
+ expect(sum(2, 7)).toBeGreaterThanOrEqual(3);
+ });
+
+ it('compares is 3 less than 3 + 4', function () {
+ expect(3).toBeLessThan(sum(3, 4));
+ });
+
+ it('compares is 3 less than or equal to 4 + 3', function () {
+ expect(3).toBeLessThanOrEqual(sum(4, 3));
+ });
+
+ it('works sanely with simple decimals', function () {
+ expect(0.2 + 0.1).toBeCloseTo(0.3, 5);
+ });
+});
+
+describe('toThrow API', function () {
+ function throwTypeError(): void {
+ throw new TypeError('toThrow Definition was out of date');
+ }
+
+ it('throws', function () {
+ expect(throwTypeError()).toThrow();
+ });
+
+ it('throws TypeError', function () {
+ expect(throwTypeError()).toThrowError(TypeError);
+ });
+
+ it('throws \'Definition was out of date\'', function () {
+ expect(throwTypeError()).toThrowError(/Definition was out of date/);
+ });
+
+ it('throws \'toThorow Definition was out of date\'', function () {
+ expect(throwTypeError()).toThrowError('toThrow Definition was out of date');
+ });
+});
+
+describe('missing tests', function () {
+ it('creates closures', function () {
+ class Closure {
+ private arg: T;
+
+ public constructor(private fn: (arg: T) => void) {
+ this.fn = fn;
+ }
+
+ public bind(arg: T): void {
+ this.arg = arg;
+ }
+
+ public call(): void {
+ this.fn(this.arg);
+ }
+ }
+
+ type StringClosure = (arg: string) => void;
+ let spy: jest.Mock = jest.fn();
+ let closure: Closure = new Closure(spy);
+ closure.bind('jest');
+ closure.call();
+ expect(spy).lastCalledWith('jest');
+ expect(spy).toBeCalledWith('jest');
+ expect(jest.isMockFunction(spy)).toBeTruthy();
+ });
+
+ it('tests all mising Mocks functionality', function () {
+ type FruitsGetter = () => Array;
+ let mock: jest.Mock = jest.fn();
+ mock.mockImplementationOnce(() => ['Orange', 'Apple', 'Plum'])
+ jest.setMock('./../tesks/getFruits', mock);
+ const getFruits: FruitsGetter = require('./../tesks/getFruits');
+ expect(getFruits()).toContain('Orange');
+ mock.mockReturnValueOnce(['Apple', 'Plum']);
+ expect(mock()).not.toContain('Orange');
+ mock.mockReturnValue([]); //Deprecated: Use jest.fn(() => value) instead.
+ mock.mockClear();
+ let thisMock: jest.Mock = jest.fn().mockReturnThis();
+ expect(thisMock()).toBe(this);
+ });
+
+ it('creates snapshoter', function () {
+ jest.disableAutomock();
+ jest.mock('./render', () => jest.fn((): string => "{Link to: \"facebook\"}"), { virtual: true });
+ const render: () => string = require('./render');
+ expect(render()).toMatch(/Link/);
+ jest.enableAutomock();
+ });
+
+ it('runs only pending timers', function () {
+ jest.useRealTimers();
+ setTimeout(() => expect(1).not.toEqual(0), 3000);
+ jest.runOnlyPendingTimers();
+ });
+
+ it('runs all timers', function () {
+ jest.clearAllTimers();
+ jest.useFakeTimers();
+ setTimeout(() => expect(0).not.toEqual(1), 3000);
+ jest.runAllTimers();
+ });
+
+ it('cleares cache', function () {
+ const sum1 = require('../sum');
+ jest.resetModules();
+ const sum2 = require('../sum');
+ expect(sum1).not.toBe(sum2);
+ })
+});
+
+describe('toMatchSnapshot', function () {
+ it('compares snapshots', function () {
+ expect({ type: 'a', props: { href: 'https://www.facebook.com/' }, children: [ 'Facebook' ] }).toMatchSnapshot();
+ });
+});
+
function testInstances() {
var mockFn = jest.fn();
var a = new mockFn();
@@ -123,3 +272,82 @@ function testMockImplementation() {
mockFn.mock.calls[0][0] === 0; // true
mockFn.mock.calls[1][0] === 1; // true
}
+
+// Test from jest Docs:
+describe('genMockFromModule', function () {
+ // Interfaces:
+ interface MockFiles {
+ [index: string]: string;
+ }
+
+ interface MockedFS {
+ readdirSync: (dir: string) => string[];
+ __setMockFiles: (newMockFiles: MockFiles) => void ;
+ }
+
+ // ------------------------------------------------------------------------------------
+ // FileSummarizer.ts
+
+ const fs = require('fs');
+
+ function summarizeFilesInDirectorySync(directory: string): string[] {
+ return fs.readdirSync(directory).map((fileName: string) => ({
+ fileName,
+ directory,
+ }));
+ }
+
+ //export default summarizeFilesInDirectorySync; // For sake of compilation
+
+ // ------------------------------------------------------------------------------------
+ // __mocks__/fs.js
+
+ const path = require('path');
+
+ const mockedFS: MockedFS = jest.genMockFromModule('fs');
+
+ let mockFiles: any = Object.create(null);
+ function __setMockFiles(newMockFiles: MockFiles): void {
+ mockFiles = Object.create(null);
+ for(const file in newMockFiles) {
+ const dir: string = path.dirname(file);
+
+ if (!mockFiles[dir]) {
+ mockFiles[dir] = [];
+ }
+ mockFiles[dir].push(path.basename(file));
+ }
+ }
+
+ function readdirSync(directoryPath: string): string[] {
+ return mockFiles[directoryPath] || [];
+ }
+
+ mockedFS.readdirSync = readdirSync;
+ mockedFS.__setMockFiles = __setMockFiles;
+
+ //export = mockedFS; // For sake of compilation
+ // ------------------------------------------------------------------------------------
+ // __tests__/FileSummarizer-test.js
+
+ jest.mock('fs');
+
+ describe('listFilesInDirectorySync', () => {
+ const MOCK_FILE_INFO: MockFiles = {
+ '/path/to/file1.js': 'console.log("file1 contents");',
+ '/path/to/file2.txt': 'file2 contents',
+ };
+
+ beforeEach(() => {
+ // Set up some mocked out file info before each test
+ (require('fs') as MockedFS).__setMockFiles(MOCK_FILE_INFO);
+ });
+
+ it('includes all files in the directory in the summary', () => {
+ const FileSummarizer: (dir: string) => string[] = require('../FileSummarizer');
+ const fileSummary = FileSummarizer('/path/to');
+
+ expect(fileSummary.length).toBe(2);
+ });
+ });
+});
diff --git a/jquery.datatables/index.d.ts b/jquery.datatables/index.d.ts
index caa895b7d5..a2fffa4c75 100644
--- a/jquery.datatables/index.d.ts
+++ b/jquery.datatables/index.d.ts
@@ -1,4 +1,4 @@
-// Type definitions for JQuery DataTables 1.10.5
+// Type definitions for JQuery DataTables 1.10.6
// Project: http://www.datatables.net
// Definitions by: Kiarash Ghiaseddin , Omid Rad , Armin Sander
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -159,7 +159,7 @@ declare namespace DataTables {
/**
* Get jquery object
*/
- $(selector: string | Node | Node[]| JQuery, modifier?: ObjectSelectorModifier): JQuery;
+ $(selector: string | Node | Node[] | JQuery, modifier?: ObjectSelectorModifier): JQuery;
///// Almost identical to $ in operation, but in this case returns the data for the matched rows.
//_(selector: string | Node | Node[] | JQuery, modifier?: ObjectSelectorModifier): JQuery;
@@ -188,6 +188,11 @@ declare namespace DataTables {
*/
draw(reset?: boolean): DataTable;
+ /*
+ * Get the initialisation options used for the table. Since: DataTables 1.10.6
+ */
+ init(): Settings;
+
/**
* Table events removal.
*
@@ -628,6 +633,13 @@ declare namespace DataTables {
*/
data(): DataTable;
+ /**
+ * Iterate over each selected cell, with the function context set to be the cell in question. Since: DataTables 1.10.6
+ *
+ * @param fn Function to execute for every cell selected.
+ */
+ every(fn: (cellRowIdx: number, cellColIdx: number, tableLoop: number, cellLoop: number) => void): DataTable;
+
/**
* Get index information about the selected cells
*/
@@ -749,6 +761,13 @@ declare namespace DataTables {
*/
dataSrc(): DataTable;
+ /**
+ * Iterate over each selected column, with the function context set to be the column in question. Since: DataTables 1.10.6
+ *
+ * @param fn Function to execute for every column selected.
+ */
+ every(fn: (colIdx: number, tableLoop: number, colLoop: number) => void): DataTable;
+
/**
* Get the column indexes of the selected columns.
*
@@ -847,7 +866,7 @@ declare namespace DataTables {
*
* @param data Data to use for the new row. This may be an array, object or Javascript object instance, but must be in the same format as the other data in the table
*/
- add(data: any[]| Object): DataTable;
+ add(data: any[] | Object): DataTable;
}
interface RowMethods extends DataTableCore, CommonRowMethod {
@@ -859,14 +878,14 @@ declare namespace DataTables {
/**
* Get the data for the selected row
*/
- data(): any[]| Object;
+ data(): any[] | Object;
/**
* Set the data for the selected row
*
* @param d Data to use for the row.
*/
- data(d: any[]| Object): DataTable;
+ data(d: any[] | Object): DataTable;
/**
* Get the row index of the row column.
@@ -919,7 +938,14 @@ declare namespace DataTables {
*
* @param d Data to use for the row.
*/
- data(d: any[]| Object): DataTable;
+ data(d: any[] | Object): DataTable;
+
+ /**
+ * Iterate over each selected row, with the function context set to be the row in question. Since: DataTables 1.10.6
+ *
+ * @param fn Function to execute for every row selected.
+ */
+ every(fn: (rowIdx: number, tableLoop: number, rowLoop: number) => void): DataTable;
/**
* Get the row indexes of the selected rows.
@@ -1031,7 +1057,7 @@ declare namespace DataTables {
*
* @param table Selector string for table
*/
- Api(selector: string | Node | Node[]| JQuery): DataTables.DataTable;
+ Api(selector: string | Node | Node[] | JQuery): DataTables.DataTable;
}
export interface StaticUtilFunctions {
@@ -1175,7 +1201,7 @@ declare namespace DataTables {
/**
* Change the options in the page length select list. Since: 1.10
*/
- lengthMenu?: (number | string)[]| (number | string)[][];
+ lengthMenu?: (number | string)[] | (number | string)[][];
/**
* Control which cell the order event handler will be applied to in a column. Since: 1.10
@@ -1190,12 +1216,12 @@ declare namespace DataTables {
/**
* Initial order (sort) to apply to the table. Since: 1.10
*/
- order?: (string | number)[]| (string | number)[][];
+ order?: (string | number)[] | (string | number)[][];
/**
* Ordering to always be applied to the table. Since: 1.10
*/
- orderFixed?: (string | number)[]| (string | number)[][]| Object;
+ orderFixed?: (string | number)[] | (string | number)[][] | Object;
/**
* Multiple column ordering ability control. Since: 1.10
@@ -1395,7 +1421,11 @@ declare namespace DataTables {
}
interface FunctionAjaxData {
- (data: Object): string | Object;
+ /*
+ * @param data Data that DataTables has constructed for the request.
+ * @param settings DataTables settings object. Since 1.10.6
+ */
+ (data: Object, settings: Settings): string | Object;
}
//#endregion "ajax-settings"
@@ -1558,7 +1588,7 @@ declare namespace DataTables {
//#region "callback-functions"
interface FunctionCreateRow {
- (row: Node, data: any[]| Object, dataIndex: number): void;
+ (row: Node, data: any[] | Object, dataIndex: number): void;
}
interface FunctionDrawCallback {
@@ -1590,7 +1620,7 @@ declare namespace DataTables {
}
interface FunctionRowCallback {
- (row: Node, data: any[]| Object): void;
+ (row: Node, data: any[] | Object): void;
}
interface FunctionStateLoadCallback {
diff --git a/jquery.datatables/jquery.dataTables-tests.ts b/jquery.datatables/jquery.dataTables-tests.ts
index a39dfa0441..124630599d 100644
--- a/jquery.datatables/jquery.dataTables-tests.ts
+++ b/jquery.datatables/jquery.dataTables-tests.ts
@@ -159,7 +159,7 @@ $(document).ready(function () {
var ajaxFunc: DataTables.FunctionAjax = function (data, callback, settings) { };
- var ajaxDataFunc: DataTables.FunctionAjaxData = function (data) {
+ var ajaxDataFunc: DataTables.FunctionAjaxData = function (data, settings) {
return data;
};
@@ -309,6 +309,8 @@ $(document).ready(function () {
draw = dt.draw(true);
draw.$("");
+ var initSettings = dt.init();
+
var off = dt.off("event");
off = dt.off("event", function () { });
off.$("");
@@ -438,6 +440,9 @@ $(document).ready(function () {
console.log(data);
});
+ cells.every(function () { });
+ cells.every(function (cellRowIdx, cellColIdx, tableLoop, cellLoop) { });
+
var cell = dt.cell(":contains('Not shipped')");
cell = dt.cell(function () { });
cell = dt.cell($(""));
@@ -715,6 +720,9 @@ $(document).ready(function () {
}
dt.columns.adjust().draw(false); // adjust column sizing and redraw
+ dt.columns().every(function () { });
+ dt.columns().every(function (colIdx, tableLoop, colLoop) { });
+
//#endregion "Methods-Column"
//#region "Methods-Row"
@@ -754,6 +762,8 @@ $(document).ready(function () {
var rows_11 = dt.rows("selector").remove();
var rows_12 = dt.rows("selector").nodes();
var rows_13 = dt.rows.add([{}, {}]);
+ dt.rows().every(function () { });
+ dt.rows().every(function (rowIdx, tableLoop, rowLoop) { });
var table3 = $('#example').DataTable();
table3.row.add({
diff --git a/js-data/index.d.ts b/js-data/index.d.ts
index 515bf379d4..0121210095 100644
--- a/js-data/index.d.ts
+++ b/js-data/index.d.ts
@@ -15,7 +15,7 @@ declare namespace JSData {
catch(onRejected?:(error:any) => U | JSDataPromise): JSDataPromise;
// enhanced with finally
- finally(finallyCb?:() => U):JSDataPromise;
+ finally(finallyCb?:() => any): JSDataPromise;
}
interface DSConfiguration extends IDSResourceLifecycleEventHandlers {
diff --git a/jspdf/index.d.ts b/jspdf/index.d.ts
index 60246f04a1..e393e5fba1 100644
--- a/jspdf/index.d.ts
+++ b/jspdf/index.d.ts
@@ -42,7 +42,7 @@ declare module 'jspdf' {
'getPageInfo'(pageNumberOneBased:number):any;
'getCurrentPageInfo'():any;
};
- addPage():jsPDF;
+ addPage(sizes?: number[]):jsPDF;
setPage(n:number):jsPDF;
insertPage(beforePage:number):jsPDF;
movePage(targetPage:number, beforePage:number):jsPDF;
diff --git a/knex/index.d.ts b/knex/index.d.ts
index 997778406a..be794b9349 100644
--- a/knex/index.d.ts
+++ b/knex/index.d.ts
@@ -534,6 +534,7 @@ declare namespace Knex {
directory?: string;
extension?: string;
tableName?: string;
+ disableTransactions?: boolean;
}
interface Migrator {
diff --git a/knex/knex-tests.ts b/knex/knex-tests.ts
index 8ab2d325f5..947f3cd79e 100644
--- a/knex/knex-tests.ts
+++ b/knex/knex-tests.ts
@@ -616,7 +616,12 @@ knex.select('*')
//
// Migrations
//
-var config = { };
+var config = {
+ directory: "./migrations",
+ extension: "js",
+ tableName: "knex_migrations",
+ disableTransactions: false
+};
knex.migrate.make(name, config);
knex.migrate.make(name);
diff --git a/leaflet-curve/leaflet-curve-tests.ts b/leaflet-curve/leaflet-curve-tests.ts
index 243a3d620a..ec2461cbd2 100644
--- a/leaflet-curve/leaflet-curve-tests.ts
+++ b/leaflet-curve/leaflet-curve-tests.ts
@@ -1,7 +1,5 @@
///
-
-
var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
osmAttrib = '© OpenStreetMap contributors',
osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib}),
diff --git a/leaflet-curve/package.json b/leaflet-curve/package.json
new file mode 100644
index 0000000000..711ba15e43
--- /dev/null
+++ b/leaflet-curve/package.json
@@ -0,0 +1,5 @@
+{
+ "dependencies": {
+ "@types/leaflet": "^0.7"
+ }
+}
\ No newline at end of file
diff --git a/leaflet-curve/tsconfig.json b/leaflet-curve/tsconfig.json
index 00ee023363..a9004d9853 100644
--- a/leaflet-curve/tsconfig.json
+++ b/leaflet-curve/tsconfig.json
@@ -5,9 +5,6 @@
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
- "typeRoots": [
- "../"
- ],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
diff --git a/leaflet-draw/leaflet-draw-tests.ts b/leaflet-draw/leaflet-draw-tests.ts
index f148908917..885f576d1b 100644
--- a/leaflet-draw/leaflet-draw-tests.ts
+++ b/leaflet-draw/leaflet-draw-tests.ts
@@ -1,7 +1,5 @@
///
-
-
var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
osmAttrib = '© OpenStreetMap contributors',
osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib}),
diff --git a/leaflet-draw/package.json b/leaflet-draw/package.json
new file mode 100644
index 0000000000..711ba15e43
--- /dev/null
+++ b/leaflet-draw/package.json
@@ -0,0 +1,5 @@
+{
+ "dependencies": {
+ "@types/leaflet": "^0.7"
+ }
+}
\ No newline at end of file
diff --git a/leaflet-draw/tsconfig.json b/leaflet-draw/tsconfig.json
index 4319ebcf70..f9fb17e2ee 100644
--- a/leaflet-draw/tsconfig.json
+++ b/leaflet-draw/tsconfig.json
@@ -5,9 +5,6 @@
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
- "typeRoots": [
- "../"
- ],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
diff --git a/leaflet-editable/package.json b/leaflet-editable/package.json
new file mode 100644
index 0000000000..711ba15e43
--- /dev/null
+++ b/leaflet-editable/package.json
@@ -0,0 +1,5 @@
+{
+ "dependencies": {
+ "@types/leaflet": "^0.7"
+ }
+}
\ No newline at end of file
diff --git a/leaflet-editable/tsconfig.json b/leaflet-editable/tsconfig.json
index 670feb3695..a538a59492 100644
--- a/leaflet-editable/tsconfig.json
+++ b/leaflet-editable/tsconfig.json
@@ -5,9 +5,6 @@
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
- "typeRoots": [
- "../"
- ],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
diff --git a/leaflet-geocoder-mapzen/package.json b/leaflet-geocoder-mapzen/package.json
new file mode 100644
index 0000000000..711ba15e43
--- /dev/null
+++ b/leaflet-geocoder-mapzen/package.json
@@ -0,0 +1,5 @@
+{
+ "dependencies": {
+ "@types/leaflet": "^0.7"
+ }
+}
\ No newline at end of file
diff --git a/leaflet-geocoder-mapzen/tsconfig.json b/leaflet-geocoder-mapzen/tsconfig.json
index eb59fde803..75d2cf911a 100644
--- a/leaflet-geocoder-mapzen/tsconfig.json
+++ b/leaflet-geocoder-mapzen/tsconfig.json
@@ -5,9 +5,6 @@
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
- "typeRoots": [
- "../"
- ],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
diff --git a/leaflet-label/package.json b/leaflet-label/package.json
new file mode 100644
index 0000000000..711ba15e43
--- /dev/null
+++ b/leaflet-label/package.json
@@ -0,0 +1,5 @@
+{
+ "dependencies": {
+ "@types/leaflet": "^0.7"
+ }
+}
\ No newline at end of file
diff --git a/leaflet-label/tsconfig.json b/leaflet-label/tsconfig.json
index 6b47875b54..be168744ca 100644
--- a/leaflet-label/tsconfig.json
+++ b/leaflet-label/tsconfig.json
@@ -5,9 +5,6 @@
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
- "typeRoots": [
- "../"
- ],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
diff --git a/leaflet-markercluster/index.d.ts b/leaflet-markercluster/index.d.ts
index b686895e68..cc840985ae 100644
--- a/leaflet-markercluster/index.d.ts
+++ b/leaflet-markercluster/index.d.ts
@@ -51,7 +51,7 @@ declare namespace L {
/*
* The maximum radius that a cluster will cover from the central marker (in pixels). Default 80.
- * Decreasing will make more, smaller clusters. You can also use a function that accepts
+ * Decreasing will make more, smaller clusters. You can also use a function that accepts
* the current map zoom and returns the maximum cluster radius in pixels
*/
maxClusterRadius?: number | ((zoom: number) => number);
@@ -134,9 +134,9 @@ declare namespace L {
getAllChildMarkers(): Marker[];
/*
- * Zooms to show the given marker (spiderfying if required),
+ * Zooms to show the given marker (spiderfying if required),
* calls the callback when the marker is visible on the map.
- */
+ */
zoomToShowLayer(layer: any, callback: () => void): void;
}
}
diff --git a/leaflet-markercluster/package.json b/leaflet-markercluster/package.json
new file mode 100644
index 0000000000..711ba15e43
--- /dev/null
+++ b/leaflet-markercluster/package.json
@@ -0,0 +1,5 @@
+{
+ "dependencies": {
+ "@types/leaflet": "^0.7"
+ }
+}
\ No newline at end of file
diff --git a/leaflet-markercluster/tsconfig.json b/leaflet-markercluster/tsconfig.json
index 9b7a1305be..37825c82de 100644
--- a/leaflet-markercluster/tsconfig.json
+++ b/leaflet-markercluster/tsconfig.json
@@ -5,9 +5,6 @@
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
- "typeRoots": [
- "../"
- ],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
diff --git a/leaflet.awesome-markers/package.json b/leaflet.awesome-markers/package.json
new file mode 100644
index 0000000000..711ba15e43
--- /dev/null
+++ b/leaflet.awesome-markers/package.json
@@ -0,0 +1,5 @@
+{
+ "dependencies": {
+ "@types/leaflet": "^0.7"
+ }
+}
\ No newline at end of file
diff --git a/leaflet.awesome-markers/tsconfig.json b/leaflet.awesome-markers/tsconfig.json
index f628bf380b..0adbd7df29 100644
--- a/leaflet.awesome-markers/tsconfig.json
+++ b/leaflet.awesome-markers/tsconfig.json
@@ -5,9 +5,6 @@
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
- "typeRoots": [
- "../"
- ],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
diff --git a/leaflet.fullscreen/package.json b/leaflet.fullscreen/package.json
new file mode 100644
index 0000000000..711ba15e43
--- /dev/null
+++ b/leaflet.fullscreen/package.json
@@ -0,0 +1,5 @@
+{
+ "dependencies": {
+ "@types/leaflet": "^0.7"
+ }
+}
\ No newline at end of file
diff --git a/leaflet.fullscreen/tsconfig.json b/leaflet.fullscreen/tsconfig.json
index 1489852252..2f707988b7 100644
--- a/leaflet.fullscreen/tsconfig.json
+++ b/leaflet.fullscreen/tsconfig.json
@@ -5,9 +5,6 @@
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
- "typeRoots": [
- "../"
- ],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
diff --git a/leaflet/index.d.ts b/leaflet/index.d.ts
index f16c9e326d..ff6c805033 100644
--- a/leaflet/index.d.ts
+++ b/leaflet/index.d.ts
@@ -1,4382 +1,927 @@
-// Type definitions for Leaflet.js 1.0.0
+// Type definitions for Leaflet.js 1.0.0-rc3
// Project: https://github.com/Leaflet/Leaflet
-// Definitions by: Vladimir Zotov
+// Definitions by: Alejandro Sánchez
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-///
-
declare namespace L {
- type LatLngExpression = LatLng | number[] | ({ lat: number; lng: number })
- type LatLngBoundsExpression = LatLngBounds | LatLngExpression[];
- type PositionString = 'topleft' | 'topright' | 'bottomleft' | 'bottomright';
-}
-
-declare namespace L {
-
- export interface AttributionOptions {
-
- /**
- * The position of the control (one of the map corners). See control positions.
- * Default value: 'bottomright'.
- */
- position?: PositionString;
-
- /**
- * The HTML text shown before the attributions. Pass false to disable.
- * Default value: 'Powered by Leaflet'.
- */
- prefix?: string;
-
- }
-}
-
-declare namespace L {
-
- /**
- * Creates a Bounds object from two coordinates (usually top-left and bottom-right
- * corners).
- */
- export function bounds(topLeft: Point, bottomRight: Point): Bounds;
-
- /**
- * Creates a Bounds object defined by the points it contains.
- */
- export function bounds(points: Point[]): Bounds;
-
-
- export interface BoundsStatic {
- /**
- * Creates a Bounds object from two coordinates (usually top-left and bottom-right
- * corners).
- */
- new(topLeft: Point, bottomRight: Point): Bounds;
-
- /**
- * Creates a Bounds object defined by the points it contains.
- */
- new(points: Point[]): Bounds;
- }
- export var Bounds: BoundsStatic;
-
- export interface Bounds {
- /**
- * Extends the bounds to contain the given point.
- */
- extend(point: Point): void;
-
- /**
- * Returns the center point of the bounds.
- */
- getCenter(): Point;
-
- /**
- * Returns true if the rectangle contains the given one.
- */
- contains(otherBounds: Bounds): boolean;
-
- /**
- * Returns true if the rectangle contains the given point.
- */
- contains(point: Point): boolean;
-
- /**
- * Returns true if the rectangle intersects the given bounds.
- */
- intersects(otherBounds: Bounds): boolean;
-
- /**
- * Returns true if the bounds are properly initialized.
- */
- isValid(): boolean;
-
- /**
- * Returns the size of the given bounds.
- */
- getSize(): Point;
-
- /**
- * The top left corner of the rectangle.
- */
- min: Point;
-
- /**
- * The bottom right corner of the rectangle.
- */
- max: Point;
- }
-}
-
-declare namespace L {
-
- namespace Browser {
-
- /**
- * true for all Internet Explorer versions.
- */
- export var ie: boolean;
-
- /**
- * true for Internet Explorer 6.
- */
- export var ie6: boolean;
-
- /**
- * true for Internet Explorer 6.
- */
- export var ie7: boolean;
-
- /**
- * true for webkit-based browsers like Chrome and Safari (including mobile
- * versions).
- */
- export var webkit: boolean;
-
- /**
- * true for webkit-based browsers that support CSS 3D transformations.
- */
- export var webkit3d: boolean;
-
- /**
- * true for Android mobile browser.
- */
- export var android: boolean;
-
- /**
- * true for old Android stock browsers (2 and 3).
- */
- export var android23: boolean;
-
- /**
- * true for modern mobile browsers (including iOS Safari and different Android
- * browsers).
- */
- export var mobile: boolean;
-
- /**
- * true for mobile webkit-based browsers.
- */
- export var mobileWebkit: boolean;
-
- /**
- * true for mobile Opera.
- */
- export var mobileOpera: boolean;
-
- /**
- * true for all browsers on touch devices.
- */
- export var touch: boolean;
-
- /**
- * true for browsers with Microsoft touch model (e.g. IE10).
- */
- export var msTouch: boolean;
-
- /**
- * true for devices with Retina screens.
- */
- export var retina: boolean;
-
- }
-}
-
-
-declare namespace L {
-
- /**
- * Instantiates a circle object given a geographical point, a radius in meters
- * and optionally an options object.
- */
- function circle(latlng: LatLngExpression, radius: number, options?: PathOptions): Circle;
-
- export interface CircleStatic extends ClassStatic {
- /**
- * Instantiates a circle object given a geographical point, a radius in meters
- * and optionally an options object.
- */
- new(latlng: LatLngExpression, radius: number, options?: PathOptions): Circle;
- }
- export var Circle: CircleStatic;
-
- export interface Circle extends Path {
- /**
- * Returns the current geographical position of the circle.
- */
- getLatLng(): LatLng;
-
- /**
- * Returns the current radius of a circle. Units are in meters.
- */
- getRadius(): number;
-
- /**
- * Sets the position of a circle to a new location.
- */
- setLatLng(latlng: LatLngExpression): Circle;
-
- /**
- * Sets the radius of a circle. Units are in meters.
- */
- setRadius(radius: number): Circle;
-
- /**
- * Returns a GeoJSON representation of the circle (GeoJSON Point Feature).
- */
- toGeoJSON(): GeoJSON.Feature;
-
- }
-}
-
-declare namespace L {
-
- /**
- * Instantiates a circle marker given a geographical point and optionally
- * an options object. The default radius is 10 and can be altered by passing a
- * "radius" member in the path options object.
- */
- function circleMarker(latlng: LatLngExpression, options?: PathOptions): CircleMarker;
-
-
- export interface CircleMarkerStatic extends ClassStatic {
- /**
- * Instantiates a circle marker given a geographical point and optionally
- * an options object. The default radius is 10 and can be altered by passing a
- * "radius" member in the path options object.
- */
- new(latlng: LatLngExpression, options?: PathOptions): CircleMarker;
- }
- export var CircleMarker: CircleMarkerStatic;
-
- export interface CircleMarker extends Circle {
- /**
- * Sets the position of a circle marker to a new location.
- */
- setLatLng(latlng: LatLngExpression): CircleMarker;
-
- /**
- * Sets the radius of a circle marker. Units are in pixels.
- */
- setRadius(radius: number): CircleMarker;
- }
-}
-
-declare namespace L {
- export interface ClassExtendOptions {
- /**
- * Your class's constructor function, meaning that it gets called when you do 'new MyClass(...)'.
- */
- initialize?: Function;
-
- /**
- * options is a special property that unlike other objects that you pass
- * to extend will be merged with the parent one instead of overriding it
- * completely, which makes managing configuration of objects and default
- * values convenient.
- */
- options?: any;
-
- /**
- * includes is a special class property that merges all specified objects
- * into the class (such objects are called mixins). A good example of this
- * is L.Mixin.Events that event-related methods like on, off and fire
- * to the class.
- */
- includes?: any;
-
- /**
- * statics is just a convenience property that injects specified object
- * properties as the static properties of the class, useful for defining
- * constants.
- */
- static?: any;
-
- [prop: string]: any;
- }
-
- export interface ClassStatic {
- /**
- * You use L.Class.extend to define new classes, but you can use the
- * same method on any class to inherit from it.
- */
- extend(options: ClassExtendOptions): any;
- extend(options: ClassExtendOptions): { new(options?: Options): NewClass };
-
- /**
- * You can also use the following shortcut when you just need to make
- * one additional method call.
- */
- addInitHook(methodName: string, ...args: any[]): void;
- }
-
-
- /**
- * L.Class powers the OOP facilities of Leaflet and is used to create
- * almost all of the Leaflet classes documented.
- */
- namespace Class {
- /**
- * You use L.Class.extend to define new classes, but you can use the
- * same method on any class to inherit from it.
- */
- function extend(options: ClassExtendOptions): any;
- }
-
-}
-
-declare namespace L {
- export interface ControlStatic extends ClassStatic {
- /**
- * Creates a control with the given options.
- */
- new(options?: ControlOptions): Control;
-
- Zoom: Control.ZoomStatic;
- Attribution: Control.AttributionStatic;
- Layers: Control.LayersStatic;
- Scale: Control.ScaleStatic;
- }
- export var Control: ControlStatic;
-
- export interface Control extends IControl {
- /**
- * Sets the position of the control. See control positions.
- */
- setPosition(position: PositionString): Control;
-
- /**
- * Returns the current position of the control.
- */
- getPosition(): PositionString;
-
- /**
- * Adds the control to the map.
- */
- addTo(map: Map): Control;
-
- /**
- * Removes the control from the map.
- */
- removeFrom(map: Map): Control;
-
- /**
- * Returns the HTML container of the control.
- */
- getContainer(): HTMLElement;
-
- // IControl members
-
- /**
- * Should contain code that creates all the neccessary DOM elements for the
- * control, adds listeners on relevant map events, and returns the element
- * containing the control. Called on map.addControl(control) or control.addTo(map).
- */
- onAdd(map: Map): HTMLElement;
-
- /**
- * Optional, should contain all clean up code (e.g. removes control's event
- * listeners). Called on map.removeControl(control) or control.removeFrom(map).
- * The control's DOM container is removed automatically.
- */
- onRemove(map: Map): void;
- }
-
- namespace Control {
- export interface ZoomStatic extends ClassStatic {
- /**
- * Creates a zoom control.
- */
- new (options?: ZoomOptions): Zoom;
- }
-
- export interface Zoom extends L.Control {
- }
-
- export interface ZoomOptions {
- /**
- * The position of the control (one of the map corners).
- * Can be 'topleft', 'topright', 'bottomleft', or 'bottomright'.
- *
- * Default value: 'topright'.
- */
- position?: PositionString;
-
- /**
- * The text set on the zoom in button.
- *
- * Default value: '+'
- */
- zoomInText?: string;
-
- /**
- * The text set on the zoom out button.
- *
- * Default value: '-'
- */
- zoomOutText?: string;
-
- /**
- * The title set on the zoom in button.
- *
- * Default value: 'Zoom in'
- */
- zoomInTitle?: string;
-
- /**
- * The title set on the zoom out button.
- *
- * Default value: 'Zoom out'
- */
- zoomOutTitle?: string;
- }
-
- export interface AttributionStatic extends ClassStatic {
- /**
- * Creates an attribution control.
- */
- new(options?: AttributionOptions): Attribution;
- }
-
- export interface Attribution extends L.Control {
- /**
- * Sets the text before the attributions.
- */
- setPrefix(prefix: string): Attribution;
-
- /**
- * Adds an attribution text (e.g. 'Vector data © CloudMade').
- */
- addAttribution(text: string): Attribution;
-
- /**
- * Removes an attribution text.
- */
- removeAttribution(text: string): Attribution;
-
- }
-
- export interface LayersStatic extends ClassStatic {
- /**
- * Creates an attribution control with the given layers. Base layers will be
- * switched with radio buttons, while overlays will be switched with checkboxes.
- */
- new(baseLayers?: any, overlays?: any, options?: LayersOptions): Layers;
- }
-
- export interface Layers extends L.Control, IEventPowered {
- /**
- * Adds a base layer (radio button entry) with the given name to the control.
- */
- addBaseLayer(layer: ILayer, name: string): Layers;
-
- /**
- * Adds an overlay (checkbox entry) with the given name to the control.
- */
- addOverlay(layer: ILayer, name: string): Layers;
-
- /**
- * Remove the given layer from the control.
- */
- removeLayer(layer: ILayer): Layers;
-
- ////////////////
- ////////////////
- addEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): Layers;
- addOneTimeEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): Layers;
- removeEventListener(type: string, fn?: (e: LeafletEvent) => void, context?: any): Layers;
- hasEventListeners(type: string): boolean;
- fireEvent(type: string, data?: any): Layers;
- on(type: string, fn: (e: LeafletEvent) => void, context?: any): Layers;
- once(type: string, fn: (e: LeafletEvent) => void, context?: any): Layers;
- off(type: string, fn?: (e: LeafletEvent) => void, context?: any): Layers;
- fire(type: string, data?: any): Layers;
- addEventListener(eventMap: any, context?: any): Layers;
- removeEventListener(eventMap?: any, context?: any): Layers;
- clearAllEventListeners(): Layers;
- on(eventMap: any, context?: any): Layers;
- off(eventMap?: any, context?: any): Layers;
- }
-
- export interface ScaleStatic extends ClassStatic {
- /**
- * Creates an scale control with the given options.
- */
- new(options?: ScaleOptions): Scale;
- }
-
- export interface Scale extends L.Control {
- }
- }
-
- export interface control {
- /**
- * Creates a control with the given options.
- */
- (options?: ControlOptions): Control;
- }
-
- export namespace control {
-
- /**
- * Creates a zoom control.
- */
- export function zoom(options?: Control.ZoomOptions): L.Control.Zoom;
-
- /**
- * Creates an attribution control.
- */
- export function attribution(options?: AttributionOptions): L.Control.Attribution;
-
- /**
- * Creates an attribution control with the given layers. Base layers will be
- * switched with radio buttons, while overlays will be switched with checkboxes.
- */
- export function layers(baseLayers?: any, overlays?: any, options?: LayersOptions): L.Control.Layers;
-
- /**
- * Creates an scale control with the given options.
- */
- export function scale(options?: ScaleOptions): L.Control.Scale;
- }
-}
-
-declare namespace L {
-
- export interface ControlOptions {
-
- /**
- * The initial position of the control (one of the map corners). See control
- * positions.
- * Default value: 'topright'.
- */
- position?: PositionString;
-
- }
-}
-
-declare namespace L {
-
- namespace CRS {
-
- /**
- * The most common CRS for online maps, used by almost all free and commercial
- * tile providers. Uses Spherical Mercator projection. Set in by default in
- * Map's crs option.
- */
- export var EPSG3857: ICRS;
-
- /**
- * A common CRS among GIS enthusiasts. Uses simple Equirectangular projection.
- */
- export var EPSG4326: ICRS;
-
- /**
- * Rarely used by some commercial tile providers. Uses Elliptical Mercator
- * projection.
- */
- export var EPSG3395: ICRS;
-
- /**
- * A simple CRS that maps longitude and latitude into x and y directly. May be
- * used for maps of flat surfaces (e.g. game maps). Note that the y axis should
- * still be inverted (going from bottom to top).
- */
- export var Simple: ICRS;
-
- }
-}
-
-declare namespace L {
-
- /**
- * Creates a div icon instance with the given options.
- */
- function divIcon(options: DivIconOptions): DivIcon;
-
- export interface DivIconStatic extends ClassStatic {
- /**
- * Creates a div icon instance with the given options.
- */
- new(options: DivIconOptions): DivIcon;
- }
- export var DivIcon: DivIconStatic;
-
- export interface DivIcon extends Icon {
- }
-}
-
-declare namespace L {
-
- export interface DivIconOptions {
-
- /**
- * Size of the icon in pixels. Can be also set through CSS.
- */
- iconSize?: Point|[number, number];
-
- /**
- * The coordinates of the "tip" of the icon (relative to its top left corner).
- * The icon will be aligned so that this point is at the marker's geographical
- * location. Centered by default if size is specified, also can be set in CSS
- * with negative margins.
- */
- iconAnchor?: Point|[number, number];
-
- /**
- * A custom class name to assign to the icon.
- *
- * Default value: 'leaflet-div-icon'.
- */
- className?: string;
-
- /**
- * A custom HTML code to put inside the div element.
- *
- * Default value: ''.
- */
- html?: string;
-
- /**
- * The coordinates of the point from which popups will "open", relative to the
- * icon anchor.
- */
- popupAnchor?: Point|[number, number];
-
- }
-}
-
-declare namespace L {
-
- export interface DomEvent {
-
- /**
- * Adds a listener fn to the element's DOM event of the specified type. this keyword
- * inside the listener will point to context, or to the element if not specified.
- */
- addListener(el: HTMLElement, type: string, fn: (e: Event) => void, context?: any): DomEvent;
- on(el: HTMLElement, type: string, fn: (e: Event) => void, context?: any): DomEvent;
-
- /**
- * Removes an event listener from the element.
- */
- removeListener(el: HTMLElement, type: string, fn: (e: Event) => void, context?: any): DomEvent;
- off(el: HTMLElement, type: string, fn: (e: Event) => void, context?: any): DomEvent;
-
- /**
- * Stop the given event from propagation to parent elements. Used inside the
- * listener functions:
- * L.DomEvent.addListener(div, 'click', function
- * (e) {
- * L.DomEvent.stopPropagation(e);
- * });
- */
- stopPropagation(e: Event): DomEvent;
-
- /**
- * Prevents the default action of the event from happening (such as following
- * a link in the href of the a element, or doing a POST request with page reload
- * when form is submitted). Use it inside listener functions.
- */
- preventDefault(e: Event): DomEvent;
-
- /**
- * Does stopPropagation and preventDefault at the same time.
- */
- stop(e: Event): DomEvent;
-
- /**
- * Adds stopPropagation to the element's 'click', 'doubleclick', 'mousedown'
- * and 'touchstart' events.
- */
- disableClickPropagation(el: HTMLElement): DomEvent;
-
- /**
- * Gets normalized mouse position from a DOM event relative to the container
- * or to the whole page if not specified.
- */
- getMousePosition(e: Event, container?: HTMLElement): Point;
-
- /**
- * Gets normalized wheel delta from a mousewheel DOM event.
- */
- getWheelDelta(e: Event): number;
-
- }
-
- export var DomEvent: DomEvent;
-}
-
-declare namespace L {
-
- namespace DomUtil {
-
- /**
- * Returns an element with the given id if a string was passed, or just returns
- * the element if it was passed directly.
- */
- export function get(id: string): HTMLElement;
-
- /**
- * Returns the value for a certain style attribute on an element, including
- * computed values or values set through CSS.
- */
- export function getStyle(el: HTMLElement, style: string): string;
-
- /**
- * Returns the offset to the viewport for the requested element.
- */
- export function getViewportOffset(el: HTMLElement): Point;
-
- /**
- * Creates an element with tagName, sets the className, and optionally appends
- * it to container element.
- */
- export function create(tagName: string, className: string, container?: HTMLElement): HTMLElement;
-
- /**
- * Makes sure text cannot be selected, for example during dragging.
- */
- export function disableTextSelection(): void;
-
- /**
- * Makes text selection possible again.
- */
- export function enableTextSelection(): void;
-
- /**
- * Returns true if the element class attribute contains name.
- */
- export function hasClass(el: HTMLElement, name: string): boolean;
-
- /**
- * Adds name to the element's class attribute.
- */
- export function addClass(el: HTMLElement, name: string): void;
-
- /**
- * Removes name from the element's class attribute.
- */
- export function removeClass(el: HTMLElement, name: string): void;
-
- /**
- * Set the opacity of an element (including old IE support). Value must be from
- * 0 to 1.
- */
- export function setOpacity(el: HTMLElement, value: number): void;
-
- /**
- * Goes through the array of style names and returns the first name that is a valid
- * style name for an element. If no such name is found, it returns false. Useful
- * for vendor-prefixed styles like transform.
- */
- export function testProp(props: string[]): any;
-
- /**
- * Returns a CSS transform string to move an element by the offset provided in
- * the given point. Uses 3D translate on WebKit for hardware-accelerated transforms
- * and 2D on other browsers.
- */
- export function getTranslateString(point: Point): string;
-
- /**
- * Returns a CSS transform string to scale an element (with the given scale origin).
- */
- export function getScaleString(scale: number, origin: Point): string;
-
- /**
- * Sets the position of an element to coordinates specified by point, using
- * CSS translate or top/left positioning depending on the browser (used by
- * Leaflet internally to position its layers). Forces top/left positioning
- * if disable3D is true.
- */
- export function setPosition(el: HTMLElement, point: Point, disable3D?: boolean): void;
-
- /**
- * Returns the coordinates of an element previously positioned with setPosition.
- */
- export function getPosition(el: HTMLElement): Point;
-
- /**
- * Vendor-prefixed transition style name (e.g. 'webkitTransition' for WebKit).
- */
- export var TRANSITION: string;
-
- /**
- * Vendor-prefixed transform style name.
- */
- export var TRANSFORM: string;
-
- }
-}
-
-declare namespace L {
- export interface DraggableStatic extends ClassStatic {
- /**
- * Creates a Draggable object for moving the given element when you start dragging
- * the dragHandle element (equals the element itself by default).
- */
- new(element: HTMLElement, dragHandle?: HTMLElement): Draggable;
- }
- export var Draggable: DraggableStatic;
-
-
- export interface Draggable extends IEventPowered {
- /**
- * Enables the dragging ability.
- */
- enable(): void;
-
- /**
- * Disables the dragging ability.
- */
- disable(): void;
-
- ////////////////
- ////////////////
- addEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): Draggable;
- addOneTimeEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): Draggable;
- removeEventListener(type: string, fn?: (e: LeafletEvent) => void, context?: any): Draggable;
- hasEventListeners(type: string): boolean;
- fireEvent(type: string, data?: any): Draggable;
- on(type: string, fn: (e: LeafletEvent) => void, context?: any): Draggable;
- once(type: string, fn: (e: LeafletEvent) => void, context?: any): Draggable;
- off(type: string, fn?: (e: LeafletEvent) => void, context?: any): Draggable;
- fire(type: string, data?: any): Draggable;
- addEventListener(eventMap: any, context?: any): Draggable;
- removeEventListener(eventMap?: any, context?: any): Draggable;
- clearAllEventListeners(): Draggable;
- on(eventMap: any, context?: any): Draggable;
- off(eventMap?: any, context?: any): Draggable;
- }
-}
-
-
-
-declare namespace L {
-
- /**
- * Create a layer group, optionally given an initial set of layers.
- */
- function featureGroup(layers?: T[]): FeatureGroup;
-
-
- export interface FeatureGroupStatic extends ClassStatic {
- /**
- * Create a layer group, optionally given an initial set of layers.
- */
- new(layers?: T[]): FeatureGroup;
- }
- export var FeatureGroup: FeatureGroupStatic;
-
- export interface FeatureGroup extends LayerGroup, ILayer, IEventPowered> {
- /**
- * Binds a popup with a particular HTML content to a click on any layer from the
- * group that has a bindPopup method.
- */
- bindPopup(htmlContent: string, options?: PopupOptions): FeatureGroup;
-
- /**
- * Returns the LatLngBounds of the Feature Group (created from bounds and coordinates
- * of its children).
- */
- getBounds(): LatLngBounds;
-
- /**
- * Sets the given path options to each layer of the group that has a setStyle method.
- */
- setStyle(style: PathOptions): FeatureGroup;
-
- /**
- * Brings the layer group to the top of all other layers.
- */
- bringToFront(): FeatureGroup;
-
- /**
- * Brings the layer group to the bottom of all other layers.
- */
- bringToBack(): FeatureGroup;
-
- ////////////
- ////////////
- /**
- * Should contain code that creates DOM elements for the overlay, adds them
- * to map panes where they should belong and puts listeners on relevant map events.
- * Called on map.addLayer(layer).
- */
- onAdd(map: Map): void;
-
- /**
- * Should contain all clean up code that removes the overlay's elements from
- * the DOM and removes listeners previously added in onAdd. Called on map.removeLayer(layer).
- */
- onRemove(map: Map): void;
-
- ////////////////
- ////////////////
- addEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): FeatureGroup;
- addOneTimeEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): FeatureGroup;
- removeEventListener(type: string, fn?: (e: LeafletEvent) => void, context?: any): FeatureGroup;
- hasEventListeners(type: string): boolean;
- fireEvent(type: string, data?: any): FeatureGroup;
- on(type: string, fn: (e: LeafletEvent) => void, context?: any): FeatureGroup;
- once(type: string, fn: (e: LeafletEvent) => void, context?: any): FeatureGroup;
- off(type: string, fn?: (e: LeafletEvent) => void, context?: any): FeatureGroup;
- fire(type: string, data?: any): FeatureGroup;
- addEventListener(eventMap: any, context?: any): FeatureGroup;
- removeEventListener(eventMap?: any, context?: any): FeatureGroup;
- clearAllEventListeners(): FeatureGroup;
- on(eventMap: any, context?: any): FeatureGroup;
- off(eventMap?: any, context?: any): FeatureGroup;
- }
-}
-
-declare namespace L {
-
- /**
- * Creates a GeoJSON layer. Optionally accepts an object in GeoJSON format
- * to display on the map (you can alternatively add it later with addData method)
- * and an options object.
- */
- function geoJson(geojson?: any, options?: GeoJSONOptions): GeoJSON;
-
- export interface GeoJSONStatic extends ClassStatic {
- /**
- * Creates a GeoJSON layer. Optionally accepts an object in GeoJSON format
- * to display on the map (you can alternatively add it later with addData method)
- * and an options object.
- */
- new(geojson?: any, options?: GeoJSONOptions): GeoJSON;
-
- /**
- * Creates a layer from a given GeoJSON feature.
- */
- geometryToLayer(featureData: GeoJSON, pointToLayer?: (featureData: any, latlng: LatLng) => ILayer): ILayer;
-
- /**
- * Creates a LatLng object from an array of 2 numbers (latitude, longitude)
- * used in GeoJSON for points. If reverse is set to true, the numbers will be interpreted
- * as (longitude, latitude).
- */
- coordsToLatLng(coords: number[], reverse?: boolean): LatLng;
-
- /**
- * Creates a multidimensional array of LatLng objects from a GeoJSON coordinates
- * array. levelsDeep specifies the nesting level (0 is for an array of points,
- * 1 for an array of arrays of points, etc., 0 by default). If reverse is set to
- * true, the numbers will be interpreted as (longitude, latitude).
- */
- coordsToLatLngs(coords: any[], levelsDeep?: number, reverse?: boolean): any[];
- }
- export var GeoJSON: GeoJSONStatic;
-
- export interface GeoJSON extends FeatureGroup {
- /**
- * Adds a GeoJSON object to the layer.
- */
- addData(data: any): boolean;
-
- /**
- * Changes styles of GeoJSON vector layers with the given style function.
- */
- setStyle(style: (featureData: any) => any): GeoJSON;
-
- /**
- * Changes styles of GeoJSON vector layers with the given style options.
- */
- setStyle(style: PathOptions): GeoJSON;
-
- /**
- * Resets the the given vector layer's style to the original GeoJSON style,
- * useful for resetting style after hover events.
- */
- resetStyle(layer: Path): GeoJSON;
- }
-}
-
-declare namespace L {
- export interface GeoJSONOptions {
- /**
- * Function that will be used for creating layers for GeoJSON points (if not
- * specified, simple markers will be created).
- */
- pointToLayer?: (featureData: any, latlng: LatLng) => ILayer;
-
- /**
- * Function that will be used to get style options for vector layers created
- * for GeoJSON features.
- */
- style?: (featureData: any) => any;
-
- /**
- * Function that will be called on each created feature layer. Useful for attaching
- * events and popups to features.
- */
- onEachFeature?: (featureData: any, layer: ILayer) => void;
-
- /**
- * Function that will be used to decide whether to show a feature or not.
- */
- filter?: (featureData: any, layer: ILayer) => boolean;
-
- /**
- * Function that will be used for converting GeoJSON coordinates to LatLng points
- * (if not specified, coords will be assumed to be WGS84 � standard[longitude, latitude]
- * values in degrees).
- */
- coordsToLatLng?: (coords: any[]) => LatLng[];
- }
-}
-
-
-
-
-declare namespace L {
-
- /**
- * Creates an icon instance with the given options.
- */
- function icon(options: IconOptions): Icon;
-
- export interface IconStatic extends ClassStatic {
- /**
- * Creates an icon instance with the given options.
- */
- new(options: IconOptions): Icon;
-
- Default: {
- /**
- * Creates a default icon instance with the given options.
- */
- new(options?: IconOptions): Icon.Default;
-
- imagePath: string;
- };
- }
- export var Icon: IconStatic;
-
- export interface Icon {
- }
-
- namespace Icon {
- /**
- * L.Icon.Default extends L.Icon and is the blue icon Leaflet uses
- * for markers by default.
- */
- export interface Default extends Icon {
- }
- }
-}
-
-declare namespace L {
-
- export interface IconOptions {
-
- /**
- * (required) The URL to the icon image (absolute or relative to your script
- * path).
- */
- iconUrl?: string;
-
- /**
- * The URL to a retina sized version of the icon image (absolute or relative to
- * your script path). Used for Retina screen devices.
- */
- iconRetinaUrl?: string;
-
- /**
- * Size of the icon image in pixels.
- */
- iconSize?: Point|[number, number];
-
- /**
- * The coordinates of the "tip" of the icon (relative to its top left corner).
- * The icon will be aligned so that this point is at the marker's geographical
- * location. Centered by default if size is specified, also can be set in CSS
- * with negative margins.
- */
- iconAnchor?: Point|[number, number];
-
- /**
- * The URL to the icon shadow image. If not specified, no shadow image will be
- * created.
- */
- shadowUrl?: string;
-
- /**
- * The URL to the retina sized version of the icon shadow image. If not specified,
- * no shadow image will be created. Used for Retina screen devices.
- */
- shadowRetinaUrl?: string;
-
- /**
- * Size of the shadow image in pixels.
- */
- shadowSize?: Point|[number, number];
-
- /**
- * The coordinates of the "tip" of the shadow (relative to its top left corner)
- * (the same as iconAnchor if not specified).
- */
- shadowAnchor?: Point|[number, number];
-
- /**
- * The coordinates of the point from which popups will "open", relative to the
- * icon anchor.
- */
- popupAnchor?: Point|[number, number];
-
- /**
- * A custom class name to assign to both icon and shadow images. Empty by default.
- */
- className?: string;
- }
-}
-
-declare namespace L {
-
- export interface IControl {
-
- /**
- * Should contain code that creates all the neccessary DOM elements for the
- * control, adds listeners on relevant map events, and returns the element
- * containing the control. Called on map.addControl(control) or control.addTo(map).
- */
- onAdd(map: Map): HTMLElement;
-
- /**
- * Optional, should contain all clean up code (e.g. removes control's event
- * listeners). Called on map.removeControl(control) or control.removeFrom(map).
- * The control's DOM container is removed automatically.
- */
- onRemove(map: Map): void;
- }
-}
-
-declare namespace L {
-
- export interface ICRS {
-
- /**
- * Projection that this CRS uses.
- */
- projection: IProjection;
-
- /**
- * Transformation that this CRS uses to turn projected coordinates into screen
- * coordinates for a particular tile service.
- */
- transformation: Transformation;
-
- /**
- * Standard code name of the CRS passed into WMS services (e.g. 'EPSG:3857').
- */
- code: string;
-
- /**
- * Projects geographical coordinates on a given zoom into pixel coordinates.
- */
+ export interface CRS {
latLngToPoint(latlng: LatLng, zoom: number): Point;
-
- /**
- * The inverse of latLngToPoint. Projects pixel coordinates on a given zoom
- * into geographical coordinates.
- */
- pointToLatLng(point: Point, zoom: number): LatLng;
-
- /**
- * Projects geographical coordinates into coordinates in units accepted
- * for this CRS (e.g. meters for EPSG:3857, for passing it to WMS services).
- */
+ latLngToPoint(latlng: LatLngLiteral, zoom: number): Point;
+ latLngToPoint(latlng: LatLngTuple, zoom: number): Point;
+ pointToLatLng(point: Point): LatLng;
+ pointToLatLng(point: PointTuple): LatLng;
project(latlng: LatLng): Point;
-
- /**
- * Returns the scale used when transforming projected coordinates into pixel
- * coordinates for a particular zoom. For example, it returns 256 * 2^zoom for
- * Mercator-based CRS.
- */
- scale(zoom: number): number;
-
- /**
- * Returns the size of the world in pixels for a particular zoom.
- */
- getSize(zoom: number): Point;
-
- }
-}
-
-declare namespace L {
-
- export interface IEventPowered {
-
- /**
- * Adds a listener function (fn) to a particular event type of the object. You
- * can optionally specify the context of the listener (object the this keyword
- * will point to). You can also pass several space-separated types (e.g. 'click
- * dblclick').
- */
- addEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): T;
-
- /**
- * The same as above except the listener will only get fired once and then removed.
- */
- addOneTimeEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): T;
- /**
- * Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
- */
- addEventListener(eventMap: any, context?: any): T;
-
- /**
- * Removes a previously added listener function. If no function is specified,
- * it will remove all the listeners of that particular event from the object.
- */
- removeEventListener(type: string, fn?: (e: LeafletEvent) => void, context?: any): T;
-
- /**
- * Removes a set of type/listener pairs.
- */
- removeEventListener(eventMap?: any, context?: any): T;
-
- /**
- * Returns true if a particular event type has some listeners attached to it.
- */
- hasEventListeners(type: string): boolean;
-
- /**
- * Fires an event of the specified type. You can optionally provide an data object
- * — the first argument of the listener function will contain its properties.
- */
- fireEvent(type: string, data?: any): T;
-
- /**
- * Removes all listeners to all events on the object.
- */
- clearAllEventListeners(): T;
-
- /**
- * Alias to addEventListener.
- */
- on(type: string, fn: (e: LeafletEvent) => void, context?: any): T;
-
- /**
- * Alias to addEventListener.
- */
- on(eventMap: any, context?: any): T;
-
- /**
- * Alias to addOneTimeEventListener.
- */
- once(type: string, fn: (e: LeafletEvent) => void, context?: any): T;
-
- /**
- * Alias to removeEventListener.
- */
- off(type: string, fn?: (e: LeafletEvent) => void, context?: any): T;
-
- /**
- * Alias to removeEventListener.
- */
- off(eventMap?: any, context?: any): T;
-
- /**
- * Alias to fireEvent.
- */
- fire(type: string, data?: any): T;
- }
-}
-
-declare namespace L {
-
- export interface IHandler {
-
- /**
- * Enables the handler.
- */
- enable(): void;
-
- /**
- * Disables the handler.
- */
- disable(): void;
-
- /**
- * Returns true if the handler is enabled.
- */
- enabled(): boolean;
- }
-
- export interface Handler {
- initialize(map: Map): void;
- }
-}
-
-declare namespace L {
-
- export interface ILayer {
-
- /**
- * Should contain code that creates DOM elements for the overlay, adds them
- * to map panes where they should belong and puts listeners on relevant map events.
- * Called on map.addLayer(layer).
- */
- onAdd(map: Map): void;
-
- /**
- * Should contain all clean up code that removes the overlay's elements from
- * the DOM and removes listeners previously added in onAdd. Called on map.removeLayer(layer).
- */
- onRemove(map: Map): void;
- }
-}
-
-declare namespace L {
- namespace Mixin {
- export interface LeafletMixinEvents extends IEventPowered {
- }
-
- export var Events: LeafletMixinEvents;
- }
-}
-
-declare namespace L {
-
- /**
- * Instantiates an image overlay object given the URL of the image and the geographical
- * bounds it is tied to.
- */
- function imageOverlay(imageUrl: string, bounds: LatLngBounds, options?: ImageOverlayOptions): ImageOverlay;
-
- export interface ImageOverlayStatic extends ClassStatic {
- /**
- * Instantiates an image overlay object given the URL of the image and the geographical
- * bounds it is tied to.
- */
- new(imageUrl: string, bounds: LatLngBounds, options?: ImageOverlayOptions): ImageOverlay;
- }
- export var ImageOverlay: ImageOverlayStatic;
-
- export interface ImageOverlay extends ILayer {
- /**
- * Adds the overlay to the map.
- */
- addTo(map: Map): ImageOverlay;
-
- /**
- * Sets the opacity of the overlay.
- */
- setOpacity(opacity: number): ImageOverlay;
-
- /**
- * Changes the URL of the image.
- */
- setUrl(imageUrl: string): ImageOverlay;
-
- /**
- * Brings the layer to the top of all overlays.
- */
- bringToFront(): ImageOverlay;
-
- /**
- * Brings the layer to the bottom of all overlays.
- */
- bringToBack(): ImageOverlay;
-
- ////////////
- ////////////
- /**
- * Should contain code that creates DOM elements for the overlay, adds them
- * to map panes where they should belong and puts listeners on relevant map events.
- * Called on map.addLayer(layer).
- */
- onAdd(map: Map): void;
-
- /**
- * Should contain all clean up code that removes the overlay's elements from
- * the DOM and removes listeners previously added in onAdd. Called on map.removeLayer(layer).
- */
- onRemove(map: Map): void;
- }
-}
-
-declare namespace L {
-
- export interface ImageOverlayOptions {
-
- /**
- * The opacity of the image overlay.
- */
- opacity?: number;
- }
-}
-
-declare namespace L {
-
- export interface IProjection {
-
- /**
- * Projects geographical coordinates into a 2D point.
- */
- project(latlng: LatLng): Point;
-
- /**
- * The inverse of project. Projects a 2D point into geographical location.
- */
+ project(latlng: LatLngLiteral): Point;
+ project(latlng: LatLngTuple): Point;
unproject(point: Point): LatLng;
+ unproject(point: PointTuple): LatLng;
+ scale(zoom: number): number;
+ zoom(scale: number): number;
+ getProjectedBounds(zoom: number): Bounds;
+ distance(latlng1: LatLng, latlng2: LatLng): number;
+ distance(latlng1: LatLngLiteral, latlng2: LatLngLiteral): number;
+ distance(latlng1: LatLngTuple, latlng2: LatLngTuple): number;
+ wrapLatLng(latlng: LatLng): LatLng;
+ wrapLatLng(latlng: LatLngLiteral): LatLng;
+ wrapLatLng(latlng: LatLngTuple): LatLng;
+
+ code: string;
+ wrapLng: [number, number];
+ wrapLat: [number, number];
+ infinite: boolean;
}
-}
-declare namespace L {
-
- /**
- * A constant that represents the Leaflet version in use.
- */
- export var version: string;
-
- /**
- * This method restores the L global variale to the original value it had
- * before Leaflet inclusion, and returns the real Leaflet namespace.
- */
- export function noConflict(): typeof L;
-}
-
-declare namespace L {
- /**
- * Creates an object representing a geographical point with the given latitude
- * and longitude.
- */
- function latLng(latitude: number, longitude: number): LatLng;
-
- /**
- * Creates an object representing a geographical point with the given latitude
- * and longitude.
- */
- function latLng(coords: LatLngExpression): LatLng;
-
- export interface LatLngStatic {
- /**
- * Creates an object representing a geographical point with the given latitude
- * and longitude.
- */
- new(latitude: number, longitude: number): LatLng;
-
- /**
- * Creates an object representing a geographical point with the given latitude
- * and longitude.
- */
- new(coords: LatLngExpression): LatLng;
-
- /**
- * A multiplier for converting degrees into radians.
- *
- * Value: Math.PI / 180.
- */
- DEG_TO_RAD: number;
-
- /**
- * A multiplier for converting radians into degrees.
- *
- * Value: 180 / Math.PI.
- */
- RAD_TO_DEG: number;
-
- /**
- * Max margin of error for the equality check.
- *
- * Value: 1.0E-9.
- */
- MAX_MARGIN: number;
+ export namespace CRS {
+ export const EPSG3395: CRS;
+ export const EPSG3857: CRS;
+ export const EPSG4326: CRS;
+ export const Earth: CRS;
+ export const Simple: CRS;
+ }
+
+ export interface Projection {
+ project(latlng: LatLng): Point;
+ project(latlng: LatLngLiteral): Point;
+ project(latlng: LatLngTuple): Point;
+ unproject(point: Point): LatLng;
+ unproject(point: PointTuple): LatLng;
+
+ bounds: LatLngBounds;
+ }
+
+ export namespace Projection {
+ export const LonLat: Projection;
+ export const Mercator: Projection;
+ export const SphericalMercator: Projection;
}
- export var LatLng: LatLngStatic;
export interface LatLng {
- /**
- * Returns the distance (in meters) to the given LatLng calculated using the
- * Haversine formula. See description on wikipedia
- */
- distanceTo(otherLatlng: LatLngExpression): number;
-
- /**
- * Returns true if the given LatLng point is at the same position (within a small
- * margin of error).
- */
- equals(otherLatlng: LatLngExpression): boolean;
-
- /**
- * Returns a string representation of the point (for debugging purposes).
- */
+ equals(otherLatLng: LatLng, maxMargin?: number): boolean;
+ equals(otherLatLng: LatLngLiteral, maxMargin?: number): boolean;
+ equals(otherLatLng: LatLngTuple, maxMargin?: number): boolean;
toString(): string;
+ distanceTo(otherLatLng: LatLng): number;
+ distanceTo(otherLatLng: LatLngLiteral): number;
+ distanceTo(otherLatLng: LatLngTuple): number;
+ wrap(): LatLng;
+ toBounds(sizeInMeters: number): LatLngBounds;
- /**
- * Returns a new LatLng object with the longitude wrapped around left and right
- * boundaries (-180 to 180 by default).
- */
- wrap(left?: number, right?: number): LatLng;
-
- /**
- * Latitude in degrees.
- */
lat: number;
+ lng: number;
+ alt: number;
+ }
- /**
- * Longitude in degrees.
- */
+ export interface LatLngLiteral {
+ lat: number;
lng: number;
}
-}
-declare namespace L {
+ export type LatLngTuple = [number, number];
- /**
- * Creates a LatLngBounds object by defining south-west and north-east corners
- * of the rectangle.
- */
- function latLngBounds(southWest: LatLngExpression, northEast: LatLngExpression): LatLngBounds;
+ type LatLngExpression = LatLng | LatLngLiteral | LatLngTuple;
- /**
- * Creates a LatLngBounds object defined by the geographical points it contains.
- * Very useful for zooming the map to fit a particular set of locations with fitBounds.
- */
- function latLngBounds(latlngs: LatLngBoundsExpression): LatLngBounds;
+ export function latLng(latitude: number, longitude: number, altitude?: number): LatLng;
- export interface LatLngBoundsStatic {
- /**
- * Creates a LatLngBounds object by defining south-west and north-east corners
- * of the rectangle.
- */
- new(southWest: LatLngExpression, northEast: LatLngExpression): LatLngBounds;
+ export function latLng(coords: LatLngTuple): LatLng;
- /**
- * Creates a LatLngBounds object defined by the geographical points it contains.
- * Very useful for zooming the map to fit a particular set of locations with fitBounds.
- */
- new(latlngs: LatLngBoundsExpression): LatLngBounds;
- }
- export var LatLngBounds: LatLngBoundsStatic;
+ export function latLng(coords: [number, number, number]): LatLng;
+
+ export function latLng(coords: LatLngLiteral): LatLng;
+
+ export function latLng(coords: {lat: number, lng: number, alt: number}): LatLng;
export interface LatLngBounds {
- /**
- * Extends the bounds to contain the given point.
- */
- extend(latlng: LatLngExpression): LatLngBounds;
-
- /**
- * Extends the bounds to contain the given bounds.
- */
- extend(latlng: LatLngBoundsExpression): LatLngBounds;
-
- /**
- * Returns the south-west point of the bounds.
- */
+ extend(latlng: LatLng): this;
+ extend(latlng: LatLngLiteral): this;
+ extend(latlng: LatLngTuple): this;
+ extend(otherBounds: LatLngBounds): this;
+ extend(otherBounds: LatLngBoundsLiteral): this;
+ pad(bufferRatio: number): LatLngBounds; // does this modify the current instance or does it return a new one?
+ getCenter(): LatLng;
getSouthWest(): LatLng;
-
- /**
- * Returns the north-east point of the bounds.
- */
getNorthEast(): LatLng;
-
- /**
- * Returns the north-west point of the bounds.
- */
getNorthWest(): LatLng;
-
- /**
- * Returns the south-east point of the bounds.
- */
getSouthEast(): LatLng;
-
- /**
- * Returns the west longitude in degrees of the bounds.
- */
- getWest(): number;
-
- /**
- * Returns the east longitude in degrees of the bounds.
- */
- getEast(): number;
-
- /**
- * Returns the north latitude in degrees of the bounds.
- */
- getNorth(): number;
-
- /**
- * Returns the south latitude in degrees of the bounds.
- */
- getSouth(): number;
-
- /**
- * Returns the center point of the bounds.
- */
- getCenter(): LatLng;
-
- /**
- * Returns true if the rectangle contains the given one.
- */
- contains(otherBounds: LatLngBoundsExpression): boolean;
-
- /**
- * Returns true if the rectangle contains the given point.
- */
- contains(latlng: LatLngExpression): boolean;
-
- /**
- * Returns true if the rectangle intersects the given bounds.
- */
- intersects(otherBounds: LatLngBoundsExpression): boolean;
-
- /**
- * Returns true if the rectangle is equivalent (within a small margin of error)
- * to the given bounds.
- */
- equals(otherBounds: LatLngBoundsExpression): boolean;
-
- /**
- * Returns a string with bounding box coordinates in a 'southwest_lng,southwest_lat,northeast_lng,northeast_lat'
- * format. Useful for sending requests to web services that return geo data.
- */
+ getWest(): number;
+ getSouth(): number;
+ getEast(): number;
+ getNorth(): number;
+ contains(otherBounds: LatLngBounds): boolean;
+ contains(otherBounds: LatLngBoundsLiteral): boolean;
+ contains(latlng: LatLng): boolean;
+ contains(latlng: LatLngLiteral): boolean;
+ contains(latlng: LatLngTuple): boolean;
+ intersects(otherBounds: LatLngBounds): boolean;
+ intersects(otherBounds: LatLngLiteral): boolean;
+ overlaps(otherBounds: Bounds): boolean; // investigate if this is really bounds and not latlngbounds
+ overlaps(otherBounds: BoundsLiteral): boolean;
toBBoxString(): string;
-
- /**
- * Returns bigger bounds created by extending the current bounds by a given
- * percentage in each direction.
- */
- pad(bufferRatio: number): LatLngBounds;
-
- /**
- * Returns true if the bounds are properly initialized.
- */
+ equals(otherBounds: LatLngBounds): boolean;
+ equals(otherBounds: LatLngBoundsLiteral): boolean;
isValid(): boolean;
-
}
-}
-declare namespace L {
+ export type LatLngBoundsLiteral = Array;
- /**
- * Create a layer group, optionally given an initial set of layers.
- */
- function layerGroup(layers?: T[]): LayerGroup;
+ type LatLngBoundsExpression = LatLngBounds | LatLngBoundsLiteral;
+ export function latLngBounds(southWest: LatLng, northEast: LatLng): LatLngBounds;
- export interface LayerGroupStatic extends ClassStatic {
- /**
- * Create a layer group, optionally given an initial set of layers.
- */
- new(layers?: T[]): LayerGroup;
+ export function latLngBounds(southWest: LatLngLiteral, northEast: LatLngLiteral): LatLngBounds;
+
+ export function latLngBounds(southWest: LatLngTuple, northEast: LatLngTuple): LatLngBounds;
+
+ export function latLngBounds(latlngs: LatLngBoundsLiteral): LatLngBounds;
+
+ export type PointTuple = [number, number];
+
+ export interface Point {
+ clone(): Point;
+ add(otherPoint: Point): Point; // investigate if this mutates or returns a new instance
+ add(otherPoint: PointTuple): Point;
+ subtract(otherPoint: Point): Point;
+ subtract(otherPoint: PointTuple): Point;
+ divideBy(num: number): Point;
+ multiplyBy(num: number): Point;
+ scaleBy(scale: Point): Point;
+ scaleBy(scale: PointTuple): Point;
+ unscaleBy(scale: Point): Point;
+ unscaleBy(scale: PointTuple): Point;
+ round(): Point;
+ floor(): Point;
+ ceil(): Point;
+ distanceTo(otherPoint: Point): Point;
+ distanceTo(otherPoint: PointTuple): Point;
+ equals(otherPoint: Point): boolean;
+ equals(otherPoint: PointTuple): boolean;
+ contains(otherPoint: Point): boolean;
+ contains(otherPoint: PointTuple): boolean;
+ toString(): string;
}
- export var LayerGroup: LayerGroupStatic;
- export interface LayerGroup extends ILayer {
- /**
- * Adds the group of layers to the map.
- */
- addTo(map: Map): LayerGroup;
+ type PointExpression = Point | PointTuple;
- /**
- * Adds a given layer to the group.
- */
- addLayer(layer: T): LayerGroup;
+ export function point(x: number, y: number, round?: boolean): Point;
- /**
- * Removes a given layer from the group.
- */
- removeLayer(layer: T): LayerGroup;
+ export function point(coords: PointTuple): Point;
- /**
- * Removes a given layer of the given id from the group.
- */
- removeLayer(id: string): LayerGroup;
+ export function point(coords: {x: number, y: number}): Point;
- /**
- * Returns true if the given layer is currently added to the group.
- */
- hasLayer(layer: T): boolean;
+ export type BoundsLiteral = Array;
- /**
- * Returns the layer with the given id.
- */
- getLayer(id: string): T;
-
- /**
- * Returns an array of all the layers added to the group.
- */
- getLayers(): T[];
-
- /**
- * Removes all the layers from the group.
- */
- clearLayers(): LayerGroup;
-
- /**
- * Iterates over the layers of the group, optionally specifying context of
- * the iterator function.
- */
- eachLayer(fn: (layer: T) => void, context?: any): LayerGroup;
-
- /**
- * Returns a GeoJSON representation of the layer group (GeoJSON FeatureCollection).
- * Note: Descendent classes MultiPolygon & MultiPolyLine return `Feature`s, not `FeatureCollection`s
- */
- toGeoJSON(): GeoJSON.FeatureCollection|GeoJSON.Feature;
-
- ////////////
- ////////////
- /**
- * Should contain code that creates DOM elements for the overlay, adds them
- * to map panes where they should belong and puts listeners on relevant map events.
- * Called on map.addLayer(layer).
- */
- onAdd(map: Map): void;
-
- /**
- * Should contain all clean up code that removes the overlay's elements from
- * the DOM and removes listeners previously added in onAdd. Called on map.removeLayer(layer).
- */
- onRemove(map: Map): void;
- }
-}
-
-
-declare namespace L {
-
- export interface LayersOptions {
-
- /**
- * The position of the control (one of the map corners). See control positions.
- *
- * Default value: 'topright'.
- */
- position?: PositionString;
-
- /**
- * If true, the control will be collapsed into an icon and expanded on mouse hover
- * or touch.
- *
- * Default value: true.
- */
- collapsed?: boolean;
-
- /**
- * If true, the control will assign zIndexes in increasing order to all of its
- * layers so that the order is preserved when switching them on/off.
- *
- * Default value: true.
- */
- autoZIndex?: boolean;
-
- }
-}
-
-declare namespace L {
-
- export interface LeafletErrorEvent extends LeafletEvent {
-
- /**
- * Error message.
- */
- message: string;
-
- /**
- * Error code (if applicable).
- */
- code: number;
- }
-}
-
-declare namespace L {
-
- export interface LeafletEvent {
-
- /**
- * The event type (e.g. 'click').
- */
- type: string;
-
- /**
- * The object that fired the event.
- */
- target: any;
- }
-}
-
-declare namespace L {
-
- export interface LeafletGeoJSONEvent extends LeafletEvent {
-
- /**
- * The layer for the GeoJSON feature that is being added to the map.
- */
- layer: ILayer;
-
- /**
- * GeoJSON properties of the feature.
- */
- properties: any;
-
- /**
- * GeoJSON geometry type of the feature.
- */
- geometryType: string;
-
- /**
- * GeoJSON ID of the feature (if present).
- */
- id: string;
- }
-}
-
-declare namespace L {
-
- export interface LeafletLayerEvent extends LeafletEvent {
-
- /**
- * The layer that was added or removed.
- */
- layer: ILayer;
- }
-}
-
-declare namespace L {
-
- export interface LeafletLayersControlEvent extends LeafletEvent {
-
- /**
- * The layer that was added or removed.
- */
- layer: ILayer;
-
- /**
- * The name of the layer that was added or removed.
- */
- name: string;
- }
-}
-
-declare namespace L {
-
- export interface LeafletLocationEvent extends LeafletEvent {
-
- /**
- * Detected geographical location of the user.
- */
- latlng: LatLng;
-
- /**
- * Geographical bounds of the area user is located in (with respect to the accuracy
- * of location).
- */
- bounds: LatLngBounds;
-
- /**
- * Accuracy of location in meters.
- */
- accuracy: number;
-
- /**
- * Height of the position above the WGS84 ellipsoid in meters.
- */
- altitude: number;
-
- /**
- * Accuracy of altitude in meters.
- */
- altitudeAccuracy: number;
-
- /**
- * The direction of travel in degrees counting clockwise from true North.
- */
- heading: number;
-
- /**
- * Current velocity in meters per second.
- */
- speed: number;
-
- /**
- * The time when the position was acquired.
- */
- timestamp: number;
-
- }
-}
-
-declare namespace L {
-
- export interface LeafletMouseEvent extends LeafletEvent {
-
- /**
- * The geographical point where the mouse event occured.
- */
- latlng: LatLng;
-
- /**
- * Pixel coordinates of the point where the mouse event occured relative to
- * the map layer.
- */
- layerPoint: Point;
-
- /**
- * Pixel coordinates of the point where the mouse event occured relative to
- * the map сontainer.
- */
- containerPoint: Point;
-
- /**
- * The original DOM mouse event fired by the browser.
- */
- originalEvent: MouseEvent;
- }
-}
-
-declare namespace L {
-
- export interface LeafletPopupEvent extends LeafletEvent {
-
- /**
- * The popup that was opened or closed.
- */
- popup: Popup;
- }
-}
-
-declare namespace L {
-
- export interface LeafletDragEndEvent extends LeafletEvent {
-
- /**
- * The distance in pixels the draggable element was moved by.
- */
- distance: number;
- }
-}
-
-declare namespace L {
-
- export interface LeafletResizeEvent extends LeafletEvent {
-
- /**
- * The old size before resize event.
- */
- oldSize: Point;
-
- /**
- * The new size after the resize event.
- */
- newSize: Point;
- }
-}
-
-declare namespace L {
-
- export interface LeafletTileEvent extends LeafletEvent {
-
- /**
- * The tile element (image).
- */
- tile: HTMLElement;
-
- /**
- * The source URL of the tile.
- */
- url: string;
- }
-}
-
-declare namespace L {
-
- namespace LineUtil {
-
- /**
- * Dramatically reduces the number of points in a polyline while retaining
- * its shape and returns a new array of simplified points. Used for a huge performance
- * boost when processing/displaying Leaflet polylines for each zoom level
- * and also reducing visual noise. tolerance affects the amount of simplification
- * (lesser value means higher quality but slower and with more points). Also
- * released as a separated micro-library Simplify.js.
- */
- export function simplify(points: Point[], tolerance: number): Point[];
-
- /**
- * Returns the distance between point p and segment p1 to p2.
- */
- export function pointToSegmentDistance(p: Point, p1: Point, p2: Point): number;
-
- /**
- * Returns the closest point from a point p on a segment p1 to p2.
- */
- export function closestPointOnSegment(p: Point, p1: Point, p2: Point): Point;
-
- /**
- * Clips the segment a to b by rectangular bounds. Used by Leaflet to only show
- * polyline points that are on the screen or near, increasing performance. Returns
- * either false or a length-2 array of clipped points.
- */
- export function clipSegment(a: Point, b: Point, bounds: Bounds): Point[] | boolean;
-
- }
-}
-
-declare namespace L {
-
- export interface LocateOptions {
-
- /**
- * If true, starts continous watching of location changes (instead of detecting
- * it once) using W3C watchPosition method. You can later stop watching using
- * map.stopLocate() method.
- *
- * Default value: false.
- */
- watch?: boolean;
-
- /**
- * If true, automatically sets the map view to the user location with respect
- * to detection accuracy, or to world view if geolocation failed.
- *
- * Default value: false.
- */
- setView?: boolean;
-
- /**
- * The maximum zoom for automatic view setting when using `setView` option.
- *
- * Default value: Infinity.
- */
- maxZoom?: number;
-
- /**
- * Number of millisecond to wait for a response from geolocation before firing
- * a locationerror event.
- *
- * Default value: 10000.
- */
- timeout?: number;
-
- /**
- * Maximum age of detected location. If less than this amount of milliseconds
- * passed since last geolocation response, locate will return a cached location.
- *
- * Default value: 0.
- */
- maximumAge?: number;
-
- /**
- * Enables high accuracy, see description in the W3C spec.
- *
- * Default value: false.
- */
- enableHighAccuracy?: boolean;
- }
-}
-
-declare namespace L {
-
- /**
- * Instantiates a map object given a div element and optionally an
- * object literal with map options described below.
- */
- function map(id: HTMLElement, options?: Map.MapOptions): Map;
-
- /**
- * Instantiates a map object given a div element id and optionally an
- * object literal with map options described below.
- */
- function map(id: string, options?: Map.MapOptions): Map;
-
-
- export interface MapStatic extends ClassStatic {
- /**
- * Instantiates a map object given a div element and optionally an
- * object literal with map options described below.
- *
- * @constructor
- */
- new(id: HTMLElement, options?: Map.MapOptions): Map;
-
- /**
- * Instantiates a map object given a div element id and optionally an
- * object literal with map options described below.
- *
- * @constructor
- */
- new(id: string, options?: Map.MapOptions): Map;
- }
- export var Map: MapStatic;
-
- export interface Map extends IEventPowered