mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-06 04:09:47 +00:00
Fixed tail recursion in matrix[34]_mult(), and de-exposed
This commit is contained in:
parent
b1c7e71294
commit
a5065c1595
1 changed files with 6 additions and 10 deletions
|
@ -113,11 +113,9 @@ function matrix3_skew(xa, ya) = [
|
||||||
// Returns a 3x3 transformation matrix which results from applying each matrix in `matrices` in order.
|
// Returns a 3x3 transformation matrix which results from applying each matrix in `matrices` in order.
|
||||||
// Arguments:
|
// Arguments:
|
||||||
// matrices = A list of 3x3 matrices.
|
// matrices = A list of 3x3 matrices.
|
||||||
// m = Optional starting matrix to apply everything to.
|
function matrix3_mult(matrices, _m=undef, _i=0) =
|
||||||
function matrix3_mult(matrices, m=ident(3), i=0) =
|
(_i>=len(matrices))? (is_undef(_m)? ident(3) : _m) :
|
||||||
(i>=len(matrices))? m :
|
matrix3_mult(matrices, _m=(is_undef(_m)? matrices[_i] : matrices[_i] * _m), _i=_i+1);
|
||||||
let (newmat = is_undef(m)? matrices[i] : matrices[i] * m)
|
|
||||||
matrix3_mult(matrices, m=newmat, i=i+1);
|
|
||||||
|
|
||||||
|
|
||||||
// Function: matrix3_apply()
|
// Function: matrix3_apply()
|
||||||
|
@ -289,11 +287,9 @@ function matrix4_skew_yz(ya, za) = [
|
||||||
// Returns a 4x4 transformation matrix which results from applying each matrix in `matrices` in order.
|
// Returns a 4x4 transformation matrix which results from applying each matrix in `matrices` in order.
|
||||||
// Arguments:
|
// Arguments:
|
||||||
// matrices = A list of 4x4 matrices.
|
// matrices = A list of 4x4 matrices.
|
||||||
// m = Optional starting matrix to apply everything to.
|
function matrix4_mult(matrices, _m=undef, _i=0) =
|
||||||
function matrix4_mult(matrices, m=ident(4), i=0) =
|
(_i>=len(matrices))? (is_undef(_m)? ident(4) : _m) :
|
||||||
(i>=len(matrices))? m :
|
matrix4_mult(matrices, _m=(is_undef(_m)? matrices[_i] : matrices[_i] * _m), _i=_i+1);
|
||||||
let (newmat = is_undef(m)? matrices[i] : matrices[i] * m)
|
|
||||||
matrix4_mult(matrices, m=newmat, i=i+1);
|
|
||||||
|
|
||||||
|
|
||||||
// Function: matrix4_apply()
|
// Function: matrix4_apply()
|
||||||
|
|
Loading…
Reference in a new issue