mirror of
https://github.com/revarbat/BOSL2.git
synced 2025-03-13 19:29:44 +01:00
Added matrix_transpose()
This commit is contained in:
parent
b86206a80c
commit
cc37b39344
24
math.scad
24
math.scad
@ -1162,9 +1162,26 @@ function xyz_to_altaz(x,y=undef,z=undef) = let(
|
||||
function ident(n) = [for (i = [0:n-1]) [for (j = [0:n-1]) (i==j)?1:0]];
|
||||
|
||||
|
||||
// Create an identity matrix, for 3 axes.
|
||||
//ident3 = ident(3);
|
||||
//ident4 = ident(4);
|
||||
|
||||
// Function: matrix_transpose()
|
||||
// Description: Returns the transposition of the given matrix.
|
||||
// Example:
|
||||
// m = [
|
||||
// [11,12,13,14],
|
||||
// [21,22,23,24],
|
||||
// [31,32,33,34],
|
||||
// [41,42,43,44]
|
||||
// ];
|
||||
// tm = matrix_transpose(m);
|
||||
// // Returns:
|
||||
// // [
|
||||
// // [11,21,31,41],
|
||||
// // [12,22,32,42],
|
||||
// // [13,23,33,43],
|
||||
// // [14,24,34,44]
|
||||
// // ]
|
||||
function matrix_transpose(m) = [for (i=[0:len(m[0])-1]) [for (j=[0:len(m)-1]) m[j][i]]];
|
||||
|
||||
|
||||
|
||||
// Function: mat3_to_mat4()
|
||||
@ -1180,6 +1197,7 @@ function mat3_to_mat4(m) = concat(
|
||||
);
|
||||
|
||||
|
||||
|
||||
// Function: matrix3_translate()
|
||||
// Description:
|
||||
// Returns the 3x3 matrix to perform a 2D translation.
|
||||
|
Loading…
x
Reference in New Issue
Block a user