]> gitweb.factorcode.org Git - factor.git/commitdiff
typo in n*m4, n/m4 types
authorJoe Groff <arcata@gmail.com>
Tue, 29 Sep 2009 23:21:51 +0000 (18:21 -0500)
committerJoe Groff <arcata@gmail.com>
Tue, 29 Sep 2009 23:21:51 +0000 (18:21 -0500)
extra/math/matrices/simd/simd-tests.factor
extra/math/matrices/simd/simd.factor

index a0c01f4495267d61a60758d560bad01ce66c3b18..949ff9e66755e2d75164d3a79e7ab0d2f76eacf3 100644 (file)
@@ -125,3 +125,47 @@ IN: math.matrices.simd.tests
     }
     m4-
 ] unit-test
+
+[
+    S{ matrix4 f
+        float-4-array{
+            float-4{ 3.0 0.0 0.0 15.0 }
+            float-4{ 0.0 3.0 0.0 18.0 }
+            float-4{ 0.0 0.0 3.0 21.0 }
+            float-4{ 0.0 0.0 0.0  3.0 }
+        }
+    }
+] [
+    S{ matrix4 f
+        float-4-array{
+            float-4{ 1.0 0.0 0.0 5.0 }
+            float-4{ 0.0 1.0 0.0 6.0 }
+            float-4{ 0.0 0.0 1.0 7.0 }
+            float-4{ 0.0 0.0 0.0 1.0 }
+        }
+    }
+    3.0 m4*n
+] unit-test
+
+[
+    S{ matrix4 f
+        float-4-array{
+            float-4{ 3.0 0.0 0.0 15.0 }
+            float-4{ 0.0 3.0 0.0 18.0 }
+            float-4{ 0.0 0.0 3.0 21.0 }
+            float-4{ 0.0 0.0 0.0  3.0 }
+        }
+    }
+] [
+    3.0 
+    S{ matrix4 f
+        float-4-array{
+            float-4{ 1.0 0.0 0.0 5.0 }
+            float-4{ 0.0 1.0 0.0 6.0 }
+            float-4{ 0.0 0.0 1.0 7.0 }
+            float-4{ 0.0 0.0 0.0 1.0 }
+        }
+    }
+    n*m4
+] unit-test
+
index a9fd2921c4524b746240214a84debf014a815089..c5113d45022c36eba8264c9f3663a28a16a3ef61 100644 (file)
@@ -70,8 +70,8 @@ TYPED: m4/ ( a: matrix4 b: matrix4 -- c: matrix4 ) [ v/ ] 2map-rows ;
 
 TYPED: m4*n ( a: matrix4 b: float -- c: matrix4 ) [ v*n ] curry map-rows ;
 TYPED: m4/n ( a: matrix4 b: float -- c: matrix4 ) [ v/n ] curry map-rows ;
-TYPED: n*m4 ( a: matrix4 b: float -- c: matrix4 ) [ n*v ] with map-rows ;
-TYPED: n/m4 ( a: matrix4 b: float -- c: matrix4 ) [ n/v ] with map-rows ;
+TYPED: n*m4 ( a: float b: matrix4 -- c: matrix4 ) [ n*v ] with map-rows ;
+TYPED: n/m4 ( a: float b: matrix4 -- c: matrix4 ) [ n/v ] with map-rows ;
 
 TYPED:: m4. ( a: matrix4 b: matrix4 -- c: matrix4 )
     matrix4 (struct) :> c
@@ -157,3 +157,30 @@ TYPED:: translation-matrix4 ( offset: float-4 -- matrix: matrix4 )
 
     c ;
 
+! TYPED:: rotation-matrix4 ( axis: float-4 theta: float -- matrix: matrix4 )
+!     matrix4 (struct) :> c
+!     float-4{  1.0 -1.0  1.0 0.0 } :> triangle-sign
+! 
+!     theta cos float-4-with :> cc
+!     theta sin float-4-with :> ss
+!     1.0 float-4-with :> ones
+!     ones cc v- :> 1-c
+!     axis axis v* :> axis2
+! 
+!     axis2 cc ones axis2 v- v* v+ ones
+!     [ { t t t f } ] 2dip v? :> diagonal
+! 
+!     axis { 0 0 1 3 } vshuffle axis { 1 2 2 3 } vshuffle v* 1-c v* :> triangle-a
+!     ss { 2 1 0 3 } vshuffle triangle-sign * :> triangle-b
+!     triangle-a triangle-b + :> triangle-lo
+!     triangle-a triangle-b - :> triangle-hi
+! 
+!     ... ;
+! !   x*x + c*(1.0 - x*x)   x*y*(1.0 - c) - s*z   x*z*(1.0 - c) + s*y   0
+! !   x*y*(1.0 - c) + s*z   y*y + c*(1.0 - y*y)   y*z*(1.0 - c) - s*x   0
+! !   x*z*(1.0 - c) - s*y   y*z*(1.0 - c) + s*x   z*z + c*(1.0 - z*z)   0
+! !   0                     0                     0                     1
+! 
+! TYPED:: frustum-matrix4 ( xy: float-4 near: float far: float -- matrix: matrix4 )
+
+