Message Boards Message Boards

0
|
1973 Views
|
4 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Align / orient a 2D inset within a 3D graphic?

Anonymous User
Anonymous User
Posted 6 years ago

This is what I have gotten to work:

drawSphereRadius = 1/8;
Graphics3D[
 {
  Inset[Plot[x^2, {x, -1, +1}]],
  Sphere[{0, 0, 0}, drawSphereRadius],
  Sphere[{1, 0, 0}, drawSphereRadius],
  Sphere[{0, 1, 0}, drawSphereRadius]
  }
 ]

But it results in the 2D plot facing the viewer dead on. That isn't where I want the 2D plot; I want:

  • the origin of the parabola coincident with the sphere at the 3D origin;
  • the parabola to lie within the plane containing the three spheres;
  • the line splitting the parabola should contain the spheres at 0,0,0 and 0,1,0.

I have no idea how to translate by verbal description into the correct parameters for Inset[]. I have looked at the Inset-function manual page and the inset tutorial, but still unable to do this. Thank you.

POSTED BY: Anonymous User
4 Replies
Anonymous User
Anonymous User
Posted 6 years ago

Thanks again.

POSTED BY: Anonymous User

Yes, you guessed right about the Inset parameters. The remaining two spheres go into place with ViewPoint -> Above. You can still make more fine-tuning of the size parameter of Inset, which is almost but not exactly right already.

POSTED BY: Gianluca Gorni
Anonymous User
Anonymous User
Posted 6 years ago

Thank you. Your second solution returns what I had envisioned, oriented as I had hoped for, while your first solution intrigues me because it exercises the 2nd and 3rd parameters in the function Inset[], and those parameters are confusing me even after I've read the docs. Can you please briefly explain to me how you selected {0, 0, 0}, {0, 0} as your values for those parameters? I'll speculate the {0,0,0} refers to the origin of the 3D system, and {0,0} refers to the origin of the 2D system, which is also the parabola's vertex? And while you specified that those two origins should be coincident, the 2D and 3D axes happened to align in the way I had hoped, even though you specified nothing explicitly about alignment?

POSTED BY: Anonymous User

This may be a way:

drawSphereRadius = 1/8;
Graphics3D[{Inset[Plot[x^2, {x, -1, +1}], {0, 0, 0}, {0, 0}], 
  Sphere[{0, 0, 0}, drawSphereRadius], 
  Sphere[{1, 0, 0}, drawSphereRadius], 
  Sphere[{0, 1, 0}, drawSphereRadius]}, ViewPoint -> Above]

Otherwise

Show[ParametricPlot3D[{x, x^2, 0}, {x, -1, 1}], 
 Graphics3D[{Sphere[{0, 0, 0}, drawSphereRadius], 
   Sphere[{1, 0, 0}, drawSphereRadius], 
   Sphere[{0, 1, 0}, drawSphereRadius]}], PlotRange -> All]
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract