25#ifndef _SB_VIEWVOLUME_
26#define _SB_VIEWVOLUME_
28#include <Inventor/SbBase.h>
29#include <Inventor/SbVec.h>
30#include <Inventor/SbBox.h>
31#include <Inventor/SbPlane.h>
32#include <Inventor/SbRotation.h>
33#include <Inventor/STL/vector>
42class DebugDataSbVolIntersect;
187 const SbVec2f &normPoint)
const;
203 float normRadius)
const;
229 float right,
float top)
const;
242 float bottom,
float top,
243 float nearPlane,
float farPlane);
251 float nearPlane,
float farPlane);
337 inline float getWidth()
const {
return (lrfO-llfO).length(); }
342 inline float getHeight()
const {
return (ulfO-llfO).length(); }
347 inline float getDepth()
const {
return nearToFar; }
486 void frustum(
float left,
float right,
float bottom,
487 float top,
float near_plane,
float far_plane );
489 void frustumWorldCoords(
const SbVec3f &projPt,
const SbVec3f &projDire,
490 float radius,
float near_plane,
float far_plane,
bool forceNearPlane =
false );
496 void transform(
const SbMatrix &matrix);
502 SbBool intersect(
const SbVec3f &point, HomTransfData *pHomTData )
const;
509 HomTransfData *pHomTData,
511 DebugDataSbVolIntersect *pdd = 0 )
const;
518 HomTransfData *pHomTData,
520 DebugDataSbVolIntersect *pdd = 0 )
const;
526 HomTransfData *pHomTData,
529 DebugDataSbVolIntersect *pdd = 0)
const;
535 return intersect(xbox);
548 void clipFrustum(
const SbXfBox3d& box, std::vector<SbVec3d>& points)
const;
555 void setCameraOffset(
float);
556 float getCameraOffset(
void)
const;
557 void unsetCameraOffset(
void);
558 int isCameraOffsetSet(
void)
const;
560 void setClipToFar(
SbBool clipToFar);
561 void setClipToNear(
SbBool clipToNear);
563 inline const SbBox3f& getFrustumBbox()
const;
566 SbBox3f getRestrictedBbox(
float visibilityLength)
const ;
568 SbVec3f getllf()
const {
return llf; }
570 SbBool checkRadialDistance(
const SbVec3f & pt,
float radius )
const;
580 HomTransfData *pHomTData,
583 DebugDataSbVolIntersect *pdd = 0)
const;
586 HomTransfData *pHomTData,
589 DebugDataSbVolIntersect *pdd = 0)
const;
593 SbBool stereoAbsoluteAdjustments;
594 float stereoAdjustment, balanceAdjustment;
598 float mPStereoCameraOffset;
599 int mPStereoOffsetSet;
601 SbBool m_bClipToNear, m_bClipToFar;
606SbViewVolume::setClipToFar(
SbBool clipToFar)
608 m_bClipToFar = clipToFar;
612SbViewVolume::setClipToNear(
SbBool clipToNear)
614 m_bClipToNear = clipToNear;
620 return stereoAbsoluteAdjustments;
626 stereoAdjustment = adjustment;
632 return stereoAdjustment;
638 balanceAdjustment = adjustment;
639 stereoNearFrac = (nearFrac!=FALSE);
645 return balanceAdjustment;
651 return stereoNearFrac;
657 stereoAbsoluteAdjustments = absolute;
661SbViewVolume::getFrustumBbox()
const
663 return m_frustumBbox;
Class for representing a rotation.
@ RIGHT_VIEW
Right eye view.
@ LEFT_VIEW
Left eye view.
@ MONOSCOPIC
Monoscopic (i.e., non-stereo) viewing.
const SbVec3f & getProjectionPoint() const
Returns projection point.
void projectPointToLine(const SbVec2f &pt, SbLine &line) const
Maps a 2D point (in 0 <= x,y <= 1) to a 3D line.
ProjectionType getProjectionType() const
Returns projection type.
SbBool equals(const SbViewVolume &v, float tolerance)
Equality comparison within given tolerance.
void setStereoMode(StereoMode mode)
Sets the stereo mode.
float getDepth() const
Returns depth of viewing frustum.
void ortho(float left, float right, float bottom, float top, float nearPlane, float farPlane)
Sets up an orthographic view volume with the given sides.
SbViewVolume()
Default constructor.
float getWorldToScreenScale(const SbVec3f &worldCenter, float normRadius) const
Returns a scale factor that would scale a unit sphere centered at worldCenter so that it would appe...
StereoMode getStereoMode() const
Queries the stereo mode.
void projectToScreen(const SbVec3f &src, SbVec3f &dst) const
Maps a 3D point in world coordinates to a 2D point in normalized screen coordinates (0 <= x,...
SbViewVolume narrow(const SbBox3f &box) const
Narrows a view volume by the given box.
void setStereoAdjustment(float adjustment)
Sets the stereo offset (the distance of each eye from the camera position).
float getBalanceAdjustment() const
Queries the parallax balance.
ProjectionType
Projection type.
@ ORTHOGRAPHIC
Orthographic projection.
@ PERSPECTIVE
Perspective projection.
void translateCamera(const SbVec3f &v)
Translate the camera viewpoint.
void rotateCamera(const SbRotation &q)
Rotate the camera view direction.
float getMatrices(SbMatrix &affine, SbMatrix &proj) const
Returns two matrices corresponding to the view volume.
void scale(float factor)
Scales width and height of view volume by given factor.
void setBalanceAdjustment(float adjustment, SbBool nearFrac=false)
Sets the stereo balance (the position of the zero parallax plane) and specifies whether the balance v...
SbViewVolume narrow(float left, float bottom, float right, float top) const
Given a view volume, narrows the view to the given sub-rectangle of the near plane.
void scaleHeight(float ratio)
Scales view volume to be the given ratio of its current height, leaving the resulting view volume cen...
float getHeight() const
Returns height of viewing frustum.
void perspective(float fovy, float aspect, float nearPlane, float farPlane)
Sets up a perspective view volume with the given field of view and aspect ratio.
void setStereoAbsoluteAdjustments(SbBool absolute)
Specifies if stereo adjustments are absolute.
SbVec3f getPlanePoint(float distFromEye, const SbVec2f &normPoint) const
Maps a 2D point in normalized screen coordinates (0 <= x,y <= 1) to a 3D world coordinates point on t...
void projectPointToLine(const SbVec2f &pt, SbVec3f &line0, SbVec3f &line1) const
Maps a 2D point (in 0 <= x,y <= 1) to a 3D line.
~SbViewVolume()
Destructor.
void scaleWidth(float ratio)
Scales view volume to be the given ratio of its current width, leaving the resulting view volume cent...
SbPlane getPlane(float distFromEye) const
Returns a plane parallel to the near (or far) plane of the view volume at a given distance from the p...
float getStereoAdjustment() const
Queries the stereo offset.
float getWidth() const
Returns width of viewing frustum.
SbRotation getAlignRotation(SbBool rightAngleOnly=FALSE) const
Returns a rotation that would align a viewed object so that its positive x-axis (of its object space)...
SbBox3f getProjectedBbox(const SbBox3f &box) const
Projects the given 3D bounding box onto the near plane and returns it (in normalized screen coordinat...
static SbBox3f getProjectedBbox(const SbMatrix &affineProj, const SbBox3f &box)
Same as getProjectedBbox but takes a matrix (containing affine and projection parts) to use instead o...
const SbVec3f & getProjectionDirection() const
Returns projection direction.
void projectFromScreen(const SbVec3f &src, SbVec3f &dst) const
Maps a 3D point in normalized screen coordinates (0 <= x,y,z <= 1) to a 3D world point.
SbMatrix getMatrix() const
Like the method above, but returns the affine and projection parts together in one matrix (i....
SbBool isStereoAbsoluteAdjustments() const
Returns TRUE if the stereo adjustments are absolute.
SbVec3f getSightPoint(float distFromEye) const
Returns the point along the line of sight at the given distance from the projection point (eye).
SbVec2f projectBox(const SbBox3f &box) const
Projects the given 3D bounding box onto the near plane and returns the size (in normalized screen coo...
SbMatrix getCameraSpaceMatrix() const
Returns a matrix that transforms the view volume into camera space: it translates the view volume so ...
SbViewVolume zNarrow(float nearPlane, float farPlane) const
Returns a narrowed view volume which contains as tightly as possible the given interval on the z axis...
SbVec3f zVector() const
Returns the positive z axis in eye space.
SbBool isBalanceNearFraction() const
Returns TRUE if the stereo balance adjustement is defined as a fraction of the camera near distance.
float getNearDist() const
Returns distance from projection point to near plane.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 3D box with an a...
3D box with an associated transformation matrix.