cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:

Highlighted
Garnet

## Transformation matrix

Hello

i make a worksheet for calculate transformation matrix:

first i write Rx Ry Rz rotation matrix

in second time (it's not mandatory), i define passage order of passage. by habit i use Cardan (or reverse RTL)

after i have the matrix position : X Y Z RX RY RZ

(in this matrix i have 1 line or over 1000 lines)

I define a transformation function, in this i use an homogeneous matrix

in this matrix, the first 3x3 are the rotation matrix (matrix of cosine) and the last matrix 3x1 are the position matrix

Now , my problem:

I want to calculate all transformation matrix (with T function) for all Position matrix

exemple:

T(0,-2,0,-1,-5,0.5)

T(1,0,5,0,-1,1)

and other ...

and finally i want 1 matrix with all submatrix

21 REPLIES 21
Highlighted

## Re: Transformation matrix

1) By default vectors and matrices start numbering their elements with 0, not with 1 as you thought. So your function T() won't work for a single set of six values (you should always test your function!).
Fortunately there is a system variable ORIGIN and if you set it to 1 by typing ORIGIN:=1 at the top of the sheet, or use a global assignment anywhere on the sheet or set the variable via the menu ("Calculation" ribbon) then your sheet works OK.

2) Here is one possible way to achieve what you demanded:

P6 worksheet attached

Highlighted

## Re: Transformation matrix

Ok for your first note , i use origin =1 in ribbon

and i erase first line in position matrix (i write the first line in this matrix just for understanding)

i watch the rest !😃

Highlighted

## Re: Transformation matrix

@XDN wrote:

Ok for your first note , i use origin =1 in ribbon

Fine, its up to you how you handle this.

and i erase first line in position matrix (i write the first line in this matrix just for understanding)

i watch the rest !😃

Not necessary to delete the line with the columns headers. But if you do you would have to change my "O+1" for just "O" and my "i-1" for "i" in the calculation of All_Ts.

Keep on watching 😉

Highlighted
Sapphire III
(in response to XDN)

## Re: Transformation matrix

Like this?

Success!
Luc

Highlighted
Sapphire III
(in response to XDN)

## Re: Transformation matrix

Incidentally...

Are you sure that the Euler transformation does not use Ry ?

Luc

Highlighted

## Re: Transformation matrix

Eleur don't use Ry because use 2 . Rz with another angle parameter

some people calling all order passage 'Euler angle'  even for Cardan, RTL (roll,pitch,yaw)

another solution!  use quaternion 😅 but i don't know this 😉

it's good for me with Werner's solution (your solution is more compact, but I understand Werner's writing better)

Highlighted

## Re: Transformation matrix

first of all a big thank you for your precious advice which helps me to learn Mathcad. It's not easy forme, but i try and i hold on. And excuse me for my approximate language.

Now i update my worksheet, but I'm breaking my head over how to write. I know that i want ... but i can't write it.

Please see the attached file, i can to explain it .

Highlighted

## Re: Transformation matrix

i try it

But it's wrong, because the i parameter for Bi point is not the same for traj

is it possible to introduce another parameter in for loop ?

Highlighted

## Re: Transformation matrix

I think I am getting closer, but I cannot write the calculation for each iteration of the transformation matrix

Highlighted

## Re: Transformation matrix

Ok, I'm getting closer, but I can't seem to display all the sub matrices. Only the last result appears

Highlighted

## Re: Transformation matrix

I don't find my mistake😥😓

I can't display all the sub matrices for j parameter

Highlighted

## Re: Transformation matrix

You have to nest the loops. The i-loop has to do its work inside of the j-loop, because you want its calculaton done for every element in traj and not just for the last one.

Furthermore its not necessary to keep all matrices "Result" (called them "Res" now) , so I overwrite "Res" in every run of the outer j-loop.

Highlighted

## Re: Transformation matrix

wooww😲

great , i try to understand that !🤗

Highlighted

## Re: Transformation matrix

sorry I do not yet understand what you are doing

Highlighted

## Re: Transformation matrix

obviously is necessary to kill the last line in all submatrix in Bi_dep because this  comes from homogeneous transformation

Highlighted

## Re: Transformation matrix

I try it , but the value are wrong

if i control the result for the yellow line with the green parameter

the correct values are in blue

Highlighted

## Re: Transformation matrix

I did a new check, my program is wrong, it's clear

if i calculate manualy, the green value are right, if i calculate with my program, the value are wrong

Highlighted

## Re: Transformation matrix

huge typo 😖I put 1 in place of i

now i can continue to check my value

Highlighted

## Re: Transformation matrix

and finally (until the next time😅)

now i have my final matrix, where "course V1" and next are the stroke cylinder, and L1 and next are the 3D lenght betwen 2 points in 3D

now i want to extract the extremum

for example :

i search the max and min length for all length between 2 points

i search the max and min stroke for all cylinder

and when i find it, i want the extract position where i find it.

and is it possible to display the angle value Rx Ry Rx in degree ?

and for the fun, it is possible to make a draw

on the Y-axis the cylinder lenght

on the X- axis the number of 3D point

i have 6 cylinder, so i have 1 curve for each cylinder

Highlighted

## Re: Transformation matrix

> and is it possible to display the angle value Rx Ry Rx in degree ?

You can multiply the values by 180/pi

Highlighted

## Re: Transformation matrix

And finally :

Great!

Special thanks for Werner , he showed me the way.

👍

Announcements