Provided by: libcoin80-doc_3.1.4~abc9f50-4ubuntu2_all

**NAME**

SbViewVolume - TheSbViewVolumeclass is a viewing volume in 3D space. This class contains the necessary information for storing a view volume. It has methods for projection of primitives into the 3D volume from 2D points in the projection plane or vice versa, doing camera transforms, view volume transforms, etc.

**SYNOPSIS**

PublicTypesenumProjectionType{ORTHOGRAPHIC= 0,PERSPECTIVE= 1 }PublicMemberFunctionsSbViewVolume(void)~SbViewVolume(void) voidgetMatrices(SbMatrix&affine,SbMatrix&proj) constSbMatrixgetMatrix(void) constSbMatrixgetCameraSpaceMatrix(void) const voidprojectPointToLine(constSbVec2f&pt,SbLine&line) const voidprojectPointToLine(constSbVec2f&pt,SbVec3f&line0,SbVec3f&line1) const voidprojectToScreen(constSbVec3f&src,SbVec3f&dst) constSbPlanegetPlane(const float distFromEye) constSbVec3fgetSightPoint(const float distFromEye) constSbVec3fgetPlanePoint(const float distFromEye, constSbVec2f&normPoint) constSbRotationgetAlignRotation(SbBool rightAngleOnly=FALSE) const floatgetWorldToScreenScale(constSbVec3f&worldCenter, float normRadius) constSbVec2fprojectBox(constSbBox3f&box) constSbViewVolumenarrow(float left, float bottom, float right, float top) constSbViewVolumenarrow(constSbBox3f&box) const voidortho(float left, float right, float bottom, float top, float nearval, float farval) voidperspective(float fovy, float aspect, float nearval, float farval) voidfrustum(float left, float right, float bottom, float top, float nearval, float farval) voidrotateCamera(constSbRotation&q) voidtranslateCamera(constSbVec3f&v)SbVec3fzVector(void) constSbViewVolumezNarrow(float nearval, float farval) const voidscale(float factor) voidscaleWidth(float ratio) voidscaleHeight(float ratio)ProjectionTypegetProjectionType(void) const constSbVec3f&getProjectionPoint(void) const constSbVec3f&getProjectionDirection(void) const floatgetNearDist(void) const floatgetWidth(void) const floatgetHeight(void) const floatgetDepth(void) const voidgetViewVolumePlanes(SbPlaneplanes[6]) const voidtransform(constSbMatrix&matrix)SbVec3fgetViewUp(void) const SbBoolintersect(constSbVec3f&p) const SbBoolintersect(constSbVec3f&p0, constSbVec3f&p1,SbVec3f&closestpoint) const SbBoolintersect(constSbBox3f&box) constSbBox3fintersectionBox(constSbBox3f&box) const SbBooloutsideTest(constSbPlane&p, constSbVec3f&bmin, constSbVec3f&bmax) const constSbDPViewVolume&getDPViewVolume(void) constPublicAttributesProjectionTypetypeSbVec3fprojPointSbVec3fprojDirfloatnearDistfloatnearToFarSbVec3fllfSbVec3flrfSbVec3fulf

**Detailed** **Description**

TheSbViewVolumeclass is a viewing volume in 3D space. This class contains the necessary information for storing a view volume. It has methods for projection of primitives into the 3D volume from 2D points in the projection plane or vice versa, doing camera transforms, view volume transforms, etc.SeeAlso:SbViewportRegion

**Member** **Enumeration** **Documentation**

enumSbViewVolume::ProjectionTypeAnSbViewVolumeinstance can represent either an orthogonal projection volume or a perspective projection volume.SeeAlso:ortho(),perspective(),getProjectionType().EnumeratorORTHOGRAPHICOrthographic projection.PERSPECTIVEPerspective projection.

**Constructor** **&** **Destructor** **Documentation**

SbViewVolume::SbViewVolume(void)Constructor. Note that theSbViewVolumeinstance will be uninitialized until you explicitly callortho()orperspective().SeeAlso:ortho(),perspective().SbViewVolume::~SbViewVolume(void)Destructor.

**Member** **Function** **Documentation**

voidSbViewVolume::getMatrices(SbMatrix&affine,SbMatrix&proj)constReturns the view volume's affine matrix and projection matrix.SeeAlso:getMatrix(),getCameraSpaceMatrix()SbMatrixSbViewVolume::getMatrix(void)constReturns the combined affine and projection matrix.SeeAlso:getMatrices(),getCameraSpaceMatrix()SbMatrixSbViewVolume::getCameraSpaceMatrix(void)constReturns a matrix which will translate the view volume camera back to origo, and rotate the camera so it'll point along the negative z axis. Note that the matrix willnotinclude the rotation necessary to make the camera up vector point along the positive y axis (i.e. camera roll is not accounted for).SeeAlso:getMatrices(),getMatrix()voidSbViewVolume::projectPointToLine(constSbVec2f&pt,SbLine&line)constProject the given 2D point from the projection plane into a 3D line.ptcoordinates should be normalized to be within [0, 1].voidSbViewVolume::projectPointToLine(constSbVec2f&pt,SbVec3f&line0,SbVec3f&line1)constProject the given 2D point from the projection plane into two points defining a 3D line. The first point,line0, will be the corresponding point for the projection on the near plane, whileline1will be the line endpoint, lying in the far plane.voidSbViewVolume::projectToScreen(constSbVec3f&src,SbVec3f&dst)constProject thesrcpoint to a normalized set of screen coordinates in the projection plane and place the result indst. It is safe to letsrcand be the sameSbVec3finstance. The z-coordinate ofdstis monotonically increasing for points closer to the far plane. Note however that this is not a linear relationship, thedstz-coordinate is calculated as follows: Orthogonal view: DSTz = (-2 * SRCz - far - near) / (far - near), Perspective view: DSTz = (-SRCz * (far - near) - 2*far*near) / (far - near) The returned coordinates (dst) are normalized to be in range [0, 1].SbPlaneSbViewVolume::getPlane(constfloatdistFromEye)constReturns anSbPlaneinstance which has a normal vector in the opposite direction of which the camera is pointing. This means the plane will be parallel to the near and far clipping planes.SeeAlso:getSightPoint()SbVec3fSbViewVolume::getSightPoint(constfloatdistFromEye)constReturns the point on the center line-of-sight from the camera position with the given distance.SeeAlso:getPlane()SbVec3fSbViewVolume::getPlanePoint(constfloatdistFromEye,constSbVec2f&normPoint)constReturn the 3D point which projects tonormPointand lies on the plane perpendicular to the camera direction anddistFromEyedistance away from the camera position.normPointshould be given in normalized coordinates, where the visible render canvas is covered by the range [0.0, 1.0].SbRotationSbViewVolume::getAlignRotation(SbBoolrightangleonly=FALSE)constReturns a rotation that aligns an object so that its positive x-axis is to the right and its positive y-axis is up in the view volume. If rightangleonly is TRUE, it will create a rotation that aligns the x and y-axis with the closest orthogonal axes to right and up.floatSbViewVolume::getWorldToScreenScale(constSbVec3f&worldCenter,floatnormRadius)constGiven a sphere with center inworldCenterand an initial radius of 1.0, return the scale factor needed to make this sphere have anormRadiusradius when projected onto the near clipping plane.SbVec2fSbViewVolume::projectBox(constSbBox3f&box)constProjects the given box onto the projection plane and returns the normalized screen space it occupies.SbViewVolumeSbViewVolume::narrow(floatleft,floatbottom,floatright,floattop)constReturns a narrowed version of the view volume which is within the given [0, 1] normalized coordinates. The coordinates are taken to be corner points of a normalized 'view window' on the near clipping plane. I.e.: SbViewVolume view; view.ortho(0, 100, 0, 100, 0.1, 1000); view = view.narrow(0.25, 0.5, 0.75, 1.0); ..will give a view volume with corner points <25, 75> and <50, 100>.SeeAlso:scale(),scaleWidth(),scaleHeight()SbViewVolumeSbViewVolume::narrow(constSbBox3f&box)constReturns a narrowed version of the view volume which is within the given [0, 1] normalized coordinates. The box x and y coordinates are taken to be corner points of a normalized 'view window' on the near clipping plane. The box z coordinates are used to adjust the near and far clipping planes, and should be relative to the current clipping planes. A value of 1.0 is at the current near plane. A value of 0.0 is at the current far plane.voidSbViewVolume::ortho(floatleft,floatright,floatbottom,floattop,floatnearval,floatfarval)Set up the view volume as a rectangular box for orthographic parallel projections. The line of sight will be along the negative z axis, through the center of the plane defined by the point [(right+left)/2, (top+bottom)/2, 0]SeeAlso:perspective().voidSbViewVolume::perspective(floatfovy,floataspect,floatnearval,floatfarval)Set up the view volume for perspective projections. The line of sight will be through origo along the negative z axis.SeeAlso:ortho().voidSbViewVolume::frustum(floatleft,floatright,floatbottom,floattop,floatnearval,floatfarval)Set up the frustum for perspective projection. This is an alternative toperspective()that lets you specify any kind of view volumes (e.g. off center volumes). It has the same arguments and functionality as the corresponding OpenGL glFrustum() function. This function is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API.Since:Coin 2.0SeeAlso:perspective()voidSbViewVolume::rotateCamera(constSbRotation&q)Rotate the direction which the camera is pointing in.SeeAlso:translateCamera().voidSbViewVolume::translateCamera(constSbVec3f&v)Translate the camera position of the view volume.SeeAlso:rotateCamera().SbVec3fSbViewVolume::zVector(void)constReturn the vector pointing from the center of the view volume towards the camera. This is just the vector pointing in the opposite direction ofgetProjectionDirection().SeeAlso:getProjectionDirection().SbViewVolumeSbViewVolume::zNarrow(floatnearval,floatfarval)constReturn a copySbViewVolumewith narrowed depth by supplying parameters for new near and far clipping planes.nearvaland should be relative to the current clipping planes. A value of 1.0 is at the current near plane. A value of 0.0 is at the current far plane.SeeAlso:zVector().voidSbViewVolume::scale(floatfactor)Scale width and height of viewing frustum by the given ratio around the projection plane center axis.SeeAlso:scaleWidth(),scaleHeight().voidSbViewVolume::scaleWidth(floatratio)Scale width of viewing frustum by the given ratio around the vertical center axis in the projection plane.SeeAlso:scale(),scaleHeight().voidSbViewVolume::scaleHeight(floatratio)Scale height of viewing frustum by the given ratio around the horizontal center axis in the projection plane.SeeAlso:scale(),scaleWidth().SbViewVolume::ProjectionTypeSbViewVolume::getProjectionType(void)constReturn current view volume projection type, which can be eitherORTHOGRAPHICorPERSPECTIVE.SeeAlso:SbViewVolume::ProjectionTypeconstSbVec3f&SbViewVolume::getProjectionPoint(void)constReturns the projection point, i.e. the camera position.constSbVec3f&SbViewVolume::getProjectionDirection(void)constReturns the direction of projection, i.e. the direction the camera is pointing.SeeAlso:getNearDist().floatSbViewVolume::getNearDist(void)constReturns distance from projection plane to near clipping plane.SeeAlso:getProjectionDirection().floatSbViewVolume::getWidth(void)constReturns width of viewing frustum in the projection plane.SeeAlso:getHeight(),getDepth().floatSbViewVolume::getHeight(void)constReturns height of viewing frustum in the projection plane.SeeAlso:getWidth(),getDepth().floatSbViewVolume::getDepth(void)constReturns depth of viewing frustum, i.e. the distance from the near clipping plane to the far clipping plane.SeeAlso:getWidth(),getHeight().voidSbViewVolume::print(FILE*fp)constDump the state of this object to thefilestream. Only works in debug version of library, method does nothing in an optimized compile.voidSbViewVolume::getViewVolumePlanes(SbPlaneplanes[6])constReturns the six planes defining the view volume in the following order: left, bottom, right, top, near, far. Plane normals are directed into the view volume. This method is an extension for Coin, and is not available in the original Open Inventor.voidSbViewVolume::transform(constSbMatrix&matrix)Transform the viewing volume bymatrix.SbVec3fSbViewVolume::getViewUp(void)constReturns the view up vector for this view volume. It's a vector which is perpendicular to the projection direction, and parallel and oriented in the same direction as the vector from the lower left corner to the upper left corner of the near plane.SbBoolSbViewVolume::intersect(constSbVec3f&p)constReturns TRUE ifpis inside the view volume.Since:Coin 2.3SbBoolSbViewVolume::intersect(constSbVec3f&p0,constSbVec3f&p1,SbVec3f&closestpoint)constReturns TRUE if the line segmentp0,p1may intersect volume. Be aware that it's not 100% certain that the line segment intersects the volume even if this function returns TRUE.closestpointis set to the closest point on the line to the center ray of the view volume.Since:Coin 2.3SbBoolSbViewVolume::intersect(constSbBox3f&box)constReturns TRUE ifboxmay be inside the view volume.Since:Coin 2.3SbBox3fSbViewVolume::intersectionBox(constSbBox3f&box)constCalculates the bbox of the intersection betweenbboxand the view volume.Since:Coin 4.0SbBoolSbViewVolume::outsideTest(constSbPlane&p,constSbVec3f&bmin,constSbVec3f&bmax)constReturns TRUE if all eight corner points inbmin,bmaxis outsidep.constSbDPViewVolume&SbViewVolume::getDPViewVolume(void)constReturns the double precision version of this view volume.

**Member** **Data** **Documentation**

SbViewVolume::ProjectionTypeSbViewVolume::typeThisAPImemberisconsideredinternaltothelibrary,asitisnotlikelytobeofinteresttotheapplicationprogrammer.SbVec3fSbViewVolume::projPointThisAPImemberisconsideredinternaltothelibrary,asitisnotlikelytobeofinteresttotheapplicationprogrammer.SbVec3fSbViewVolume::projDirThisAPImemberisconsideredinternaltothelibrary,asitisnotlikelytobeofinteresttotheapplicationprogrammer.floatSbViewVolume::nearDistThisAPImemberisconsideredinternaltothelibrary,asitisnotlikelytobeofinteresttotheapplicationprogrammer.floatSbViewVolume::nearToFarThisAPImemberisconsideredinternaltothelibrary,asitisnotlikelytobeofinteresttotheapplicationprogrammer.SbVec3fSbViewVolume::llfThisAPImemberisconsideredinternaltothelibrary,asitisnotlikelytobeofinteresttotheapplicationprogrammer.SbVec3fSbViewVolume::lrfThisAPImemberisconsideredinternaltothelibrary,asitisnotlikelytobeofinteresttotheapplicationprogrammer.SbVec3fSbViewVolume::ulfThisAPImemberisconsideredinternaltothelibrary,asitisnotlikelytobeofinteresttotheapplicationprogrammer.

**Author**

Generated automatically by Doxygen for Coin from the source code.