Problem 1158 - Incorrect viewpoint presentation with theta=90 deg
Summary: Incorrect viewpoint presentation with theta=90 deg
Status: RESOLVED INVALID
Alias: None
Product: Geant4
Classification: Unclassified
Component: visualization (show other problems)
Version: 9.4
Hardware: Apple Mac OS X
: P4 minor
Assignee: perl
URL:
Depends on:
Blocks:
 
Reported: 2011-01-12 06:23 CET by Michael Kelsey
Modified: 2011-01-22 18:37 CET (History)
1 user (show)

See Also:


Attachments
/vis/viewer/set/viewpointThetaPhi 89 -90 (17.63 KB, application/x-word)
2011-01-12 06:24 CET, Michael Kelsey
Details
/vis/viewer/set/viewpointThetaPhi 89.99995 -90 (17.71 KB, application/x-word)
2011-01-12 06:25 CET, Michael Kelsey
Details
/vis/viewer/set/viewpointThetaPhi 90 -90 (34.36 KB, application/x-word)
2011-01-12 06:26 CET, Michael Kelsey
Details
/vis/viewer/set/viewpointThetaPhi 90.00005 -90 (17.40 KB, application/x-word)
2011-01-12 06:26 CET, Michael Kelsey
Details

Note You need to log in before you can comment on or make changes to this problem.
Description Michael Kelsey 2011-01-12 06:23:39 CET
I am using the visualization code to draw a side (cutaway) view of my detector design.  I have discovered (and reproduced) that viewpointThetaPhi cannot properly handle the case of a direct horizontal view (theta=90*deg).  

Below I've attached four pixmap drawings of the same detector, all showing effectively the "same" picture.  The only difference is value of theta specified for the viewpoint.  As you can see, at just under 90 degrees, the image is as you'd expect (Z is pointing upward), but at exactly 90, the code goes all pear-shaped, and just past 90 degrees, the image is incorrectly rotated upside down.

I have not tried to isolate exactly where the problem lies, as I am entirely unfamiliar with the visualizaton code.  But it's pretty clear that there's something weird with the polar angle handling.

-- Michael Kelsey
Comment 1 Michael Kelsey 2011-01-12 06:24:47 CET
Created attachment 95 [details]
/vis/viewer/set/viewpointThetaPhi 89 -90
Comment 2 Michael Kelsey 2011-01-12 06:25:40 CET
Created attachment 96 [details]
/vis/viewer/set/viewpointThetaPhi 89.99995 -90
Comment 3 Michael Kelsey 2011-01-12 06:26:06 CET
Created attachment 97 [details]
/vis/viewer/set/viewpointThetaPhi 90 -90
Comment 4 Michael Kelsey 2011-01-12 06:26:38 CET
Created attachment 98 [details]
/vis/viewer/set/viewpointThetaPhi 90.00005 -90
Comment 5 garnier 2011-01-21 10:17:18 CET
We know this bug and we will try to get rid of it as soon as possible.
You could by pass this problem with Qt driver using the 'google earth’ like rotation

More information about it could be found here : http://geant4.in2p3.fr/spip.php?article60&lang=en
And movie of this feature : http://geant4.in2p3.fr/IMG/mov_Qt_Movie_Rotation_GoogleLike.mov

Laurent
Comment 6 Michael Kelsey 2011-01-22 18:37:20 CET
In the GEANT4 Visualization Hypernews, John Allison explained (http://hypernews.slac.stanford.edu/HyperNews/geant4/get/visualization/602/1/1.html):
-----------
A view is defined by the viewpoint and up-vector. If they are/become parallel, the view is indeterminate around that axis. OpenGL seems to flip around under those circumstances. You do, however, get a warning:

WARNING: Viewpoint direction is very close to the up vector direction.
  Consider setting the up vector to obtain definable behaviour.

By default, the up-vector is the y-axis, so you get the problem near

  /vis/viewer/set/viewpointThetaPhi 90 90

If you want to view the geometry from a viewpoint on the y-axis, you should change the up-vector, e.g:

  /vis/viewer/set/upVector 0 0 1

to get the z-axis vertical, then all should be well defined at theta,phi = 90,90. 
-----------

Accordingly, I am closing my own bug report as RESOLVED/INVALID, with thanks to both Laurent and John for their responses, explanations, and suggestions.