{"_id":"@diamondlovesyou/tsm","_rev":"6-f4bc6730bc2ae1bd46d3282eddad3f0a","name":"@diamondlovesyou/tsm","description":"A TypeScript linear algebra library for your computer graphics","dist-tags":{"latest":"0.7.4"},"versions":{"0.7.1":{"name":"@diamondlovesyou/tsm","version":"0.7.1","description":"A TypeScript linear algebra library for your computer graphics","main":"./TSM/tsm-0.7.min.js","types":"./TSM/tsm-0.7.d.ts","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/DiamondLovesYou/TSM.git"},"keywords":["matrix","vector","linear algebra"],"author":{"name":"Matthias Ferch"},"contributors":[{"name":"Richard Diamond","email":"wichard@vitalitystudios.com"}],"license":"zlib","bugs":{"url":"https://github.com/DiamondLovesYou/TSM/issues"},"homepage":"https://github.com/DiamondLovesYou/TSM","gitHead":"6561758e9172dcba03d1397f394e5f2973ce676f","_id":"@diamondlovesyou/tsm@0.7.1","_shasum":"448659731d3d5931d3f968c89930c0dd58e82d02","_from":".","_npmVersion":"3.5.2","_nodeVersion":"4.2.6","_npmUser":{"name":"diamondlovesyou","email":"wichard@vitalitystudios.com"},"dist":{"shasum":"448659731d3d5931d3f968c89930c0dd58e82d02","tarball":"https://registry.npmjs.org/@diamondlovesyou/tsm/-/tsm-0.7.1.tgz","integrity":"sha512-nPZesesRJpuQfrI932cgwVJuP/+mWuEUdy9uwg1cbUnIOC5bXMnNHl9CO1mGd053c1xdmGA0Riq5jXYlx0K1LQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDqbd/EIY7L4Fg4xs7G0OzflEC5I1aOPng2YTvh72A7MQIhAJ4x9ahj0/9qad4R9ieus7K1ZPLjs/zh0Oc1oK9Lzsn/"}]},"maintainers":[{"name":"diamondlovesyou","email":"wichard@vitalitystudios.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/tsm-0.7.1.tgz_1474665467509_0.35718463617376983"}},"0.7.2":{"name":"@diamondlovesyou/tsm","version":"0.7.2","description":"A TypeScript linear algebra library for your computer graphics","main":"./TSM/tsm-0.7.min.js","types":"./TSM/tsm-0.7.d.ts","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"files":["./TSM/tsm-0.7.d.ts","./TSM/tsm-0.7.js.map"],"repository":{"type":"git","url":"git+https://github.com/DiamondLovesYou/TSM.git"},"keywords":["matrix","vector","linear algebra"],"author":{"name":"Matthias Ferch"},"contributors":[{"name":"Richard Diamond","email":"wichard@vitalitystudios.com"}],"license":"zlib","bugs":{"url":"https://github.com/DiamondLovesYou/TSM/issues"},"homepage":"https://github.com/DiamondLovesYou/TSM","gitHead":"6561758e9172dcba03d1397f394e5f2973ce676f","_id":"@diamondlovesyou/tsm@0.7.2","_shasum":"06216ae9bb3ab05271f29852314a3b477feb5e2c","_from":".","_npmVersion":"3.5.2","_nodeVersion":"4.2.6","_npmUser":{"name":"diamondlovesyou","email":"wichard@vitalitystudios.com"},"dist":{"shasum":"06216ae9bb3ab05271f29852314a3b477feb5e2c","tarball":"https://registry.npmjs.org/@diamondlovesyou/tsm/-/tsm-0.7.2.tgz","integrity":"sha512-gM4/QL6PCyfGRmWHGvsh6PZ8Reic8HMvou8Nx0/YVwnQaI5Zy+fhfVEBZ6diL4w+5jcFI36oe12BraHBeXaPKw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCXyarSj0KMMYr9mUVMPCLDtIINaNBoLzIKGzSjcbGwhgIgMd33bOgMZZtNOMrHV7HQnW2XBwN4mT9SIMQsmx7HVcU="}]},"maintainers":[{"name":"diamondlovesyou","email":"wichard@vitalitystudios.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/tsm-0.7.2.tgz_1474666106590_0.316858746111393"}},"0.7.3":{"name":"@diamondlovesyou/tsm","version":"0.7.3","description":"A TypeScript linear algebra library for your computer graphics","main":"./TSM/tsm-0.7.min.js","types":"./TSM/tsm-0.7.d.ts","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"files":["TSM"],"repository":{"type":"git","url":"git+https://github.com/DiamondLovesYou/TSM.git"},"keywords":["matrix","vector","linear algebra"],"author":{"name":"Matthias Ferch"},"contributors":[{"name":"Richard Diamond","email":"wichard@vitalitystudios.com"}],"license":"zlib","bugs":{"url":"https://github.com/DiamondLovesYou/TSM/issues"},"homepage":"https://github.com/DiamondLovesYou/TSM","gitHead":"6561758e9172dcba03d1397f394e5f2973ce676f","_id":"@diamondlovesyou/tsm@0.7.3","_shasum":"956f9929100d6b6e740880f08405c4859bc7c910","_from":".","_npmVersion":"3.5.2","_nodeVersion":"4.2.6","_npmUser":{"name":"diamondlovesyou","email":"wichard@vitalitystudios.com"},"dist":{"shasum":"956f9929100d6b6e740880f08405c4859bc7c910","tarball":"https://registry.npmjs.org/@diamondlovesyou/tsm/-/tsm-0.7.3.tgz","integrity":"sha512-uLPGD1A/CNGmpGjW6oKEjgmmrXu5sLhvWbiRqR5rzL5JDMrY2/ni64sTZiuu4z9E6wnhnYdZ+BlAG58wlSRwDQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID3Wtag+a3lz0vxn6fsQ3EHVnd9L2Y6Zl+7X7iQcjuVLAiEAhwlsFd12hGldia3WhpOnbcW5+y7NrsuozrKr6XoKBU0="}]},"maintainers":[{"name":"diamondlovesyou","email":"wichard@vitalitystudios.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/tsm-0.7.3.tgz_1474666487915_0.9226529218722135"}},"0.7.4":{"name":"@diamondlovesyou/tsm","version":"0.7.4","description":"A TypeScript linear algebra library for your computer graphics","main":"./TSM/tsm-0.7.js","types":"./TSM/tsm-0.7.d.ts","scripts":{"test":"echo \"Error: no test specified\" && exit 1","tsc":"tsc"},"files":["TSM"],"repository":{"type":"git","url":"git+https://github.com/DiamondLovesYou/TSM.git"},"keywords":["matrix","vector","linear algebra"],"author":{"name":"Matthias Ferch"},"contributors":[{"name":"Richard Diamond","email":"wichard@vitalitystudios.com"}],"license":"zlib","bugs":{"url":"https://github.com/DiamondLovesYou/TSM/issues"},"homepage":"https://github.com/DiamondLovesYou/TSM","devDependencies":{"typescript":"^2.0.2","typings":"^1.3.2"},"gitHead":"6561758e9172dcba03d1397f394e5f2973ce676f","_id":"@diamondlovesyou/tsm@0.7.4","_shasum":"66cdcfcc6cdba2910c0acae423904f461461897b","_from":".","_npmVersion":"3.5.2","_nodeVersion":"4.2.6","_npmUser":{"name":"diamondlovesyou","email":"wichard@vitalitystudios.com"},"dist":{"shasum":"66cdcfcc6cdba2910c0acae423904f461461897b","tarball":"https://registry.npmjs.org/@diamondlovesyou/tsm/-/tsm-0.7.4.tgz","integrity":"sha512-OMVX/HiCyVGWsmQy7eRi6Mj/VOUsZ0uWhYNYPaznLWEsz5oQvVkT5vmJU2+8CNhQYnz5U9LGl++nHvLmvOu3fw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDtFBcyMNTNG6yB6Hs+EE4TLtRBHyMGzeR4tnhTnh/6xwIgBxbOZcdPBF+GIJhpbltU1FXdnZg3TescBG07bX4/p0U="}]},"maintainers":[{"name":"diamondlovesyou","email":"wichard@vitalitystudios.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/tsm-0.7.4.tgz_1474667746601_0.07376222521997988"}}},"readme":"TSM - A TypeScript vector and matrix math library\n=================================================\n\nTSM is a a collection of vector and matrix classes written in Microsoft's new JavaScript superset *TypeScript*, which compiles to plain JavaScript. The library's design is influenced by both [gl-matrix](https://github.com/toji/gl-matrix) and [GLM](https://github.com/g-truc/glm). \n\nWhat's special about TSM?\n-------------------------\n\n- TSM makes use of TypeScript's type annotations to reduce the number of possible bugs and has been used extensively in the development of a large-scale WebGL application (to be announced soon).\n\n- TSM makes use of JavaScript's new property definitions to enable GLSL-style swizzle operators:\n\n        var v1 = new TSM.vec2();\n        var q1 = new TSM.quat();\n\n        v1.xy = [0, 1];\n        q1.w = 1.0;\n\n- TSM offers both non-static and static methods for many operations:\n\n        var v1 = new TSM.vec3([1, 2, 3]);\n        var v2 = new TSM.vec3([4, 5, 6]);\n\n        var v3 = TSM.vec3.sum(v1, v2);\n        var v4 = v1.copy().add(v2);\n\n        console.log(v3.equals(v4)); // output: \"true\"\n\n\nBuilding TSM\n------------\n\nThis project includes a solution file for *Visual Studio 2012*. It also works with the free Express version of *Visual Studio 2012 for the Web*, which can be downloaded for free from the Microsoft website. Please install the *TypeScript plugin for Visual Studio 2012* to get syntax highlighting and IntelliSense support: http://www.microsoft.com/en-us/download/details.aspx?id=34790.\n\nIf you do not want to or cannot use Visual Studio, you can use the command line tool which comes with the plugin instead:\n\n    tsc --target \"ES5\" --out \"tsm-[x.y].js\" -sourcemap -declarations tsm.ts\n    java -jar ../closure-compiler.jar < tsm-[x.y].js > tsm-[x.y].min.js\n\nThe *target* parameter is necessary for the swizzle operators (.xyz, etc.) to work.\n\nAfter successful compilation, four files will be created:\n\n- *tsm-[x.y].js:*\nThe compiled JavaScript source, readable\n- *tsm-[x.y].min.js:*\nThe compiled JavaScript source, minified\n- *tsm-[x.y].d.ts:*\nThe TypeScript declarations file, which contains a listing of all classes and methods\n- *tsm-[x.y].js.map:*\nA source map which maps the compiled JavaScript output to the original TypeScript source files\n\n\nUsing TSM\n---------\n\n### In Visual Studio\n\nYou can use a reference comment to the declarations file or a module import to get access to TSM classes.\n\n**Reference comment:**\n    \n    ///<reference path='./path/to/TSM/tsm-[x.y].d.ts' />\n\n**Module import:**\n    \n    import TSM = module(\"path/to/TSM\")\n\n### In JavaScript\n\nIf you want to use the generated JavaScript instead, simply load the compiled .js or .min.js file by use of a script tag:\n\n    <script src=\"/path/to/TSM/tsm-[x.y].js\"></script>\n\n\nTesting TSM\n-----------\n\nThe solution contains a test application. Open *TSM/Test/index.html* in a browser and bring up the console. You should see the following output:\n\n    vec2(1,2,3) + vec2(4,5,6) = vec2(5,7,9)\n\n    Perspective projection, 45° FOV:\n    mat4([\n       2.4142136573791504, 0, 0, 0\n       0, 2.4142136573791504, 0, 0\n       0, 0, -1.0202020406723022, -1\n       0, 0, -2.0202019214630127, 0\n    ]);\n\n    vec3(90,0,0).toQuat() = quat(0.8509035110473633,0,0,0.5253219604492188) \n\nIf instead you receive an error message along the lines of \"TSM is not defined\", please make sure that your script tags are properly set up.\n\n\nDocumentation\n-------------\n\nUnfortunately, there is no way yet to automatically generate documentation from TypeScript sources. I'll see what I can do. Please refer to [the declarations file](https://github.com/matthiasferch/TSM/blob/master/TSM/tsm-0.7.d.ts) in the meantime.\n\n###General design notes\n\nSwizzle operators return numeric arrays, not vector instances:\n\n    var v = new TSM.vec4([1, 2, 3, 4]);\n    var n = v.xyz; // n = [1, 2, 3]\n\nIf, instead, you want to create a new instance of a vector or a matrix, use the copy() method:\n\n    var v1 = new TSM.vec4([1, 2, 3, 4]);\n    var v2 = v1.copy();\n\nYou can also initialize a new vector with the values of another:\n\n    var v1 = new TSM.vec4([1, 2, 3, 4]);\n    var v2 = new TSM.vec4(v1.xyzw);\n\nOr copy the values of one vector to another using the swizzle operators or the copy() method:\n\n    v2.xyzw = v1.xyzw; // same as v1.copy(v2)\n\nThe four basic arithmetic operations can be performed on vector instances or using static methods:\n\n    var v1 = new TSM.vec4([1, 2, 3, 4]);\n    var v2 = new TSM.vec4([5, 6, 7, 8]);\n\n    var v3 = TSM.vec4.product(v1, v2); // returns a new vec4 instance\n\n    v1.multiply(v2); // writes the result of the multiplication into v1\n    v2.multiply(v1); // writes the result of the multiplication into v2\n\nThe reason for all of these different ways of doing the same thing is that object allocation in JavaScript is slow and dynamic allocation shoud therefore be reduced to a minimum.\n\nFor this reason, static methods offer an optional destination parameter:\n\n    var v3 = TSM.vec3.cross(v1, v2) // allocates a new instance of vec3\n\nis the same as:\n\n    var v3 = new TSM.vec3();\n    TSM.vec3.cross(v1, v2, v3) // writes into the existing instance\n\nMatrices do not have swizzle operators. Instead, they provide the all(), row() and col() methods:\n\n    var m = new mat2([1, 2, 3, 4]);\n\n    var all = m.all();  // [1, 2, 3, 4]  \n    var row = m.row(0); // [1, 2]\n    var col = m.col(0); // [1, 3] \n\n","maintainers":[{"name":"diamondlovesyou","email":"wichard@vitalitystudios.com"}],"time":{"modified":"2022-06-12T17:03:33.316Z","created":"2016-09-23T21:17:50.853Z","0.7.1":"2016-09-23T21:17:50.853Z","0.7.2":"2016-09-23T21:28:28.326Z","0.7.3":"2016-09-23T21:34:49.134Z","0.7.4":"2016-09-23T21:55:47.797Z"},"homepage":"https://github.com/DiamondLovesYou/TSM","keywords":["matrix","vector","linear algebra"],"repository":{"type":"git","url":"git+https://github.com/DiamondLovesYou/TSM.git"},"contributors":[{"name":"Richard Diamond","email":"wichard@vitalitystudios.com"}],"author":{"name":"Matthias Ferch"},"bugs":{"url":"https://github.com/DiamondLovesYou/TSM/issues"},"license":"zlib","readmeFilename":"README.md"}