Local coordinates for 3D beamline layout

Moderators: cyao, michael_borland

Post Reply
petrenko
Posts: 43
Joined: 09 Jun 2008, 02:53
Contact:

Local coordinates for 3D beamline layout

Post by petrenko » 28 Sep 2011, 16:37

Dear Michael,

Please, could you explain the meaning of "theta", "phi" and "psi" angles in the floor_coordinates output?
How can I obtain the local coordinate system using these angles?

I'm trying to understand the coordinate transformation when the "TILT" parameter is used in BEND. It seems like in some cases the floor_coordinates command gives a wrong answer for the angles of local coordinate system (if I understand the meaning of these angles correctly) -- please see the attached pictures for example: red arrows here show the x-direction and blue arrows show y-direction. As you can see in the second picture the coordinate system after the second blue SBEND has wrong direction and then it goes back to normal.

The coordinate system transformation used in this script is the following: 1) rotate by +psi around Z-axis 2) rotate by -phi around X-axis 3) rotate by +theta around Y axis.
The lattice is in the 3Dlayout.tar.gz archive.

/Alexey
Attachments
no_bug.png
red arrow is x-axis, blue arrow is y-axis
angles_bug.png
red arrow is x-axis, blue arrow is y-axis
3Dlayout.tar.gz
tcl-script to show 3d beamlines in x3d-format. For x3d files use freewrl viewer.
(57.94 KiB) Downloaded 4191 times

michael_borland
Posts: 1927
Joined: 19 May 2008, 09:33
Location: Argonne National Laboratory
Contact:

Re: Local coordinates for 3D beamline layout

Post by michael_borland » 30 Sep 2011, 17:41

Alexey,

I think you're right, that there is a bug in the computation of psi in some cases. I'm looking into it.

--Michael

michael_borland
Posts: 1927
Joined: 19 May 2008, 09:33
Location: Argonne National Laboratory
Contact:

Re: Local coordinates for 3D beamline layout

Post by michael_borland » 30 Sep 2011, 21:36

Alexey,

I think I fixed the bug. Please see attached. This code is all based on MAD8. For some reason that I don't remember, I deviated from their code in one respect, and that caused the bug.

Your script is great! Would you mind if we put it on our software download page? We'll credit you, of course.

--Michael
Attachments
floor.c
(20.11 KiB) Downloaded 3970 times

petrenko
Posts: 43
Joined: 09 Jun 2008, 02:53
Contact:

Re: Local coordinates for 3D beamline layout

Post by petrenko » 01 Oct 2011, 13:47

Michael,
Thanks for the quick fix of this bug,
I'm glad you liked my script!

Sure, you're welcome to you put it to the download page.

Here's a little better version of this script with one important improvement --- it can show element names if necessary.

/Alexey
Attachments
3Dlayout.tar.gz
(11.97 KiB) Downloaded 4231 times
extraction.png

Marcello
Posts: 19
Joined: 28 Jan 2015, 10:05

Re: Local coordinates for 3D beamline layout

Post by Marcello » 27 Mar 2020, 05:34

Dear Michael and Alexey,
I would be really interested in the 3D Layout script you posted years ago.
Unfortunately I can't download it from here nor find a link somewhere else, is it still possible to use it in order to display the beam-lines?
Or maybe there are other solutions?

Thanks in advance,
Marcello Rossetti Conti

petrenko
Posts: 43
Joined: 09 Jun 2008, 02:53
Contact:

Re: Local coordinates for 3D beamline layout

Post by petrenko » 29 Mar 2020, 04:36

Dear Marcello,

The script is included into the Elegant distribution as view3dGeometry program. This program can be also executed as a regular tcl-script once you comment the oagtclsh-specific parts on top of the script.

Please see the attached example.

In order to display beamline in 2d you can also use more recent python-based approach: http://www.inp.nsk.su/~petrenko/c-tau/I ... Views.html
http://www.inp.nsk.su/~petrenko/c-tau/I ... ping_ring/

Best regards,
/Alexey
Attachments
view3dGeometry.zip
(268.47 KiB) Downloaded 167 times

Marcello
Posts: 19
Joined: 28 Jan 2015, 10:05

Re: Local coordinates for 3D beamline layout

Post by Marcello » 30 Mar 2020, 04:25

Dear Alexey,
thank you very much for this useful example, I managed to run it on my windows machine.
It will be really helpful.

Edit: the python approach seems really interesting, thanks! I'll try to implement something similar.

My best wishes,
Marcello Rossetti Conti

Post Reply