PDA

View Full Version : Clicking on SoImage


rfreitas2
09-22-2010, 08:08 AM
Hi all,

Is the SoImage part of the bounding box of the scene graph? On my current project, I have a SoImage placed close to other objects. When the zoom is near, I can click on the SoImage just fine. However, when I zoom out (all the objects almost vanish and the SoImage remains with fixed size, as expected) I click on the SoImage, but the click generates no response. Does anyone have any idea on this?

Thanks in advance!
Regards

Ricardo

mikeheck
09-23-2010, 06:22 AM
Is the SoImage part of the bounding box of the scene graph? On my current project, I have a SoImage placed close to other objects. When the zoom is near, I can click on the SoImage just fine. However, when I zoom out (all the objects almost vanish and the SoImage remains with fixed size, as expected) I click on the SoImage, but the click generates no response. Does anyone have any idea on this?

I tried a simple test scene with an SoImage. I confirm that SoImage is included in the bounding box of the scene. In fact this works somewhat like SoText2. We find the extent of the image on the screen then map those screen coordinates back into 3D space. I also confirm that SoImage is pickable (for my test at least) even when the camera is moved far away from the geometry part of the scene.

I don't have anything as solid as a theory at this point, but it's conceivable that you're running into a floating point precision problem. This is more likely if the coordinates in your scene have large magnitudes but a (relatively) small range. For example a scene with coordinates ranging from 1.0e6 to 1.1e6. What is the extent of your scene in a normal view (i.e. what does SoGetBoundingBoxAction return) and what is the extent in the extreme view where picking doesn't work?

rfreitas2
09-23-2010, 01:57 PM
Hi,
Thanks for the help :)

I didnt use the SoBoundingBoxAction, but on a normal scene the my area goes from x=-1109, y=-8588, z=-2 to x=-4877, y=-285, z=-2 (the plane I used to measure this was a z plane). When I move very far away, these two locations/points become one (so, you can have a notion of how far that is). I did some more testing, and when I display some more objects with very different locations, and rotate the scene as to one of these objects to rest under/close to a SoImage, then, the SoImage clicking responds. So, I really think your theory is right.
Is there any possible workaround for this?

Regards,
Ricardo

mikeheck
09-24-2010, 12:23 AM
I don't think there is a "silver bullet" for this problem.
It's not really clear why you would want to move the camera so far away that the scene geometry is not visible... Maybe if you could explain the effect you're trying to produce, someone could suggest an alternate approach.