From a51d981b8da4bc499f628f1e0eb57c098ce7d91b Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Sun, 14 Jun 2020 10:32:16 +0800 Subject: [PATCH] add doc --- README.md | 2 +- docs/lib2x-m_determinant.md | 37 +++++++++++++++++++++++++++++++++++ src/matrix/m_determinant.scad | 12 +++++++++++- 3 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 docs/lib2x-m_determinant.md diff --git a/README.md b/README.md index 578ef00e..f594e05a 100644 --- a/README.md +++ b/README.md @@ -231,7 +231,7 @@ See [examples](examples). - [voxel/vx_difference](https://openhome.cc/eGossip/OpenSCAD/lib2x-vx_difference.html) ### Matrix -- matrix/m_determinant +- [matrix/m_determinant](https://openhome.cc/eGossip/OpenSCAD/lib2x-m_determinant.html) ### Voronoi - voronoi/vrn2_from diff --git a/docs/lib2x-m_determinant.md b/docs/lib2x-m_determinant.md new file mode 100644 index 00000000..e7a20a23 --- /dev/null +++ b/docs/lib2x-m_determinant.md @@ -0,0 +1,37 @@ +# m_determinant + +It can calculate a determinant, a special number that can be calculated from a square matrix. + +**Since:** 2.4 + +## Parameters + +- `m` : A square matrix. + +## Examples + + use ; + + assert( + m_determinant([ + [3, 8], + [4, 6] + ]) == -14 + ); + + assert( + m_determinant([ + [6, 1, 1], + [4, -2, 5], + [2, 8, 7] + ]) == -306 + ); + + assert( + m_determinant([ + [0, 4, 0, -3], + [1, 1, 5, 2], + [1, -2, 0, 6], + [3, 0, 0, 1] + ]) == -250 + ); \ No newline at end of file diff --git a/src/matrix/m_determinant.scad b/src/matrix/m_determinant.scad index 07e249b3..3896a75d 100644 --- a/src/matrix/m_determinant.scad +++ b/src/matrix/m_determinant.scad @@ -1,3 +1,13 @@ +/** +* m_determinant.scad +* +* @copyright Justin Lin, 2019 +* @license https://opensource.org/licenses/lgpl-3.0.html +* +* @see https://openhome.cc/eGossip/OpenSCAD/lib2x-m_determinant.html +* +**/ + use <_impl/_m_determinant_impl.scad>; -function m_determinant(matrix) = _m_determinant(matrix); \ No newline at end of file +function m_determinant(m) = _m_determinant(m); \ No newline at end of file