login  home  contents  what's new  discussion  bug reports help  links  subscribe  changes  refresh  edit

# Edit detail for SandBoxRotationMatrix revision 1 of 1

 1 Editor: Time: 2009/10/16 09:02:06 GMT-7 Note: Test

changed:
-
This says don't use LaTeX output.
\begin{axiom}
)set output tex off
)set output algebra on
\end{axiom}

Rotation matrix
\begin{axiom}
rotationX(alpha) == [[1,0,0],[0,cos(alpha),-sin(alpha)],[0,sin(alpha),cos(alpha)]]
rotationY(beta) == [[cos(beta),0,sin(beta)],[0,1,0],[-sin(beta),0,cos(beta)]]
rotationZ(gamma) == [[cos(gamma),-sin(gamma),0],[sin(gamma),cos(gamma),0],[0,0,1]]
rotation(alpha,beta,gamma) == rotationX(alpha)*rotationY(beta)*rotationZ(gamma)
rotation(alpha,beta,gamma)

\end{axiom}
Transformation for a 3d point (x1,x2,x3) by rotation and translation (t1,t2,t3)
\begin{axiom}
transform(x1,x2,x3,alpha,beta,gamma,t1,t2,t3) == rotation(alpha,beta,gamma) * [[x1],[x2],[x3]]+[[t1],[t2],[t3]]
m := transform(x1,x2,x3,alpha,beta,gamma,t1,t2,t3);
p := [[(m(1,1)/m(3,1))-y1,m(2,1)/m(3,1)-y2]]*[[(m(1,1)/m(3,1))-y1],[m(2,1)/m(3,1)-y2]]

\end{axiom}


This says don't use LaTeX output.

fricas
(1) -> )set output tex off

fricas
)set output algebra on

Rotation matrix

fricas
rotationX(alpha) == [[1,0,0],[0,cos(alpha),-sin(alpha)],[0,sin(alpha),cos(alpha)]]
Type: Void
fricas
rotationY(beta) == [[cos(beta),0,sin(beta)],[0,1,0],[-sin(beta),0,cos(beta)]]
Type: Void
fricas
rotationZ(gamma) == [[cos(gamma),-sin(gamma),0],[sin(gamma),cos(gamma),0],[0,0,1]]
Type: Void
fricas
rotation(alpha,beta,gamma) == rotationX(alpha)*rotationY(beta)*rotationZ(gamma)
Type: Void
fricas
rotation(alpha,beta,gamma)
fricas
Compiling function rotationX with type Variable(alpha) -> List(List(
Expression(Integer)))
fricas
Compiling function rotationY with type Variable(beta) -> List(List(
Expression(Integer)))
There are 31 exposed and 40 unexposed library operations named *
having 2 argument(s) but none was determined to be applicable.
Use HyperDoc Browse, or issue
)display op *
package-calling the operation or using coercions on the arguments
will allow you to apply the operation.
Cannot find a definition or applicable library operation named *
with argument type(s)
List(List(Expression(Integer)))
List(List(Expression(Integer)))
Perhaps you should use "@" to indicate the required return type,
or "\$" to specify which version of the function you need.
FriCAS will attempt to step through and interpret the code.
fricas
Compiling function rotationZ with type Variable(gamma) -> List(List(
Expression(Integer)))
(5)
[[cos(beta)cos(gamma), - cos(beta)sin(gamma), sin(beta)],
[cos(alpha)sin(gamma) + cos(gamma)sin(alpha)sin(beta),
- sin(alpha)sin(beta)sin(gamma) + cos(alpha)cos(gamma),
- cos(beta)sin(alpha)]
,
[sin(alpha)sin(gamma) - cos(alpha)cos(gamma)sin(beta),
cos(alpha)sin(beta)sin(gamma) + cos(gamma)sin(alpha),
cos(alpha)cos(beta)]
]
Type: Matrix(Expression(Integer))

Transformation for a 3d point (x1,x2,x3) by rotation and translation (t1,t2,t3)

fricas
transform(x1,x2,x3,alpha,beta,gamma,t1,t2,t3) == rotation(alpha,beta,gamma) * [[x1],[x2],[x3]]+[[t1],[t2],[t3]]
Type: Void
fricas
m := transform(x1,x2,x3,alpha,beta,gamma,t1,t2,t3);
Cannot compile map: rotation
We will attempt to interpret the code.
Type: Matrix(Expression(Integer))
fricas
p := [[(m(1,1)/m(3,1))-y1,m(2,1)/m(3,1)-y2]]*[[(m(1,1)/m(3,1))-y1],[m(2,1)/m(3,1)-y2]]
(8)
[
[
2          2       2
x2 sin(alpha)  + 2 x2 y2 cos(alpha)sin(alpha)
+
2  2     2  2           2
(x2 y2  + x2 y1 )cos(alpha)
*
2
sin(beta)
+
2
2 x1 x2 y2 sin(alpha)
+
2             2
(2 x1 x2 y2  + 2 x1 x2 y1  - 2 x1 x2)cos(alpha)sin(alpha)
+
2                                              2
2 x2 y1 cos(alpha)cos(beta) - 2 x1 x2 y2 cos(alpha)
*
sin(beta)
+
2  2     2  2           2
(x1 y2  + x1 y1 )sin(alpha)
+
2
(2 x1 x2 y1 cos(beta) - 2 x1 y2 cos(alpha))sin(alpha)
+
2         2     2          2
x2 cos(beta)  + x1 cos(alpha)
*
2
sin(gamma)
+
2
- 2 x1 x2 cos(gamma)sin(alpha)
+
- 4 x1 x2 y2 cos(alpha)cos(gamma)sin(alpha)
+
2             2           2
(- 2 x1 x2 y2  - 2 x1 x2 y1 )cos(alpha) cos(gamma)
+
- 2 x2 x3 y1 cos(alpha)
*
2
sin(beta)
+
2       2                                             2
((2 x2  - 2 x1 )y2 cos(gamma) + 2 x2 x3 cos(beta))sin(alpha)
+
2       2   2        2       2   2       2
(2 x2  - 2 x1 )y2  + (2 x2  - 2 x1 )y1  - 2 x2
+
2
2 x1
*
cos(alpha)cos(gamma)
+
4 x2 x3 y2 cos(alpha)cos(beta) + 2 t3 x2 y2 - 2 x1 x3 y1
+
- 2 t2 x2
*
sin(alpha)
+
- 4 x1 x2 y1 cos(alpha)cos(beta)
+
2       2              2
(- 2 x2  + 2 x1 )y2 cos(alpha)
*
cos(gamma)
+
2             2           2
((2 x2 x3 y2  + 2 x2 x3 y1 )cos(alpha)  - 2 x2 x3)cos(beta)
+
2                          2
(2 t3 x2 y2  - 2 t2 x2 y2 + 2 t3 x2 y1  - 2 t1 x2 y1)cos(alpha)
*
sin(beta)
+
2             2
((2 x1 x2 y2  + 2 x1 x2 y1 )cos(gamma) + 2 x1 x3 y2 cos(beta))
*
2
sin(alpha)
+
2       2
((2 x2  - 2 x1 )y1 cos(beta) - 4 x1 x2 y2 cos(alpha))
*
cos(gamma)
+
2             2
(2 x1 x3 y2  + 2 x1 x3 y1  - 2 x1 x3)cos(alpha)cos(beta)
+
2                          2
2 t3 x1 y2  - 2 t2 x1 y2 + 2 t3 x1 y1  - 2 t1 x1 y1
*
sin(alpha)
+
2                     2
(- 2 x1 x2 cos(beta)  + 2 x1 x2 cos(alpha) )cos(gamma)
+
2
2 x2 x3 y1 cos(alpha)cos(beta)
+
2
(- 2 x1 x3 y2 cos(alpha)  + 2 t3 x2 y1 - 2 t1 x2)cos(beta)
+
(- 2 t3 x1 y2 + 2 t2 x1)cos(alpha)
*
sin(gamma)
+
2          2          2
x1 cos(gamma) sin(alpha)
+
2                       2
2 x1 y2 cos(alpha)cos(gamma) sin(alpha)
+
2  2     2  2           2          2
(x1 y2  + x1 y1 )cos(alpha) cos(gamma)
+
2
2 x1 x3 y1 cos(alpha)cos(gamma) + x3
*
2
sin(beta)
+
2
(- 2 x1 x2 y2 cos(gamma)  - 2 x1 x3 cos(beta)cos(gamma))
*
2
sin(alpha)
+
2             2                               2
(- 2 x1 x2 y2  - 2 x1 x2 y1  + 2 x1 x2)cos(alpha)cos(gamma)
+
- 4 x1 x3 y2 cos(alpha)cos(beta) - 2 t3 x1 y2
+
- 2 x2 x3 y1 + 2 t2 x1
*
cos(gamma)
*
sin(alpha)
+
2                                              2           2
(2 x1 y1 cos(alpha)cos(beta) + 2 x1 x2 y2 cos(alpha) )cos(gamma)
+
2             2           2
((- 2 x1 x3 y2  - 2 x1 x3 y1 )cos(alpha)  + 2 x1 x3)cos(beta)
+
2                          2
(- 2 t3 x1 y2  + 2 t2 x1 y2 - 2 t3 x1 y1  + 2 t1 x1 y1)
*
cos(alpha)
*
cos(gamma)
+
2
- 2 x3 y1 cos(alpha)cos(beta) - 2 t3 x3 y1 + 2 t1 x3
*
sin(beta)
+
2  2     2  2           2
(x2 y2  + x2 y1 )cos(gamma)  + 2 x2 x3 y2 cos(beta)cos(gamma)
+
2         2
x3 cos(beta)
*
2
sin(alpha)
+
2                        2
(- 2 x1 x2 y1 cos(beta) - 2 x2 y2 cos(alpha))cos(gamma)
+
2             2
(2 x2 x3 y2  + 2 x2 x3 y1  - 2 x2 x3)cos(alpha)cos(beta)
+
2                          2
2 t3 x2 y2  - 2 t2 x2 y2 + 2 t3 x2 y1  - 2 t1 x2 y1
*
cos(gamma)
+
2                      2
2 x3 y2 cos(alpha)cos(beta)  + (2 t3 x3 y2 - 2 t2 x3)cos(beta)
*
sin(alpha)
+
2         2     2          2           2
(x1 cos(beta)  + x2 cos(alpha) )cos(gamma)
+
2
- 2 x1 x3 y1 cos(alpha)cos(beta)
+
2
(- 2 x2 x3 y2 cos(alpha)  - 2 t3 x1 y1 + 2 t1 x1)cos(beta)
+
(- 2 t3 x2 y2 + 2 t2 x2)cos(alpha)
*
cos(gamma)
+
2  2     2  2           2         2
(x3 y2  + x3 y1 )cos(alpha) cos(beta)
+
2                          2
(2 t3 x3 y2  - 2 t2 x3 y2 + 2 t3 x3 y1  - 2 t1 x3 y1)cos(alpha)
*
cos(beta)
+
2  2                  2  2                  2     2
t3 y2  - 2 t2 t3 y2 + t3 y1  - 2 t1 t3 y1 + t2  + t1
/
2          2         2
x2 cos(alpha) sin(beta)  + 2 x1 x2 cos(alpha)sin(alpha)sin(beta)
+
2          2
x1 sin(alpha)
*
2
sin(gamma)
+
2                   2
- 2 x1 x2 cos(alpha) cos(gamma)sin(beta)
+
2       2
(2 x2  - 2 x1 )cos(alpha)cos(gamma)sin(alpha)
+
2
2 x2 x3 cos(alpha) cos(beta) + 2 t3 x2 cos(alpha)
*
sin(beta)
+
2
2 x1 x2 cos(gamma)sin(alpha)
+
(2 x1 x3 cos(alpha)cos(beta) + 2 t3 x1)sin(alpha)
*
sin(gamma)
+
2          2          2         2
x1 cos(alpha) cos(gamma) sin(beta)
+
2
- 2 x1 x2 cos(alpha)cos(gamma) sin(alpha)
+
2
(- 2 x1 x3 cos(alpha) cos(beta) - 2 t3 x1 cos(alpha))cos(gamma)
*
sin(beta)
+
2          2          2
x2 cos(gamma) sin(alpha)
+
(2 x2 x3 cos(alpha)cos(beta) + 2 t3 x2)cos(gamma)sin(alpha)
+
2          2         2                                   2
x3 cos(alpha) cos(beta)  + 2 t3 x3 cos(alpha)cos(beta) + t3
]
]
Type: Matrix(Expression(Integer))