transformation-matrix
Advanced tools
Comparing version 1.14.1 to 1.15.0
{ | ||
"name": "transformation-matrix", | ||
"version": "1.14.1", | ||
"version": "1.15.0", | ||
"description": "2d transformation matrix functions written in ES6 syntax. Tree shaking ready!", | ||
@@ -21,3 +21,3 @@ "main": "./build-commonjs/index.js", | ||
"coveralls": "jest --coverage --coveragePathIgnorePatterns autogenerated --coverageReporters=text-lcov | coveralls", | ||
"test:ci": "npm-run-all standard test build", | ||
"test:ci": "npm-run-all standard test build coveralls", | ||
"test": "jest", | ||
@@ -31,5 +31,5 @@ "build-commonjs": "cross-env BABEL_ENV=commonjs babel src --out-dir build-commonjs", | ||
"clean": "del build-*", | ||
"version": "npm-run-all clean test coverage coveralls build add-build-to-vcs", | ||
"version": "npm-run-all clean test build add-readme-to-vcs", | ||
"build": "npm-run-all clean build-commonjs build-es build-docs build-umd build-umd-min build-parser", | ||
"add-build-to-vcs": "git add -A README.md", | ||
"add-readme-to-vcs": "git add -A README.md", | ||
"standard": "standard" | ||
@@ -36,0 +36,0 @@ }, |
@@ -100,2 +100,5 @@ <!--------------------------------------------------------------------> | ||
</dd> | ||
<dt><a href="#fromTriangles">fromTriangles(t1, t2)</a> ⇒ <code>Object</code></dt> | ||
<dd><p>Returns a matrix that transforms a triangle t1 into another triangle t2, or throws an exception if it is impossible.</p> | ||
</dd> | ||
<dt><a href="#identity">identity()</a> ⇒ <code>Object</code></dt> | ||
@@ -128,2 +131,5 @@ <dd><p>Identity matrix</p> | ||
</dd> | ||
<dt><a href="#smoothMatrix">smoothMatrix(m, [precision])</a> ⇒ <code>Object</code></dt> | ||
<dd><p>Rounds all elements of the given matrix using the given precision</p> | ||
</dd> | ||
<dt><a href="#toCSS">toCSS(matrix)</a> ⇒ <code>string</code></dt> | ||
@@ -166,2 +172,3 @@ <dd><p>Serialize the matrix to a string that can be used with CSS or SVG</p> | ||
- **1.14**- Adds support for points defined as `Array` in the form `[x, y]` [#38](https://github.com/chrvadala/transformation-matrix/pull/38) | ||
- **1.15**- Adds `fromTriangle` and `smoothMatrix` functions [#41](https://github.com/chrvadala/transformation-matrix/issues/41) | ||
@@ -181,2 +188,3 @@ ## Some projects using transformation-matrix | ||
- [aubergene](https://github.com/aubergene) | ||
- [SophiaLi1](https://github.com/SophiaLi1) | ||
@@ -248,2 +256,19 @@ # API | ||
<a name="fromTriangles"></a> | ||
## fromTriangles(t1, t2) ⇒ <code>Object</code> | ||
Returns a matrix that transforms a triangle t1 into another triangle t2, or throws an exception if it is impossible. | ||
**Kind**: global function | ||
**Returns**: <code>Object</code> - Affine matrix which transforms t1 to t2 | ||
**Throws**: | ||
- Exception if the matrix becomes not invertible | ||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| t1 | <code>Array.<{x: number, y: number}></code> \| <code>Array.<Array.<number>></code> | an array of points containing the three points for the first triangle | | ||
| t2 | <code>Array.<{x: number, y: number}></code> \| <code>Array.<Array.<number>></code> | an array of points containing the three points for the second triangle | | ||
<a name="identity"></a> | ||
@@ -359,2 +384,15 @@ | ||
<a name="smoothMatrix"></a> | ||
## smoothMatrix(m, [precision]) ⇒ <code>Object</code> | ||
Rounds all elements of the given matrix using the given precision | ||
**Kind**: global function | ||
**Returns**: <code>Object</code> - the rounded matrix | ||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| m | <code>Object</code> | a matrix to round | | ||
| [precision] | | a precision to use for Math.round. Defaults to 10000000000 (meaning which rounds to the 10th digit after the comma). | | ||
<a name="toCSS"></a> | ||
@@ -361,0 +399,0 @@ |
Sorry, the diff of this file is not supported yet
250474
68
5897
465