Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
SoCameraInteractor Class Reference

VSG extension Utility class to manipulate a camera. More...

#include <Inventor/ViewerComponents/SoCameraInteractor.h>

+ Inheritance diagram for SoCameraInteractor:

Public Member Functions

 SoCameraInteractor (SoCamera *camera)
 Create a SoCameraInteractor for the specified camera.
 
virtual void zoom (float zoom)
 Zoom - Makes the scene appear larger or smaller.
 
virtual void dolly (float scaleFactor)
 Dolly - Makes the scene appear larger or smaller.
 
virtual void changeViewVolume (float height, float aspect)
 Change camera's view volume.
 
SoCameragetCamera () const
 Returns the associated camera.
 
SbVec3f getFocalPoint () const
 Returns the camera's "focal point", located focalDistance units from the camera position along the view direction vector (defined by the camera's orientation field).
 
void setPosition (const SbVec3f &pos)
 Move camera to the specified position.
 
void setPosition (const SbVec2f &pos, float distFromEye, const SbViewportRegion &vpRegion)
 Move camera to the specified position.
 
void translate (const SbVec3f &trans)
 Move camera by the specified 3D displacement.
 
void translate (const SbVec2f &displacement, const SbViewportRegion &vpRegion)
 Move camera by the specified 2D displacement.
 
void pointAt (const SbVec3f &targetPoint)
 Sets the orientation of the camera so that it points toward the given target point while keeping the "up" direction of the camera parallel to the positive world coordinate y-axis.
 
SbRotation lookAt (const SbVec3f &position, const SbVec3f &target, const SbVec3f &up)
 Returns the rotation needed to point a camera at position toward the given target point while keeping the "up" direction of the camera parallel to the specified up vector.
 
SbVec3f getDirectionVector () const
 Returns the direction vector of the camera.
 
void roll (float angle)
 Roll the camera.
 
void pivot (float angle)
 Pivot the camera.
 
void tilt (float angle)
 Tilt the camera.
 
void rotate (const SbRotation &rot)
 Rotate the camera.
 
void setOrientation (const SbRotation &rot)
 Set the orientation of the camera.
 
void setRotationCenter (const SbVec3f &pos)
 Set the center of rotation.
 
void setRotationAxis (const SbVec3f &axis)
 Set the axis of rotation.
 
void rotate (float angle)
 Rotate the camera around the center specified by setRotationCenter() and the axis specified by setRotationAxis().
 
void viewAxis (const SbVec3f &direction, const SbVec3f &up)
 Moves and rotates the camera to be aligned with the given direction vector while keeping the up direction of the camera parallel to the specified up vector.
 
void viewX (bool reverse=false)
 NOTE: The camera position is not changed, so the camera may not be looking toward the scene.
 
void viewY (bool reverse=false)
 Rotate camera to look parallel to the Y axis with +Z up.
 
void viewZ (bool reverse=false)
 Rotate camera to look parallel to the Z axis with +Y up.
 
void viewIn (const SbBox3f &bbox)
 Move camera to the center of the specified box.
 
void viewIn (SoPath *path, const SbViewportRegion &vpRegion)
 Move camera to the center of the scene defined by the specified path.
 
void viewIn (SoNode *node, const SbViewportRegion &vpRegion)
 Move camera to the center of the scene defined by the specified node.
 
void viewAll (SoPath *path, const SbViewportRegion &vpRegion)
 Move the camera to view the scene defined by the given path.
 
void viewAll (SoNode *node, const SbViewportRegion &vpRegion)
 Move the camera to view the scene defined by the given node.
 
SbVec3f projectToPlane (const SbVec2f &point, float distFromEye, const SbViewportRegion &vpRegion) const
 Project specified 2D point on the plane parallel to the near plane that is at distFromEye units from the eye, see also SbViewVolume::getPlanePoint.
 
SbVec2f projectToScreen (const SbVec3f &point, const SbViewportRegion &vpRegion) const
 Map a 3D point in world coordinates to a 2D point in normalized screen coordinates (0 <= x,y <= 1), see also SbViewVolume::projectToScreen.
 
void adjustClippingPlanes (SoNode *sceneRoot, const SbViewportRegion &vpRegion)
 Adjust near and far clipping planes to minimize clipping of objects in the scene.
 
void zoomInWindow (const SbVec2f &topLeftCorner, const SbVec2f &bottomRightCorner, const SbViewportRegion &vpRegion)
 Zooms to the region defined by the given corners in normalized screen coordinates.
 
void dollyInWindow (const SbVec2f &topLeftCorner, const SbVec2f &bottomRightCorner, const SbViewportRegion &vpRegion)
 Moves the camera forward or backward along the view vector to view the region defined by the given corners in normalized screen coordinates.
 
void dollyWithZoomCenter (const SbVec2f &centerPos, float scaleFactor, const SbViewportRegion &vpRegion)
 Modifies the camera to ajust the view around the specified point.
 
void activatePanning (const SbVec2f &initPos, const SbViewportRegion &vpRegion)
 Set the starting point for interactive panning.
 
void pan (const SbVec2f &newPos, const SbViewportRegion &vpRegion)
 Pan the camera based on offset from starting point.
 
void activateOrbiting (const SbVec2f &startPos)
 Set the starting point for interactive orbiting.
 
void orbit (const SbRotation &rotation)
 Orbit the camera by the specified rotation.
 
void orbit (const SbVec2f &newPos)
 Orbit the camera based on offset from the previous screen position.
 
void pushCamera ()
 Save current camera.
 
SbBool popCamera ()
 Restore saved camera.
 
void synchronize (SoCamera *camera)
 Copy field values from the specified camera to the camera of this interactor.
 
Deprecated
SoDEPRECATED SbVec3f getViewportCenter () const
 Returns the viewport center.
 
- Public Member Functions inherited from SoRefCounter
void ref () const
 Adds a reference to an instance.
 
void unref () const
 Removes a reference from an instance.
 
void unrefNoDelete () const
 unrefNoDelete() should be called when it is desired to decrement the reference count, but not delete the instance if this brings the reference count to zero.
 
int getRefCount () const
 Returns current reference count.
 
void lock () const
 lock this instance.
 
void unlock () const
 unlock this instance.
 

Static Public Member Functions

static SoCameraInteractorgetNewInstance (SoCamera *camera)
 Create an instance for the specified camera.
 

Detailed Description

VSG extension Utility class to manipulate a camera.

This class provides some useful algorithms to manipulate a camera (translation, rotation, zoom, etc).

This class is not, strictly speaking, a true interactor. It does not respond to input events. However it provides the camera manipulation algorithms you need to build an interactor that provides behavior similar to the Open Inventor viewer classes, for example SoWinExaminerViewer. An interactor could handle system-dependent events or Open Inventor events (using SoEventCallback). It could also be triggered from the user interface (buttons, sliders, etc).

Start by creating an instance of SoCameraInteractor by giving the camera to be manipulated either to the constructor of SoCameraInteractor or to the getNewInstance() method. Then, for example, to provide examinerViewer-like rotation behavior:

To provide the viewer's automatic adjustment of near and far clip planes behavior, call the adjustClippingPlanes() method before each render traversal.

To see an example "viewer" implemented using this class, please see the SceneExaminer class provided as source code in the Open Inventor SDK:

.../source/Inventor/ViewerComponents/nodes

[C++] Reference counting:

This is a reference counted object, similar to a node or path. It can only be destroyed by incrementing and decrementing the reference count. The initial reference count is 0. You may use the ref() and unref() methods, but we recommend using the SoRef "smart pointer" template. An SoCameraInteractor instance increments and decrements the camera's reference count when created and destroyed.

EXAMPLE

SEE ALSO

SceneInteractor, SceneExaminer

Definition at line 121 of file SoCameraInteractor.h.

Constructor & Destructor Documentation

◆ SoCameraInteractor()

SoCameraInteractor::SoCameraInteractor ( SoCamera camera)

Create a SoCameraInteractor for the specified camera.

The camera should be an SoPerspectiveCamera or SoOrthographicCamera object. Create an empty object if camera pointer is NULL or invalid

Member Function Documentation

◆ activateOrbiting()

void SoCameraInteractor::activateOrbiting ( const SbVec2f startPos)

Set the starting point for interactive orbiting.

This method should be called when starting an interaction. Typically this is triggered by a mouse button or touch event. On subsequent mouse move or touch events, call the orbit() method with the new cursor or touch position.

Orbit is often used in an "examiner" type of viewer to allow the user to rotate the camera around a point of interest in the scene. To implement orbit around the camera's "focal point", call setRotationCenter() with the value returned from getFocalPoint().

Parameters
startPosstarting position, 2D point in normalized screen coordinates (0 <= x,y <= 1). Typically this value is obtained from the SoEvent method getNormalizedPosition().

◆ activatePanning()

void SoCameraInteractor::activatePanning ( const SbVec2f initPos,
const SbViewportRegion vpRegion 
)

Set the starting point for interactive panning.

This method should be called when starting an interaction. Typically this is triggered by a mouse button or touch event. On subsequent mouse move or touch events, call the pan() method with the new cursor or touch position.

Parameters
initPosinitial position in normalized screen coordinates (0 <= x,y <= 1). Typically this value is obtained from the SoEvent method getNormalizedPosition().
vpRegionthe actual viewport region

◆ adjustClippingPlanes()

void SoCameraInteractor::adjustClippingPlanes ( SoNode sceneRoot,
const SbViewportRegion vpRegion 
)

Adjust near and far clipping planes to minimize clipping of objects in the scene.

Equivalent to the auto clip planes feature in the viewer classes. Typically called before each render traversal.

◆ changeViewVolume()

virtual void SoCameraInteractor::changeViewVolume ( float  height,
float  aspect 
)
virtual

Change camera's view volume.

Allows changing the view volume height and width with a single call. For a perspective camera, the height parameter is heightAngle in radians. For an orthographic camera, the height parameter is height in world coordinates.

Parameters
heightnew camera height or heightAngle
aspectnew camera aspect ratio

◆ dolly()

virtual void SoCameraInteractor::dolly ( float  scaleFactor)
virtual

Dolly - Makes the scene appear larger or smaller.

For a perspective camera, moves the camera forward or backward along the view vector (details below). For an orthographic camera, changes the height field to give a similar visual effect (moving an orthographic camera forward and backward has no visual effect). This is the preferred way to implement the visual effect of "zooming" in and out for a perspective camera. For a perspective camera, dolly means the same thing it means for a camera on a movie set.

Note: 'scaleFactor' is the inverse of what you might expect. To make the scene appear 2X larger, specify a scaleFactor of 0.5. This is because scaleFactor multiplies the camera 'focalDistance' or 'height'.

  • Perspective camera: The camera has a "focal point" located focalDistance units from the camera position along the view direction vector ( orientation). Unlike a real camera, neither focal point nor focal distance has effect on the appearance of the image. The focal point is just a reference point for some algorithms. You can think of it as the "look at" point. The dolly() method computes a scale factor from the 'delta' parameter. A new "focal distance" is computed as the current value of the camera's focalDistance field multiplied by this scale factor. Then the camera's position field is modified so the camera is the new focal distance away from the focal point.
  • Orthographic camera: The dolly() method computes a scale factor from the 'delta' parameter and multiplies the camera's height field by this scale factor.

◆ dollyInWindow()

void SoCameraInteractor::dollyInWindow ( const SbVec2f topLeftCorner,
const SbVec2f bottomRightCorner,
const SbViewportRegion vpRegion 
)

Moves the camera forward or backward along the view vector to view the region defined by the given corners in normalized screen coordinates.

  • Perspective camera: The visual result is similar to zoomInWindow(), but this method changes the camera position (closer or farther away) and focalDisance fields instead of changing the heightAngle. This is the recommended method when using a perspective camera, because it avoids the limitations of very small or very large heightAngle values.
  • Orthographic camera: This method does nothing because moving the camera closer or farther away does not change the visual result.

◆ dollyWithZoomCenter()

void SoCameraInteractor::dollyWithZoomCenter ( const SbVec2f centerPos,
float  scaleFactor,
const SbViewportRegion vpRegion 
)

Modifies the camera to ajust the view around the specified point.

The algorithm is the same as the dolly() method (for a perspective camera the position field is changed, for an orthographic camera the height field is changed) and the delta parameter is used the same way.

Parameters
centerPoszoom center in normalized screen coordinates (0 <= x,y <= 1). Typically this value is obtained from the SoEvent method getNormalizedPosition().
scaleFactorzoom scale
vpRegionthe actual viewport region

◆ getCamera()

SoCamera * SoCameraInteractor::getCamera ( ) const

Returns the associated camera.

◆ getDirectionVector()

SbVec3f SoCameraInteractor::getDirectionVector ( ) const

Returns the direction vector of the camera.

◆ getFocalPoint()

SbVec3f SoCameraInteractor::getFocalPoint ( ) const

Returns the camera's "focal point", located focalDistance units from the camera position along the view direction vector (defined by the camera's orientation field).

This is the reference point for some algorithms. For example, orbit() is often used in an "examiner" type of viewer to allow the user to rotate the camera around a point of interest in the scene. To implement orbit around the camera's focal point, call the setRotationCenter() method with the focal point before calling the orbit() method.

Returns
focal point in world coordinates

◆ getNewInstance()

static SoCameraInteractor * SoCameraInteractor::getNewInstance ( SoCamera camera)
static

Create an instance for the specified camera.

The camera should be an SoPerspectiveCamera or SoOrthographicCamera object. Returns null if the camera parameter is null.

◆ getViewportCenter()

SoDEPRECATED SbVec3f SoCameraInteractor::getViewportCenter ( ) const

Returns the viewport center.

On other words, returns the camera's "focal point", located focalDistance units from the camera position along the view direction vector ( orientation).

Returns
center in world coordinates

◆ lookAt()

SbRotation SoCameraInteractor::lookAt ( const SbVec3f position,
const SbVec3f target,
const SbVec3f up 
)

Returns the rotation needed to point a camera at position toward the given target point while keeping the "up" direction of the camera parallel to the specified up vector.

This method does NOT modify the camera node. Set the returned rotation in the camera's orientation field.

Parameters
positionof the camera
targetposition of the target
upup vector of the camera

◆ orbit() [1/2]

void SoCameraInteractor::orbit ( const SbRotation rotation)

Orbit the camera by the specified rotation.

"Orbit" means to rotate the camera around a fixed point in 3D space. The rotation point is specified using the setRotationCenter() method. This method automatically calls the setRotationAxis() method with the axis defined by the SbRotation parameter.

Orbit is often used in an "examiner" type of viewer to allow the user to rotate the camera around a point of interest in the scene. Orbit based on mouse or touch events can be implemented using the orbit() method. This method can be used, for example, to animate the camera to a new viewpoint. To implement orbit around the camera's "focal point", call setRotationCenter() with the value returned from getFocalPoint().

Parameters
rotationIncremental rotation, i.e. this rotation is multiplied with the current camera orientation.

◆ orbit() [2/2]

void SoCameraInteractor::orbit ( const SbVec2f newPos)

Orbit the camera based on offset from the previous screen position.

This method can be used to implement an interactive orbit operation in response to mouse move or touch events. The activateOrbiting() method should be called at the start of the operation. This method uses an SbSphereSheetProjector to compute a rotation value based on the specified point and the previously specified point.

Parameters
newPosnew position, 2D point in normalized screen coordinates (0 <= x,y <= 1). Typically this value is obtained from the SoEvent method getNormalizedPosition().

◆ pan()

void SoCameraInteractor::pan ( const SbVec2f newPos,
const SbViewportRegion vpRegion 
)

Pan the camera based on offset from starting point.

This method can be used to implement an interactive panning operation in response to move move or touch events. The activatePanning() method should be called at the start of the operation.

Parameters
newPosnew position in normalized screen coordinates (0 <= x,y <= 1). Typically this value is obtained from the SoEvent method getNormalizedPosition().
vpRegionthe actual viewport region

◆ pivot()

void SoCameraInteractor::pivot ( float  angle)

Pivot the camera.

Incremental in-place rotation left/right (around the camera's up vector, i.e. local Y axis). Rotations are cumulative. Camera position does not change. Positive values pivot the camera left.

Parameters
angleangle in radians

◆ pointAt()

void SoCameraInteractor::pointAt ( const SbVec3f targetPoint)

Sets the orientation of the camera so that it points toward the given target point while keeping the "up" direction of the camera parallel to the positive world coordinate y-axis.

If this is not possible, it uses the positive z-axis as "up". Equivalent to calling the SoCamera method pointAt().

Parameters
targetPointtarget point

◆ popCamera()

SbBool SoCameraInteractor::popCamera ( )

Restore saved camera.

The values of the camera fields are restored to the last pushed values. Returns true if successful, false if the vector of pushed cameras is empty.

◆ projectToPlane()

SbVec3f SoCameraInteractor::projectToPlane ( const SbVec2f point,
float  distFromEye,
const SbViewportRegion vpRegion 
) const

Project specified 2D point on the plane parallel to the near plane that is at distFromEye units from the eye, see also SbViewVolume::getPlanePoint.

Parameters
pointpoint to project in normalized screen coordinates (0 <= x,y <= 1)
distFromEyethe distance at which the point would be back projected
vpRegionthe actual viewport region
Returns
projected point in world coordinates

◆ projectToScreen()

SbVec2f SoCameraInteractor::projectToScreen ( const SbVec3f point,
const SbViewportRegion vpRegion 
) const

Map a 3D point in world coordinates to a 2D point in normalized screen coordinates (0 <= x,y <= 1), see also SbViewVolume::projectToScreen.

Parameters
pointpoint to project in world coordinates
vpRegionthe actual viewport region
Returns
2D point in normalized screen coordinates (0 <= x,y <= 1)

◆ pushCamera()

void SoCameraInteractor::pushCamera ( )

Save current camera.

The values of the camera fields are saved and can be restored by calling popCamera().

◆ roll()

void SoCameraInteractor::roll ( float  angle)

Roll the camera.

Incremental in-place rotation around the view direction vector (camera's local Z axis). Rotations are cumulative. Camera position does not change. Positive values roll the camera counter-clockwise.

Parameters
angleangle in radians

◆ rotate() [1/2]

void SoCameraInteractor::rotate ( const SbRotation rot)

Rotate the camera.

Incremental in-place rotation. Rotations are cumulative. Camera position does not change (rotationCenter and rotationAxis do not apply).

Parameters
rotnew rotation

◆ rotate() [2/2]

void SoCameraInteractor::rotate ( float  angle)

Rotate the camera around the center specified by setRotationCenter() and the axis specified by setRotationAxis().

The default rotation axis is (0,0,0), so calling this method will not have any visible effect until a rotation axis is set. The rotation axis is automatically set by some methods, e.g. orbit().

Parameters
angleangle in radians

◆ setOrientation()

void SoCameraInteractor::setOrientation ( const SbRotation rot)

Set the orientation of the camera.

Replaces any previous rotations applied to the camera. Camera position does not change.

Parameters
rotnew orientation

◆ setPosition() [1/2]

void SoCameraInteractor::setPosition ( const SbVec2f pos,
float  distFromEye,
const SbViewportRegion vpRegion 
)

Move camera to the specified position.

Parameters
posnew position (2D point in normalized screen coordinates: 0 <= x,y <= 1)
distFromEyethe distance at which the point would be back projected.
vpRegionthe actual viewport region

◆ setPosition() [2/2]

void SoCameraInteractor::setPosition ( const SbVec3f pos)

Move camera to the specified position.

Parameters
posnew position in world coordinates

◆ setRotationAxis()

void SoCameraInteractor::setRotationAxis ( const SbVec3f axis)

Set the axis of rotation.

Default is (0, 0, 0). This vector is used by the rotate(float) method.

Parameters
axisnew rotations axis

◆ setRotationCenter()

void SoCameraInteractor::setRotationCenter ( const SbVec3f pos)

Set the center of rotation.

Default is (0, 0, 0). This position is used by the rotate(float) and orbit() methods.

Parameters
posposition in world coordinates

◆ synchronize()

void SoCameraInteractor::synchronize ( SoCamera camera)

Copy field values from the specified camera to the camera of this interactor.

If the two cameras are not the same type, common fields are copied and the height or heightAngle field is computed.

◆ tilt()

void SoCameraInteractor::tilt ( float  angle)

Tilt the camera.

Incremental in-place rotation up/down (around the camera's local X axis). Rotations are cumulative. Camera position does not change. Positive values tilt the camera up.

Parameters
angleangle in radians

◆ translate() [1/2]

void SoCameraInteractor::translate ( const SbVec2f displacement,
const SbViewportRegion vpRegion 
)

Move camera by the specified 2D displacement.

Parameters
displacement2D displacement in normalized screen coordinates: 0 <= x,y <= 1
vpRegionthe actual viewport region

◆ translate() [2/2]

void SoCameraInteractor::translate ( const SbVec3f trans)

Move camera by the specified 3D displacement.

Parameters
transtranslation value in world coordinates

◆ viewAll() [1/2]

void SoCameraInteractor::viewAll ( SoNode node,
const SbViewportRegion vpRegion 
)

Move the camera to view the scene defined by the given node.

Equivalent to calling the SoCamera method viewAll(). The camera position is changed, but not the orientation.

  • Orthographic camera: the height field is changed.
  • Perspective camera: the heightAngle field is NOT changed.

◆ viewAll() [2/2]

void SoCameraInteractor::viewAll ( SoPath path,
const SbViewportRegion vpRegion 
)

Move the camera to view the scene defined by the given path.

Equivalent to calling the SoCamera method viewAll(). The camera position is changed, but not the orientation.

  • Orthographic camera: the height field is changed.
  • Perspective camera: the heightAngle field is NOT changed.

◆ viewAxis()

void SoCameraInteractor::viewAxis ( const SbVec3f direction,
const SbVec3f up 
)

Moves and rotates the camera to be aligned with the given direction vector while keeping the up direction of the camera parallel to the specified up vector.

The camera position and orientation are changed to look at the point of interest, but the focalDistance is not changed.

Parameters
directionThe new view direction vector: this is the vector from the camera's position to the target point. Any future call to the method getDirectionVector() will return the same vector.
upThe new up direction vector

◆ viewIn() [1/3]

void SoCameraInteractor::viewIn ( const SbBox3f bbox)

Move camera to the center of the specified box.

The near and far clipping planes will be adjusted to see the inside of the box. If the box is empty, nothing happens.

◆ viewIn() [2/3]

void SoCameraInteractor::viewIn ( SoNode node,
const SbViewportRegion vpRegion 
)

Move camera to the center of the scene defined by the specified node.

Compute the bounding box of the scene and move the camera to the center of this box. The near and far clipping planes will be adjusted to see the inside of the box.

Parameters
noderoot node of the scene
vpRegionthe actual viewport region

◆ viewIn() [3/3]

void SoCameraInteractor::viewIn ( SoPath path,
const SbViewportRegion vpRegion 
)

Move camera to the center of the scene defined by the specified path.

Compute the bounding box of the scene and move the camera to the center of this box. The near and far clipping planes will be adjusted to see the inside of the box.

Parameters
pathpath to the scene
vpRegionthe actual viewport region

◆ viewX()

void SoCameraInteractor::viewX ( bool  reverse = false)

NOTE: The camera position is not changed, so the camera may not be looking toward the scene.

Calling viewAll() will move the camera so that the scene is visible again.

Parameters
reverseIf false, rotate to look in the -X direction, else in +X direction.

◆ viewY()

void SoCameraInteractor::viewY ( bool  reverse = false)

Rotate camera to look parallel to the Y axis with +Z up.

NOTE: The camera position is not changed, so the camera may not be looking toward the scene. Calling viewAll() will move the camera so that the scene is visible again.

Parameters
reverseIf false, rotate to look in the -Y direction, else in +Y direction.

◆ viewZ()

void SoCameraInteractor::viewZ ( bool  reverse = false)

Rotate camera to look parallel to the Z axis with +Y up.

NOTE: The camera position is not changed, so the camera may not be looking toward the scene. Calling viewAll() will move the camera so that the scene is visible again.

Parameters
reverseIf false, rotate to look in the -Z direction, else in +Z direction.

◆ zoom()

virtual void SoCameraInteractor::zoom ( float  zoom)
virtual

Zoom - Makes the scene appear larger or smaller.

Sets the camera's heightAngle field (for a perspective camera) or height field (for an orthographic camera) to the specified value. For a perspective camera, the value is in radians and the default is 0.785398. For an orthographic camera the value is in World Coordinates and the default is 2.

Conceptually, zoom means approximately the same thing as it does for a real camera - changing the "focal length" of the lens. Making the heightAngle (or height) larger corresponds to using a wide-angle lens, so the scene appears smaller. Making the heightAngle (or height) smaller corresponds to using a telephoto lens, so the scene appears larger.

NOTE: For a perspective camera, we strongly recommend implementing the visual effect of "zoom" by moving the camera closer to, or farther away from, the scene (see dolly()). Very small and very large values of heightAngle can produce undesirable results.

Parameters
zoomnew zoom value

◆ zoomInWindow()

void SoCameraInteractor::zoomInWindow ( const SbVec2f topLeftCorner,
const SbVec2f bottomRightCorner,
const SbViewportRegion vpRegion 
)

Zooms to the region defined by the given corners in normalized screen coordinates.

  • Perspective camera: This method modifies the heightAngle field.
    Modifying the heightAngle field changes the projection, similar to changing the focal length of a camera. Making the heightAngle very small or very large may cause rendering artifacts. Therefore the dollyInWindow method is recommended when using a perspective camera.
  • Orthographic camera: This method modifies the height field.
Parameters
topLeftCornertop left corner in normalized screen coordinates (0 <= x,y <= 1)
bottomRightCornerbottom right corner in normalized screen coordinates (0 <= x,y <= 1)
vpRegionthe actual viewport region

The documentation for this class was generated from the following file: