Is it possible to visualize in spherical coordinate system? #12415
-
**From Mahesh Natarajan: "Ultimately, when a plot is rendered in the visualization window, its coordinates must be specified in terms of Cartesian coordinates due to the implementation of graphics hardware." You could use the clip and slice operators to make plots like the one attached, but visualizing in spherical coordinates, I am not sure. Others might have some suggestions.** We're trying to combine |
Beta Was this translation helpful? Give feedback.
Replies: 10 comments
-
Again, Thanks Mahesh for the helpful response! |
Beta Was this translation helpful? Give feedback.
-
Hi Silvia, If the coordinates in your data are r, theta, phi then you can transform them to look like a sphere using x = r * sin(theta) * cos(phi) You can do this with a combination of expressions and the Displace operator. First define: r = coord(mesh)[0] in the "Expression" window, making sure to specify the "sphere_displacement" "Type" as "Vector mesh variable" You can then create you plot, add the Displace operator (Operators->Transforms->Displace), displacing by "sphere_displacement". I'm using the "sphere_displacement" to set the coordinates to the x, y, and z coordinates I defined in the expressions. Since the Displace operator adds a vector to each coordinate, rather than setting it to a vector, I'm subtracting the {r, theta, phi} in the displacement, to set the coordinates to all zero and adding in the new {x, y, z}. I did a similar set of expressions using the "rect3d.silo" sample data file and transformed a cube going from 0 -> 1 in each direction to the following image. |
Beta Was this translation helpful? Give feedback.
-
@brugger1 this is awesome! We need to put this in the manual somehow. |
Beta Was this translation helpful? Give feedback.
-
I agree @markcmiller86 ...I added a ticket for adding the documentation. I will do it if time permits after I add documentation for building with masonry. |
Beta Was this translation helpful? Give feedback.
-
@brugger1 any chance you have a session file from this lying around you can attach? |
Beta Was this translation helpful? Give feedback.
-
Hi Eric,
Thank you very much. Your explanation is extremely clear and useful.
In my case, the coordinates in my data are x, y, z. But I assume I can go inversely? So I would use
r = sqrt(x*x+y*y+z*z)
theta = arctan(sqrt(x*x+y*y)/z)
phi = acrtan (y/x)
and my sphere displacement would be
sphere_displacement = {r -x, y - theta, z - phi}.
Thank you.
Kind regards,
Silvia
…________________________________
From: Eric Brugger via visit-users <[email protected]>
Sent: Thursday, 23 April 2020 3:09 AM
To: visit-dav/live-customer-response <[email protected]>
Cc: Eric Brugger <[email protected]>; Subscribed <[email protected]>
Subject: [visit-users] [EXTERNAL] Re: [visit-dav/live-customer-response] Is it possible to visualize in spherical coordinate system? (#41)
Hi Silvia,
If the coordinates in your data are r, theta, phi then you can transform them to look like a sphere using
x = r * sin(theta) * cos(phi)
y = r * sin(theta) * sin(phi)
z = r * cos(theta)
You can do this with a combination of expressions and the Displace operator.
First define:
r = coord(mesh)[0]
theta = coord(mesh)[1]
phi = coord(mesh)[2]
x = r * sin(theta) * cos(phi)
y = r * sin(theta) * sin(phi)
z = r * cos(theta)
sphere_displacement = {x - r, y - theta, z - phi}
in the "Expression" window, making sure to specify the "sphere_displacement" "Type" as "Vector mesh variable"
You can then create you plot, add the Displace operator (Operators->Transforms->Displace), displacing by "sphere_displacement". I'm using the "sphere_displacement" to set the coordinates to the x, y, and z coordinates I defined in the expressions. Since the Displace operator adds a vector to each coordinate, rather than setting it to a vector, I'm subtracting the {r, theta, phi} in the displacement, to set the coordinates to all zero and adding in the new {x, y, z}.
I did a similar set of expressions using the "rect3d.silo" sample data file and transformed a cube going from 0 -> 1 in each direction to the following image.
[live-customer-response-41]<https://user-images.githubusercontent.com/1102718/80011826-3ef34780-8481-11ea-9ca7-e59076434955.png>
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<https://github.com/visit-dav/live-customer-response/issues/41#issuecomment-617910200>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AOLAYZFFMP65M4ABB4BYUDLRN4QGLANCNFSM4MOJVL2A>.
|
Beta Was this translation helpful? Give feedback.
-
@brugger shouldn't the Transform operator with the attributes shown in the attachment do the same thing? |
Beta Was this translation helpful? Give feedback.
-
@griffin28 yes...and I believe it is possible though I think you may need to take care with offsets by including a second transform operator that performs a translation too. Note that I don't think you can perform both translation and coordinate transformation in a single Transform operator instance. You get one or the other. I was going to ask why @brugger1 used Expressions + Displace operator whereas last time I did something similar I wound up using expressions plus two Transform operators. I will go look again what I had to do. I should have saved/attached a session file somewhere here on GitHub 😮 |
Beta Was this translation helpful? Give feedback.
-
Thanks @markcmiller86 I applied Eric's prescription on the rect3d.silo dataset and also applied the Transform operator and got the attached results. The mesh was produced by the Transform operator and the pseudo color plot is using Eric's method. I didn't expect them to be that different. |
Beta Was this translation helpful? Give feedback.
-
They are different because my equations are for spherical to cartesian and the transform operator for the above image is set to cylindrical to cartesian. I believe the image is correct for that case. |
Beta Was this translation helpful? Give feedback.
Hi Silvia,
If the coordinates in your data are r, theta, phi then you can transform them to look like a sphere using
x = r * sin(theta) * cos(phi)
y = r * sin(theta) * sin(phi)
z = r * cos(theta)
You can do this with a combination of expressions and the Displace operator.
First define:
r = coord(mesh)[0]
theta = coord(mesh)[1]
phi = coord(mesh)[2]
x = r * sin(theta) * cos(phi)
y = r * sin(theta) * sin(phi)
z = r * cos(theta)
sphere_displacement = {x - r, y - theta, z - phi}
in the "Expression" window, making sure to specify the "sphere_displacement" "Type" as "Vector mesh variable"
You can then create you plot, add the Displace operator (Operators->Transforms->Displace), displacing by "sp…