From 1df84f35525ac78c0a65296413bd89b323c50d3d Mon Sep 17 00:00:00 2001
From: RonaldoCMP <rcmpersiano@gmail.com>
Date: Tue, 11 Aug 2020 14:33:42 +0100
Subject: [PATCH] Revert "Extend scope of transpose"

This reverts commit 5ebf1c80b956d04b79b6b45372948e5267fa27d1.
---
 arrays.scad            | 26 +++-----------------------
 tests/test_arrays.scad |  1 -
 2 files changed, 3 insertions(+), 24 deletions(-)

diff --git a/arrays.scad b/arrays.scad
index 835fd65..6124e89 100644
--- a/arrays.scad
+++ b/arrays.scad
@@ -1287,10 +1287,6 @@ function array_dim(v, depth=undef) =
 
 // Function: transpose()
 // Description: Returns the transposition of the given array.
-//    When reverse=true, the transposition is done in respect to the secondary diagonal, that is:
-//    .
-//    reverse(transpose(reverse(arr))) == transpose(arr, reverse=true)
-//    By default, reverse=false.
 // Example:
 //   arr = [
 //       ["a", "b", "c"],
@@ -1317,30 +1313,14 @@ function array_dim(v, depth=undef) =
 //   //     ["c", "f"],
 //   // ]
 // Example:
-//   arr = [
-//       ["a", "b", "c"],
-//       ["d", "e", "f"],
-//       ["g", "h", "i"]
-//   ];
-//   t = transpose(arr, reverse=true);
-//   // Returns:
-//   // [
-//   //  ["i", "f", "c"],
-//   //  ["h", "e", "b"],
-//   //  ["g", "d", "a"]
-//   // ]
-// Example:
 //   transpose([3,4,5]);  // Returns: [3,4,5]
-function transpose(arr, reverse=false) =
+function transpose(arr) =
     assert( is_list(arr) && len(arr)>0, "The array is not a vector neither a matrix." )
     is_list(arr[0])
     ?   let( l0 = len(arr[0]) )
         assert([for(a=arr) if(!is_list(a) || len(a)!=l0) 1 ]==[], "The array is not a vector neither a matrix." )
-        reverse
-        ? [for (i=[0:1:l0-1]) 
-              [ for (j=[0:1:len(arr)-1]) arr[len(arr)-1-j][l0-1-i] ] ] 
-        : [for (i=[0:1:l0-1]) 
-              [ for (j=[0:1:len(arr)-1]) arr[j][i] ] ] 
+        [for (i=[0:1:l0-1]) 
+            [ for (j=[0:1:len(arr)-1]) arr[j][i] ] ] 
     :  assert( is_vector(arr), "The array is not a vector neither a matrix." )
            arr;
 
diff --git a/tests/test_arrays.scad b/tests/test_arrays.scad
index f121266..64a7fbb 100644
--- a/tests/test_arrays.scad
+++ b/tests/test_arrays.scad
@@ -480,7 +480,6 @@ test_array_dim();
 module test_transpose() {
     assert(transpose([[1,2,3],[4,5,6],[7,8,9]]) == [[1,4,7],[2,5,8],[3,6,9]]);
     assert(transpose([[1,2,3],[4,5,6]]) == [[1,4],[2,5],[3,6]]);
-    assert(transpose([[1,2,3],[4,5,6]], reverse=true) == [[6,3],[5,2],[4,1]]);
     assert(transpose([3,4,5]) == [3,4,5]);
 }
 test_transpose();