Question: Create Homogeneous Transformation Matrix through Concatenation of vector functions


I am trying to create a Homogeneous transformation matrix, where I am given the point 'p' through which a unit rotation axis 'x' passes and the point/vector on which this Homogenous transformation acts is rotated by 'theta'.

I used the Rodrigues formula (the one in the blue-green box) to define the rotation matrix;

unit_axis_cross_mat := unapply(<<0 | -x[3] | x[2]>, <x[3] | 0 | -x[1]>, <-x[2] | x[1] | 0>>, x::Vector);
rot_mat := unapply(LinearAlgebra[IdentityMatrix](3) + unit_axis_cross_mat(<x[1], x[2], x[3]>)*sin(theta) + MatrixPower(unit_axis_cross_mat(<x[1], x[2], x[3]>), 2)*(1 - cos(theta)), x::Vector, theta)

I then tried to concatenate them to generate the matrix function

, where the exponential term represents the rotation matrix (defined above) as such:

trans_mat_ang := unapply(ArrayTools[Concatenate](1, ArrayTools[Concatenate](2, rot_mat(<x[1], x[2], x[3]>, theta), (LinearAlgebra[IdentityMatrix](3) - rot_mat(<x[1], x[2], x[3]>, theta)) . <p[1], p[2], p[3]>), <0 | 0 | 0 | 1>), x::Vector, theta, p::Vector)

But I end up getting the error 

"Error, (in ArrayTools:-Concatenate) number of columns must match"

To diagnose it, I try to evaluate the 1st Concatenation:

trans_mat := unapply(<ArrayTools[Concatenate](2, rot_mat(<x[1], x[2], x[3]>, theta), (LinearAlgebra[IdentityMatrix](3) - rot_mat(<x[1], x[2], x[3]>, theta)) . <p[1], p[2], p[3]>)>, x::Vector, p::Vector, theta);

which runs successfully, but when I try to evaluate it:

trans_mat(<1, 0, 0>, <1, 0, 0>, 0)

, I get a symbolic expression .

Although the expression is correct algabrically, I expected a full evaluation for the numerical inputs.

I am attaching my for your ease of diagnosis.

Is this the cause of the error of "Number of Columns must match"?

Any help towards this would be appreciated.



Please Wait...