Provided by: libcoin60-doc_3.1.3-2_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**

#include <Inventor/SbLinear.h>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) 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::ProjectionTypeAnSbViewVolumeinstancecanrepresenteitheranorthogonalprojectionvolumeoraperspectiveprojectionvolume.Seealso:ortho(),perspective(),getProjectionType().Enumerator:ORTHOGRAPHICOrthographic projection.PERSPECTIVEPerspective projection.

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

SbViewVolume::SbViewVolume(void)Constructor.NotethattheSbViewVolumeinstancewillbeuninitializeduntilyouexplicitlycallortho()orperspective().Seealso:ortho(),perspective().SbViewVolume::~SbViewVolume(void)Destructor.

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

voidSbViewVolume::getMatrices(SbMatrix&affine,SbMatrix&proj)constReturnstheviewvolume'saffinematrixandprojectionmatrix.Seealso:getMatrix(),getCameraSpaceMatrix()SbMatrixSbViewVolume::getMatrix(void)constReturnsthecombinedaffineandprojectionmatrix.Seealso:getMatrices(),getCameraSpaceMatrix()SbMatrixSbViewVolume::getCameraSpaceMatrix(void)constReturnsamatrixwhichwilltranslatetheviewvolumecamerabacktoorigo,androtatethecamerasoit'llpointalongthenegativezaxis.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)constProjectthegiven2Dpointfromtheprojectionplaneintoa3Dline.ptcoordinates should be normalized to be within [0, 1].voidSbViewVolume::projectPointToLine(constSbVec2f&pt,SbVec3f&line0,SbVec3f&line1)constProjectthegiven2Dpointfromtheprojectionplaneintotwopointsdefininga3Dline.Thefirstpoint,line0,willbethecorrespondingpointfortheprojectiononthenearplane,whileline1willbethelineendpoint,lyinginthefarplane.voidSbViewVolume::projectToScreen(constSbVec3f&src,SbVec3f&dst)constProjectthesrcpointtoanormalizedsetofscreencoordinatesintheprojectionplaneandplacetheresultindst.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)constReturnsanSbPlaneinstancewhichhasanormalvectorintheoppositedirectionofwhichthecameraispointing.Thismeanstheplanewillbeparalleltothenearandfarclippingplanes.Seealso:getSightPoint()SbVec3fSbViewVolume::getSightPoint(constfloatdistFromEye)constReturnsthepointonthecenterline-of-sightfromthecamerapositionwiththegivendistance.Seealso:getPlane()SbVec3fSbViewVolume::getPlanePoint(constfloatdistFromEye,constSbVec2f&normPoint)constReturnthe3DpointwhichprojectstonormPointandliesontheplaneperpendiculartothecameradirectionanddistFromEyedistanceawayfromthecameraposition.normPointshould be given in normalized coordinates, where the visible render canvas is covered by the range [0.0, 1.0].SbRotationSbViewVolume::getAlignRotation(SbBoolrightangleonly=FALSE)constReturnsarotationthatalignsanobjectsothatitspositivex-axisistotherightanditspositivey-axisisupintheviewvolume.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)constGivenaspherewithcenterinworldCenterandaninitialradiusof1.0,returnthescalefactorneededtomakethisspherehaveanormRadiusradiuswhenprojectedontothenearclippingplane.SbVec2fSbViewVolume::projectBox(constSbBox3f&box)constProjectsthegivenboxontotheprojectionplaneandreturnsthenormalizedscreenspaceitoccupies.SbViewVolumeSbViewVolume::narrow(floatleft,floatbottom,floatright,floattop)constReturnsanarrowedversionoftheviewvolumewhichiswithinthegiven[0,1]normalizedcoordinates.Thecoordinatesaretakentobecornerpointsofanormalized'viewwindow'onthenearclippingplane.I.e.:SbViewVolume view; view.ortho(0, 100, 0, 100, 0.1, 1000); view = view.narrow(0.25, 0.5, 0.75, 1.0);Seealso:scale(),scaleWidth(),scaleHeight()SbViewVolumeSbViewVolume::narrow(constSbBox3f&box)constReturnsanarrowedversionoftheviewvolumewhichiswithinthegiven[0,1]normalizedcoordinates.Theboxxandycoordinatesaretakentobecornerpointsofanormalized'viewwindow'onthenearclippingplane.Theboxzcoordinatesareusedtoadjustthenearandfarclippingplanes,andshouldberelativetothecurrentclippingplanes.Avalueof1.0isatthecurrentnearplane.Avalueof0.0isatthecurrentfarplane.voidSbViewVolume::ortho(floatleft,floatright,floatbottom,floattop,floatnearval,floatfarval)Setuptheviewvolumeasarectangularboxfororthographicparallelprojections.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)Setuptheviewvolumeforperspectiveprojections.Thelineofsightwillbethroughorigoalongthenegativezaxis.Seealso:ortho().voidSbViewVolume::frustum(floatleft,floatright,floatbottom,floattop,floatnearval,floatfarval)Setupthefrustumforperspectiveprojection.Thisisanalternativetoperspective()thatletsyouspecifyanykindofviewvolumes(e.g.offcentervolumes).IthasthesameargumentsandfunctionalityasthecorrespondingOpenGLglFrustum()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)Rotatethedirectionwhichthecameraispointingin.Seealso:translateCamera().voidSbViewVolume::translateCamera(constSbVec3f&v)Translatethecamerapositionoftheviewvolume.Seealso:rotateCamera().SbVec3fSbViewVolume::zVector(void)constReturnthevectorpointingfromthecenteroftheviewvolumetowardsthecamera.ThisisjustthevectorpointingintheoppositedirectionofgetProjectionDirection().Seealso:getProjectionDirection().SbViewVolumeSbViewVolume::zNarrow(floatnearval,floatfarval)constReturnacopySbViewVolumewithnarroweddepthbysupplyingparametersfornewnearandfarclippingplanes.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)Scalewidthandheightofviewingfrustumbythegivenratioaroundtheprojectionplanecenteraxis.Seealso:scaleWidth(),scaleHeight().voidSbViewVolume::scaleWidth(floatratio)Scalewidthofviewingfrustumbythegivenratioaroundtheverticalcenteraxisintheprojectionplane.Seealso:scale(),scaleHeight().voidSbViewVolume::scaleHeight(floatratio)Scaleheightofviewingfrustumbythegivenratioaroundthehorizontalcenteraxisintheprojectionplane.Seealso:scale(),scaleWidth().SbViewVolume::ProjectionTypeSbViewVolume::getProjectionType(void)constReturncurrentviewvolumeprojectiontype,whichcanbeeitherORTHOGRAPHICorPERSPECTIVE.Seealso:SbViewVolume::ProjectionTypeconstSbVec3f&SbViewVolume::getProjectionPoint(void)constReturnstheprojectionpoint,i.e.thecameraposition.constSbVec3f&SbViewVolume::getProjectionDirection(void)constReturnsthedirectionofprojection,i.e.thedirectionthecameraispointing.Seealso:getNearDist().floatSbViewVolume::getNearDist(void)constReturnsdistancefromprojectionplanetonearclippingplane.Seealso:getProjectionDirection().floatSbViewVolume::getWidth(void)constReturnswidthofviewingfrustumintheprojectionplane.Seealso:getHeight(),getDepth().floatSbViewVolume::getHeight(void)constReturnsheightofviewingfrustumintheprojectionplane.Seealso:getWidth(),getDepth().floatSbViewVolume::getDepth(void)constReturnsdepthofviewingfrustum,i.e.thedistancefromthenearclippingplanetothefarclippingplane.Seealso:getWidth(),getHeight().voidSbViewVolume::print(FILE*fp)constDumpthestateofthisobjecttothefilestream.Onlyworksindebugversionoflibrary,methoddoesnothinginanoptimizedcompile.voidSbViewVolume::getViewVolumePlanes(SbPlaneplanes[6])constReturnsthesixplanesdefiningtheviewvolumeinthefollowingorder:left,bottom,right,top,near,far.Planenormalsaredirectedintotheviewvolume.This method is an extension for Coin, and is not available in the original Open Inventor.voidSbViewVolume::transform(constSbMatrix&matrix)Transformtheviewingvolumebymatrix.SbVec3fSbViewVolume::getViewUp(void)constReturnstheviewupvectorforthisviewvolume.It'savectorwhichisperpendiculartotheprojectiondirection,andparallelandorientedinthesamedirectionasthevectorfromthelowerleftcornertotheupperleftcornerofthenearplane.SbBoolSbViewVolume::intersect(constSbVec3f&p)constReturnsTRUEifpisinsidetheviewvolume.Since:Coin 2.3SbBoolSbViewVolume::intersect(constSbVec3f&p0,constSbVec3f&p1,SbVec3f&closestpoint)constReturnsTRUEifthelinesegmentp0,p1mayintersectvolume.Beawarethatit'snot100%certainthatthelinesegmentintersectsthevolumeevenifthisfunctionreturnsTRUE.closestpointis set to the closest point on the line to the center ray of the view volume.Since:Coin 2.3SbBoolSbViewVolume::intersect(constSbBox3f&box)constReturnsTRUEifboxmaybeinsidetheviewvolume.Since:Coin 2.3SbBoolSbViewVolume::outsideTest(constSbPlane&p,constSbVec3f&bmin,constSbVec3f&bmax)constReturnsTRUEifalleightcornerpointsinbmin,bmaxisoutsidep.constSbDPViewVolume&SbViewVolume::getDPViewVolume(void)constReturnsthedoubleprecisionversionofthisviewvolume.

**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.