SoCamera and SoViewVolume confusion

SoCamera and SoViewVolume confusion

Post by sanje » Thu, 29 May 2003 18:35:40

Hi All,
This is regarding the camera and view volume of coin 2.0.2. I want to
create a custom view volume which is a subset of camera view volume,
and want to display objects with different colors which are inside the
new created volume.

For this I first fetch the current volume of the camera.

SbViewVolume viewVolume=camera->getViewVolume(aspectRatio);// already
has //aspectRatio this viewVolume is the frustum of the camera.

To create the custom view volume from the camera view volume, I have
used the SbViewVolume::frustum(...) method.

SbViewVolume customViewVolume=viewVolume;
customViewVolume.frustum(...);// I have all aruments for passing to
this function

Now to check whether a object(rather point for simplcity) lies inside
the frustum, we can use SbPlane.isInHalfSpace(...) method w.r.t. all
the planes of the customViewVolume.
But before checking this, we have to calculate our point w.r.t. camera
My question is :
Does the new frustum(customViewVolume) has same origin and orientation
as the camera?
I mean, Can i use the camera position and orientation to find out the
point w.r.t. new frustum?
if not How can I find the position and orientation of the new

Best Regards


1. SoCamera Question.....


I have an engine which generate a set of three vectors:
- the first one will be used a the camera position
- the second one is the direction of viewing
- the third (vector) is the orientation of the camera (the up direction).

Using this, a camera is completely defined (exluding realistics
considerations: perspective, clipping ...).

But an ordinary SoCamera has only two fields acceptable for these data:
- the position field (no problem with this one !)
- a SoSFRotation field, which hold the transformation that transforms the
(0,0,-1) vector into the real updir (probably assuming that the direction
of viewing is already in the current transformation matrix).

The SoSFRotation is a rotation which is defined by an axis and an angle.
This rotation can be deducted any given two vectors: the original one, and
its rotated counterpart (doing a cross product of these and measuring the
angle via a dot product will do the job). This rotation is not our client !
We need a rotation defined by two vectors and their transformed "images".

The trick can be done using a SoCameraKit, and its SoTransform field (connected
with a SoComposeRotationFromTo), which is quite complicated and sometimes
lead to unsmothes camera movement.

My question is (finally !) is there anyone around here who developed its
own camera, with a position, direction and up_direction fields ?

Any idea, suggestions, will gracefully be welcomed.

Stephane Morvan

2. shadowlight

3. How to rotate SoCamera

4. Banner, Button, Logo, and Website Design - Cheap, Quick and Professional

5. Editing the fields of a SoCamera-node

6. HOW TO: Map coords on distorted image

7. Setting SoCamera orientation

8. HG3Win: Two questions

9. SoCamera Part II

10. Changing SoCamera Views

11. SoCamera/SoViewingMatrixElement

12. SoCamera::viewAll()

13. SoCamera