Group Abstract Group Abstract

Message Boards Message Boards

0
|
4.1K Views
|
6 Replies
|
1 Total Like
View groups...
Share
Share this post:

How to use predefined orthographic views in 3D graphics?

Posted 9 years ago

Hello everyone,

I want to ask for your help in how to create an orthographic projection of my 3D graphic (multiple elements in a Show command) in which I can define by vectors which axes are the x-, y-, and z-axes in the resulting plot. What I have been doing until now and what kind of works is the following:

  • set ViewPoint to a vector that defines which axis should be the z-axis, multiply it by 1000 resulting in a (nearly) orthographic view
  • set ViewVertical to to a vector that defines which axis should be the y-axis in the resulting view

The ViewPoint part seems to always work (start and end point of the vector are superimposed and the view is orthographic and not perspective) but the vector used in ViewVertical is not always (perfectly) vertical. Strangely enough, the vertical orientation changes when other graphical elements are added to Show although the settings in ViewVertical are the same. I guess I am missing something here in the functionality of ViewVertical or how it interacts with ViewPoint or other options.

Any help is appreciated. Thanks a lot, Simon

POSTED BY: Simon N
6 Replies

Perhaps the below diagram, this answer, and this free video course Graphics & Visualization: Advanced 3D Graphics --- all three by @Yu-Sung Chang --- will help you. Welcome to Wolfram Community, Simon. Please take a moment to update your profile.

enter image description here

POSTED BY: Vitaliy Kaurov
Posted 9 years ago

Thanks very much Vitaliy, that's actually the video that I watched before and that was helpful for me until the problem I am now facing...

POSTED BY: Simon N

The maker of the video is on this forum, and Vitaliy tagged him for you, he will (most likely) get a notification, and perhaps he has a solution...

POSTED BY: Sander Huisman

Please add a minimalised example (least amount of code that shows the effect) to better assess your problem. Without it, it is gonna be hard to imagine what you're doing...

POSTED BY: Sander Huisman
Posted 9 years ago

Hi Sander, here is an example. The red vector (between points 3 and 8) should be vertical in the final image, the blue vector (between points 4 and 6) should be in the third dimension (z-axis) in the final image. In the example below, it works as I would expect it and as I would like to use it. However, if the radius of the sphere is only 20 instead of 60 for example, then the red vector is not vertical although the settings for ViewVertical have not been changed.

Thanks for explanations or alternatives, Simon

points = {{-0.5408092441220346, -59.47032164154871, \
-33.486141445561195}, {-1.6729947915403758, 58.47000109642251, 
    0.06821941845651969}, {-1.1279232851470478, -12.607718410070715, \
-22.72024680422565}, {22.74021699848095, -33.56458992369394, \
-25.982135247035842}, {44.64374208727797, 
    23.145194959114605, -12.259291498233077}, {-24.141978569616093, \
-34.727887579554576, -23.475147941868702}, {-47.23579711917719, 
    20.865368869801543, -7.3461078129550135}, {3.6207761893354027, \
-38.53425644748551, 54.052848989519305}, {1.6032260558335967, 
    38.239393358088, 51.948102361681556}};

Show[
 ListPointPlot3D[points, 
  PlotStyle -> Directive[PointSize -> Large, Black]],
 Graphics3D[{Blue, Thick, Arrowheads -> 0.05, 
   Arrow[{points[[4]], points[[6]]}]}],
 Graphics3D[{Red, Thick, Arrowheads -> 0.05, 
   Arrow[{points[[3]], points[[8]]}]}],
 Graphics3D[{Opacity[.1], Sphere[{0, 0, 0}, 60]}],
 Axes -> True, AxesOrigin -> {0, 0, 0}, Boxed -> False, 
 BoxRatios -> Automatic, PlotRange -> All,
 ViewPoint -> 1000*Normalize[points[[4]] - points[[6]]],
 ViewVertical -> Normalize[points[[3]] - points[[8]]]
 ]
POSTED BY: Simon N

Hi Simon,

I have had similar problems, but when I switched to a ViewVector notation it always seemed to work for me, unfortunately that route doesn't work here as well:

   points2=points={{-0.5408092441220346,-59.47032164154871,-33.486141445561195},{-1.6729947915403758,58.47000109642251,0.06821941845651969},{-1.1279232851470478,-12.607718410070715,-22.72024680422565},{22.74021699848095,-33.56458992369394,-25.982135247035842},{44.64374208727797,23.145194959114605,-12.259291498233077},{-24.141978569616093,-34.727887579554576,-23.475147941868702},{-47.23579711917719,20.865368869801543,-7.3461078129550135},{3.6207761893354027,-38.53425644748551,54.052848989519305},{1.6032260558335967,38.239393358088,51.948102361681556}};
   points=points[[{3,4,6,8}]];
   Graphics3D[{PointSize[Large],
   Point[points],
   Blue,Thick,
   Arrow@Tube[{points[[2]],points[[3]]}],
   Red,Thick,
   Arrow@Tube[{points[[1]],points[[4]]}],
   Opacity[.1],
   Sphere[{0,0,0},20]},
   Axes->True,
   AxesOrigin->{0,0,0},
   Boxed->False,
   BoxRatios->Automatic,
   PlotRange->All,
   ViewVector->{10000*Normalize[points[[2]]-points[[3]]],{0,0,0}},
   ViewVertical->(points[[1]]-points[[4]])
   ]
   Graphics3D[{PointSize[Large],
   Point[points2],
   Blue,Thick,
   Arrow@Tube[{points[[2]],points[[3]]}],
   Red,Thick,
   Arrow@Tube[{points[[1]],points[[4]]}],
   Opacity[.1],
   Sphere[{0,0,0},20]},
   Axes->True,
   AxesOrigin->{0,0,0},
   Boxed->False,
   BoxRatios->Automatic,
   PlotRange->All,
   ViewVector->{10000*Normalize[points[[2]]-points[[3]]],{0,0,0}},
   ViewVertical->(points[[1]]-points[[4]])
   ]

That is your code even further minimalised, and it somehow also depends on showing the other points (in some strange way)! I'm not calling this bug just yet, but it might just be one...

POSTED BY: Sander Huisman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard