/usr/share/axiom-20170501/src/algebra/DHMATRIX.spad is in axiom-source 20170501-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | )abbrev domain DHMATRIX DenavitHartenbergMatrix
++ Author: Timothy Daly
++ Date Created: June 26, 1991
++ Date Last Updated: 26 June 1991
++ Description:
++ 4x4 Matrices for coordinate transformations\br
++ This package contains functions to create 4x4 matrices
++ useful for rotating and transforming coordinate systems.
++ These matrices are useful for graphics and robotics.
++ (Reference: Robot Manipulators Richard Paul MIT Press 1981)
++
++ A Denavit-Hartenberg Matrix is a 4x4 Matrix of the form:\br
++ \tab{5}\spad{nx ox ax px}\br
++ \tab{5}\spad{ny oy ay py}\br
++ \tab{5}\spad{nz oz az pz}\br
++ \tab{5}\spad{0 0 0 1}\br
++ (n, o, and a are the direction cosines)
DenavitHartenbergMatrix(R) : SIG == CODE where
R : Join(Field, TranscendentalFunctionCategory)
-- for the implementation of dhmatrix
minrow ==> 1
mincolumn ==> 1
--
nx ==> x(1,1)::R
ny ==> x(2,1)::R
nz ==> x(3,1)::R
ox ==> x(1,2)::R
oy ==> x(2,2)::R
oz ==> x(3,2)::R
ax ==> x(1,3)::R
ay ==> x(2,3)::R
az ==> x(3,3)::R
px ==> x(1,4)::R
py ==> x(2,4)::R
pz ==> x(3,4)::R
row ==> Vector(R)
col ==> Vector(R)
radians ==> pi()/180
SIG ==> MatrixCategory(R,row,col) with
"*" : (%, Point R) -> Point R
++ t*p applies the dhmatrix t to point p
++
++X rotatex(30)*point([1,2,3])
identity : () -> %
++ identity() create the identity dhmatrix
++
++ identity()
rotatex : R -> %
++ rotatex(r) returns a dhmatrix for rotation about axis x for r degrees
++
++X rotatex(30)
rotatey : R -> %
++ rotatey(r) returns a dhmatrix for rotation about axis y for r degrees
++
++X rotatey(30)
rotatez : R -> %
++ rotatez(r) returns a dhmatrix for rotation about axis z for r degrees
++
++X rotatez(30)
scale : (R,R,R) -> %
++ scale(sx,sy,sz) returns a dhmatrix for scaling in the x, y and z
++ directions
++
++X scale(0.5,0.5,0.5)
translate : (R,R,R) -> %
++ translate(x,y,z) returns a dhmatrix for translation by x, y, and z
++
++X translate(1.0,2.0,3.0)
CODE ==> Matrix(R) add
identity() == matrix([[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]])
d * p ==
v := p pretend Vector R
v := concat(v, 1$R)
v := d * v
point ([v.1, v.2, v.3]$List(R))
rotatex(degree) ==
angle := degree * pi() / 180::R
cosAngle := cos(angle)
sinAngle := sin(angle)
matrix(_
[[1, 0, 0, 0], _
[0, cosAngle, -sinAngle, 0], _
[0, sinAngle, cosAngle, 0], _
[0, 0, 0, 1]])
rotatey(degree) ==
angle := degree * pi() / 180::R
cosAngle := cos(angle)
sinAngle := sin(angle)
matrix(_
[[ cosAngle, 0, sinAngle, 0], _
[ 0, 1, 0, 0], _
[-sinAngle, 0, cosAngle, 0], _
[ 0, 0, 0, 1]])
rotatez(degree) ==
angle := degree * pi() / 180::R
cosAngle := cos(angle)
sinAngle := sin(angle)
matrix(_
[[cosAngle, -sinAngle, 0, 0], _
[sinAngle, cosAngle, 0, 0], _
[ 0, 0, 1, 0], _
[ 0, 0, 0, 1]])
scale(scalex, scaley, scalez) ==
matrix(_
[[scalex, 0 ,0 , 0], _
[0 , scaley ,0 , 0], _
[0 , 0, scalez, 0], _
[0 , 0, 0 , 1]])
translate(x,y,z) ==
matrix(_
[[1,0,0,x],_
[0,1,0,y],_
[0,0,1,z],_
[0,0,0,1]])
|