mirror of
https://github.com/revarbat/BOSL2.git
synced 2025-08-13 06:14:08 +02:00
Added matrix_transpose()
This commit is contained in:
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]];
|
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);
|
// Function: matrix_transpose()
|
||||||
//ident4 = ident(4);
|
// 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()
|
// Function: mat3_to_mat4()
|
||||||
@@ -1180,6 +1197,7 @@ function mat3_to_mat4(m) = concat(
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Function: matrix3_translate()
|
// Function: matrix3_translate()
|
||||||
// Description:
|
// Description:
|
||||||
// Returns the 3x3 matrix to perform a 2D translation.
|
// Returns the 3x3 matrix to perform a 2D translation.
|
||||||
|
Reference in New Issue
Block a user