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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Transformation matrix

XDN
14-Alexandrite
14-Alexandrite

Transformation matrix

Hello

i make a worksheet for calculate transformation matrix:

Capture d’écran 2020-09-23 145817.png

 

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
Werner_E
25-Diamond I
(To:XDN)

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:

Werner_E_0-1600869351750.png

 

P6 worksheet attached

 

XDN
14-Alexandrite
14-Alexandrite
(To:Werner_E)

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 !😃

 

Werner_E
25-Diamond I
(To:XDN)


@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 😉

LucMeekes
23-Emerald III
(To:XDN)

Like this?

LucMeekes_0-1600869604703.png

Success!
Luc

LucMeekes
23-Emerald III
(To:XDN)

Incidentally...

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

 

Luc

XDN
14-Alexandrite
14-Alexandrite
(To:LucMeekes)

it is complicated because there is no real standard about this.

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)

Capture d’écran 2020-09-23 171203.png

 

XDN
14-Alexandrite
14-Alexandrite
(To:XDN)

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 .

Capture1.png

 

Capture2.png

 

Capture3.png

 

Capture4.png

 

XDN
14-Alexandrite
14-Alexandrite
(To:XDN)

i try it

Capture5.png

 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 ?

XDN
14-Alexandrite
14-Alexandrite
(To:XDN)

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

Capture6.png

 

XDN
14-Alexandrite
14-Alexandrite
(To:XDN)

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

Capture7.png

XDN
14-Alexandrite
14-Alexandrite
(To:XDN)

I don't find my mistake😥😓

Capture8.png

 

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

Werner_E
25-Diamond I
(To:XDN)

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.

Werner_E_0-1600953712775.png

 

 

XDN
14-Alexandrite
14-Alexandrite
(To:Werner_E)

wooww😲

great , i try to understand that !🤗

XDN
14-Alexandrite
14-Alexandrite
(To:XDN)

sorry I do not yet understand what you are doing

please see attached file

XDN
14-Alexandrite
14-Alexandrite
(To:XDN)

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

Capture9.png

 

XDN
14-Alexandrite
14-Alexandrite
(To:XDN)

I try it , but the value are wrong

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

Capture10.png

Capture11.png

the correct values are in blue

Capture12.png

XDN
14-Alexandrite
14-Alexandrite
(To:XDN)

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

Capture13.png

 

XDN
14-Alexandrite
14-Alexandrite
(To:XDN)

Capture14.png

 

huge typo 😖I put 1 in place of i

now i can continue to check my value

XDN
14-Alexandrite
14-Alexandrite
(To:XDN)

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.

Capture15.png

 

 

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

Werner_E
25-Diamond I
(To:XDN)

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

 

You can multiply the values by 180/pi

XDN
14-Alexandrite
14-Alexandrite
(To:Werner_E)

And finally :

Capture16.png

 

Great!

 

Special thanks for Werner , he showed me the way.

👍

Announcements

Top Tags