Hi Mick.
I'm using a vector as an example as I can work out the translation later.
I just can't seem to figure out the individual rotation matrix in the x,y and z axis or which order to multiply them.
This site (
http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToMatrix/index.htm) has a great function for rotating around a vector, in vba
Function RotateAroundVector(V As Variant, Angle As Double) As Variant
Dim M(3, 3)
Dim X As Double, Y As Double, Z As Double
X = V(0): Y = V(1): Z = V(2)
M(0, 0) = 1 + (1 - Cos(Angle)) * (X * X - 1)
M(0, 1) = -Z * Sin(Angle) + (1 - Cos(Angle)) * X * Y
M(0, 2) = Y * Sin(Angle) + (1 - Cos(Angle)) * X * Z
M(0, 3) = 0
M(1, 0) = Z * Sin(Angle) + (1 - Cos(Angle)) * X * Y
M(1, 1) = 1 + (1 - Cos(Angle)) * (Y * Y - 1)
M(1, 2) = -X * Sin(Angle) + (1 - Cos(Angle)) * Y * Z
M(1, 3) = 0
M(2, 0) = -Y * Sin(Angle) + (1 - Cos(Angle)) * X * Z
M(2, 1) = X * Sin(Angle) + (1 - Cos(Angle)) * Y * Z
M(2, 2) = 1 + (1 - Cos(Angle)) * (Z * Z - 1)
M(2, 3) = 0
M(3, 0) = 0
M(3, 1) = 0
M(3, 2) = 0
M(3, 3) = 1
RotateAroundVector = M
End Function
This gives me the ability to somewhat copy the cad commandline spherical coordinates Line:0,0,0 @1<45<45 which in effect is rotate around the z using the angle of the the vector then rotate from the xy plane using the matrix and an angle.
So far it's working as I haven't tried to many variations. I still have no idea how to work out the 3 axis as it seems they would work if the 3 could be multiplied at one time, whereas once you multiply x*y the resulting matrix is wrong for multiplying z , maybe, perhaps.