mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-27 16:30:29 +02:00
refactor
This commit is contained in:
@@ -1,7 +1,5 @@
|
|||||||
use <util/slice.scad>;
|
use <util/slice.scad>;
|
||||||
|
use <experimental/sum.scad>;
|
||||||
function _m_determinant_sum(lt, leng, i = 0) =
|
|
||||||
i == leng ? 0 : (lt[i] + _m_determinant_sum(lt, leng, i + 1));
|
|
||||||
|
|
||||||
function _m_determinant_sub(matrix, leng, fc) =
|
function _m_determinant_sub(matrix, leng, fc) =
|
||||||
let(
|
let(
|
||||||
@@ -17,4 +15,4 @@ function _m_determinant(matrix) =
|
|||||||
let(leng = len(matrix))
|
let(leng = len(matrix))
|
||||||
leng == 2 ? matrix[0][0] * matrix[1][1] - matrix[1][0] * matrix[0][1] :
|
leng == 2 ? matrix[0][0] * matrix[1][1] - matrix[1][0] * matrix[0][1] :
|
||||||
let(indices = [for(i = [0:leng - 1]) i])
|
let(indices = [for(i = [0:leng - 1]) i])
|
||||||
_m_determinant_sum([for(fc = indices) _m_determinant_sub(matrix, leng, fc)], leng);
|
sum([for(fc = indices) _m_determinant_sub(matrix, leng, fc)]);
|
Reference in New Issue
Block a user