.TH "SbDPViewVolume" 3 "Sat Oct 12 2013" "Version 4.0.0a" "Coin" \" -*- nroff -*- .ad l .nh .SH NAME SbDPViewVolume \- .PP The \fBSbDPViewVolume\fP class is a double precision viewing volume in 3D space\&. .PP This class contains the necessary information for storing a view volume\&. It has methods for projection of primitives from or into the 3D volume, doing camera transforms, view volume transforms etc\&. .SH SYNOPSIS .br .PP .SS "Public Types" .in +1c .ti -1c .RI "enum \fBProjectionType\fP { \fBORTHOGRAPHIC\fP = 0, \fBPERSPECTIVE\fP = 1 }" .br .in -1c .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBSbDPViewVolume\fP (void)" .br .ti -1c .RI "\fB~SbDPViewVolume\fP (void)" .br .ti -1c .RI "void \fBgetMatrices\fP (\fBSbDPMatrix\fP &affine, \fBSbDPMatrix\fP &proj) const " .br .ti -1c .RI "\fBSbDPMatrix\fP \fBgetMatrix\fP (void) const " .br .ti -1c .RI "\fBSbDPMatrix\fP \fBgetCameraSpaceMatrix\fP (void) const " .br .ti -1c .RI "void \fBprojectPointToLine\fP (const \fBSbVec2d\fP &pt, \fBSbDPLine\fP &line) const " .br .ti -1c .RI "void \fBprojectPointToLine\fP (const \fBSbVec2d\fP &pt, \fBSbVec3d\fP &line0, \fBSbVec3d\fP &line1) const " .br .ti -1c .RI "void \fBprojectToScreen\fP (const \fBSbVec3d\fP &src, \fBSbVec3d\fP &dst) const " .br .ti -1c .RI "\fBSbPlane\fP \fBgetPlane\fP (const double distFromEye) const " .br .ti -1c .RI "\fBSbVec3d\fP \fBgetSightPoint\fP (const double distFromEye) const " .br .ti -1c .RI "\fBSbVec3d\fP \fBgetPlanePoint\fP (const double distFromEye, const \fBSbVec2d\fP &normPoint) const " .br .ti -1c .RI "\fBSbDPRotation\fP \fBgetAlignRotation\fP (SbBool rightAngleOnly=FALSE) const " .br .ti -1c .RI "double \fBgetWorldToScreenScale\fP (const \fBSbVec3d\fP &worldCenter, double normRadius) const " .br .ti -1c .RI "\fBSbVec2d\fP \fBprojectBox\fP (const \fBSbBox3f\fP &box) const " .br .ti -1c .RI "\fBSbDPViewVolume\fP \fBnarrow\fP (double left, double bottom, double right, double top) const " .br .ti -1c .RI "\fBSbDPViewVolume\fP \fBnarrow\fP (const \fBSbBox3f\fP &box) const " .br .ti -1c .RI "void \fBortho\fP (double left, double right, double bottom, double top, double nearval, double farval)" .br .ti -1c .RI "void \fBperspective\fP (double fovy, double aspect, double nearval, double farval)" .br .ti -1c .RI "void \fBfrustum\fP (double left, double right, double bottom, double top, double nearval, double farval)" .br .ti -1c .RI "void \fBrotateCamera\fP (const \fBSbDPRotation\fP &q)" .br .ti -1c .RI "void \fBtranslateCamera\fP (const \fBSbVec3d\fP &v)" .br .ti -1c .RI "\fBSbVec3d\fP \fBzVector\fP (void) const " .br .ti -1c .RI "\fBSbDPViewVolume\fP \fBzNarrow\fP (double nearval, double farval) const " .br .ti -1c .RI "void \fBscale\fP (double factor)" .br .ti -1c .RI "void \fBscaleWidth\fP (double ratio)" .br .ti -1c .RI "void \fBscaleHeight\fP (double ratio)" .br .ti -1c .RI "\fBProjectionType\fP \fBgetProjectionType\fP (void) const " .br .ti -1c .RI "const \fBSbVec3d\fP & \fBgetProjectionPoint\fP (void) const " .br .ti -1c .RI "const \fBSbVec3d\fP & \fBgetProjectionDirection\fP (void) const " .br .ti -1c .RI "double \fBgetNearDist\fP (void) const " .br .ti -1c .RI "double \fBgetWidth\fP (void) const " .br .ti -1c .RI "double \fBgetHeight\fP (void) const " .br .ti -1c .RI "double \fBgetDepth\fP (void) const " .br .ti -1c .RI "void \fBprint\fP (FILE *fp) const " .br .ti -1c .RI "void \fBgetViewVolumePlanes\fP (\fBSbPlane\fP planes[6]) const " .br .ti -1c .RI "void \fBtransform\fP (const \fBSbDPMatrix\fP &matrix)" .br .ti -1c .RI "\fBSbVec3d\fP \fBgetViewUp\fP (void) const " .br .ti -1c .RI "void \fBcopyValues\fP (\fBSbViewVolume\fP &vv)" .br .in -1c .SH "Detailed Description" .PP The \fBSbDPViewVolume\fP class is a double precision viewing volume in 3D space\&. .PP This class contains the necessary information for storing a view volume\&. It has methods for projection of primitives from or into the 3D volume, doing camera transforms, view volume transforms etc\&. Be aware that this class is an extension for Coin, and it is not available in the original SGI Open Inventor v2\&.1 API\&. .PP \fBSee Also:\fP .RS 4 \fBSbViewportRegion\fP .RE .PP \fBSince:\fP .RS 4 Coin 2\&.0 .RE .PP .SH "Member Enumeration Documentation" .PP .SS "enum \fBSbDPViewVolume::ProjectionType\fP" An \fBSbDPViewVolume\fP instance can represent either an orthogonal projection volume or a perspective projection volume\&. .PP \fBSee Also:\fP .RS 4 \fBortho()\fP, \fBperspective()\fP, \fBgetProjectionType()\fP\&. .RE .PP .PP \fBEnumerator: \fP .in +1c .TP \fB\fIORTHOGRAPHIC \fP\fP Orthographic projection\&. .TP \fB\fIPERSPECTIVE \fP\fP Perspective projection\&. .SH "Constructor & Destructor Documentation" .PP .SS "SbDPViewVolume::SbDPViewVolume (void)" Constructor\&. Note that the \fBSbDPViewVolume\fP instance will be uninitialized until you explicitly call \fI\fBortho()\fP\fP or \fI\fBperspective()\fP\fP\&. .PP \fBSee Also:\fP .RS 4 \fBortho()\fP, \fBperspective()\fP\&. .RE .PP .SS "SbDPViewVolume::~SbDPViewVolume (void)" Destructor\&. .SH "Member Function Documentation" .PP .SS "void SbDPViewVolume::getMatrices (\fBSbDPMatrix\fP &affine, \fBSbDPMatrix\fP &proj) const" Returns the view volume's affine matrix and projection matrix\&. .PP \fBSee Also:\fP .RS 4 \fBgetMatrix()\fP, \fBgetCameraSpaceMatrix()\fP .RE .PP .SS "\fBSbDPMatrix\fP SbDPViewVolume::getMatrix (void) const" Returns the combined affine and projection matrix\&. .PP \fBSee Also:\fP .RS 4 \fBgetMatrices()\fP, \fBgetCameraSpaceMatrix()\fP .RE .PP .SS "\fBSbDPMatrix\fP SbDPViewVolume::getCameraSpaceMatrix (void) const" Returns 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\&. .PP Note that the matrix will \fInot\fP include the rotation necessary to make the camera up vector point along the positive y axis (i\&.e\&. camera roll is not accounted for)\&. .PP \fBSee Also:\fP .RS 4 \fBgetMatrices()\fP, \fBgetMatrix()\fP .RE .PP .SS "void SbDPViewVolume::projectPointToLine (const \fBSbVec2d\fP &pt, \fBSbDPLine\fP &line) const" Project the given 2D point from the projection plane into a 3D line\&. .PP \fIpt\fP coordinates should be normalized to be within [0, 1]\&. .SS "void SbDPViewVolume::projectPointToLine (const \fBSbVec2d\fP &pt, \fBSbVec3d\fP &line0, \fBSbVec3d\fP &line1) const" Project the given 2D point from the projection plane into two points defining a 3D line\&. The first point, \fIline0\fP, will be the corresponding point for the projection on the near plane, while \fIline1\fP will be the line endpoint, lying in the far plane\&. .SS "void SbDPViewVolume::projectToScreen (const \fBSbVec3d\fP &src, \fBSbVec3d\fP &dst) const" Project the \fIsrc\fP point to a normalized set of screen coordinates in the projection plane and place the result in \fIdst\fP\&. .PP It is safe to let \fIsrc\fP and be the same \fBSbVec3d\fP instance\&. .PP The z-coordinate of \fIdst\fP is monotonically increasing for points closer to the far plane\&. Note however that this is not a linear relationship, the \fIdst\fP z-coordinate is calculated as follows: .PP Orthogonal view: DSTz = (-2 * SRCz - far - near) / (far - near), Perspective view: DSTz = (-SRCz * (far - near) - 2*far*near) / (far - near) .PP The returned coordinates (\fIdst\fP) are normalized to be in range [0, 1]\&. .SS "\fBSbPlane\fP SbDPViewVolume::getPlane (const doubledistFromEye) const" Returns an \fBSbPlane\fP instance 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\&. .PP \fBSee Also:\fP .RS 4 \fBgetSightPoint()\fP .RE .PP .SS "\fBSbVec3d\fP SbDPViewVolume::getSightPoint (const doubledistFromEye) const" Returns the point on the center line-of-sight from the camera position with the given distance\&. .PP \fBSee Also:\fP .RS 4 \fBgetPlane()\fP .RE .PP .SS "\fBSbVec3d\fP SbDPViewVolume::getPlanePoint (const doubledistFromEye, const \fBSbVec2d\fP &normPoint) const" Return the 3D point which projects to \fInormPoint\fP and lies on the plane perpendicular to the camera direction and \fIdistFromEye\fP distance away from the camera position\&. .PP \fInormPoint\fP should be given in normalized coordinates, where the visible render canvas is covered by the range [0\&.0, 1\&.0]\&. .SS "\fBSbDPRotation\fP SbDPViewVolume::getAlignRotation (SbBoolrightangleonly = \fCFALSE\fP) const" Returns 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\&. .PP 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\&. .SS "double SbDPViewVolume::getWorldToScreenScale (const \fBSbVec3d\fP &worldCenter, doublenormRadius) const" Given a sphere with center in \fIworldCenter\fP and an initial radius of \fI1\&.0\fP, return the scale factor needed to make this sphere have a \fInormRadius\fP radius when projected onto the near clipping plane\&. .SS "\fBSbVec2d\fP SbDPViewVolume::projectBox (const \fBSbBox3f\fP &box) const" Projects the given box onto the projection plane and returns the normalized screen space it occupies\&. .SS "\fBSbDPViewVolume\fP SbDPViewVolume::narrow (doubleleft, doublebottom, doubleright, doubletop) const" Returns 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\&.: .PP .PP .nf SbDPViewVolume view; view\&.ortho(0, 100, 0, 100, 0\&.1, 1000); view = view\&.narrow(0\&.25, 0\&.5, 0\&.75, 1\&.0); .fi .PP .PP \&.\&.will give a view volume with corner points <25, 75> and <50, 100>\&. .PP \fBSee Also:\fP .RS 4 \fBscale()\fP, \fBscaleWidth()\fP, \fBscaleHeight()\fP .RE .PP .SS "\fBSbDPViewVolume\fP SbDPViewVolume::narrow (const \fBSbBox3f\fP &box) const" Returns 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\&. .SS "void SbDPViewVolume::ortho (doubleleft, doubleright, doublebottom, doubletop, doublenearval, doublefarval)" 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>\&. .PP \fBSee Also:\fP .RS 4 \fBperspective()\fP\&. .RE .PP .SS "void SbDPViewVolume::perspective (doublefovy, doubleaspect, doublenearval, doublefarval)" Set up the view volume for perspective projections\&. The line of sight will be through origo along the negative z axis\&. .PP \fBSee Also:\fP .RS 4 \fBortho()\fP\&. .RE .PP .SS "void SbDPViewVolume::frustum (doubleleft, doubleright, doublebottom, doubletop, doublenearval, doublefarval)" Set up the frustum for perspective projection\&. This is an alternative to \fBperspective()\fP 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\&. .PP \fBSee Also:\fP .RS 4 \fBperspective()\fP .RE .PP .SS "void SbDPViewVolume::rotateCamera (const \fBSbDPRotation\fP &q)" Rotate the direction which the camera is pointing in\&. .PP \fBSee Also:\fP .RS 4 \fBtranslateCamera()\fP\&. .RE .PP .SS "void SbDPViewVolume::translateCamera (const \fBSbVec3d\fP &v)" Translate the camera position of the view volume\&. .PP \fBSee Also:\fP .RS 4 \fBrotateCamera()\fP\&. .RE .PP .SS "\fBSbVec3d\fP SbDPViewVolume::zVector (void) const" Return the vector pointing from the center of the view volume towards the camera\&. This is just the vector pointing in the opposite direction of \fI\fBgetProjectionDirection()\fP\fP\&. .PP \fBSee Also:\fP .RS 4 \fBgetProjectionDirection()\fP\&. .RE .PP .SS "\fBSbDPViewVolume\fP SbDPViewVolume::zNarrow (doublenearval, doublefarval) const" Return a copy \fBSbDPViewVolume\fP with narrowed depth by supplying parameters for new near and far clipping planes\&. .PP \fInearval\fP 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\&. .PP \fBSee Also:\fP .RS 4 \fBzVector()\fP\&. .RE .PP .SS "void SbDPViewVolume::scale (doublefactor)" Scale width and height of viewing frustum by the given ratio around the projection plane center axis\&. .PP \fBSee Also:\fP .RS 4 \fBscaleWidth()\fP, \fBscaleHeight()\fP\&. .RE .PP .SS "void SbDPViewVolume::scaleWidth (doubleratio)" Scale width of viewing frustum by the given ratio around the vertical center axis in the projection plane\&. .PP \fBSee Also:\fP .RS 4 \fBscale()\fP, \fBscaleHeight()\fP\&. .RE .PP .SS "void SbDPViewVolume::scaleHeight (doubleratio)" Scale height of viewing frustum by the given ratio around the horizontal center axis in the projection plane\&. .PP \fBSee Also:\fP .RS 4 \fBscale()\fP, \fBscaleWidth()\fP\&. .RE .PP .SS "\fBSbDPViewVolume::ProjectionType\fP SbDPViewVolume::getProjectionType (void) const" Return current view volume projection type, which can be either \fIORTHOGRAPHIC\fP or \fIPERSPECTIVE\fP\&. .PP \fBSee Also:\fP .RS 4 \fBSbDPViewVolume::ProjectionType\fP .RE .PP .SS "const \fBSbVec3d\fP & SbDPViewVolume::getProjectionPoint (void) const" Returns coordinates of center point in the projection plane\&. .SS "const \fBSbVec3d\fP & SbDPViewVolume::getProjectionDirection (void) const" Returns the direction of projection, i\&.e\&. the direction the camera is pointing\&. .PP \fBSee Also:\fP .RS 4 \fBgetNearDist()\fP\&. .RE .PP .SS "double SbDPViewVolume::getNearDist (void) const" Returns distance from projection plane to near clipping plane\&. .PP \fBSee Also:\fP .RS 4 \fBgetProjectionDirection()\fP\&. .RE .PP .SS "double SbDPViewVolume::getWidth (void) const" Returns width of viewing frustum in the projection plane\&. .PP \fBSee Also:\fP .RS 4 \fBgetHeight()\fP, \fBgetDepth()\fP\&. .RE .PP .SS "double SbDPViewVolume::getHeight (void) const" Returns height of viewing frustum in the projection plane\&. .PP \fBSee Also:\fP .RS 4 \fBgetWidth()\fP, \fBgetDepth()\fP\&. .RE .PP .SS "double SbDPViewVolume::getDepth (void) const" Returns depth of viewing frustum, i\&.e\&. the distance from the near clipping plane to the far clipping plane\&. .PP \fBSee Also:\fP .RS 4 \fBgetWidth()\fP, \fBgetHeight()\fP\&. .RE .PP .SS "void SbDPViewVolume::print (FILE *fp) const" Dump the state of this object to the \fIfile\fP stream\&. Only works in debug version of library, method does nothing in an optimized compile\&. .SS "void SbDPViewVolume::getViewVolumePlanes (\fBSbPlane\fPplanes[6]) const" Returns 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\&. .PP This method is an extension for Coin, and is not available in the original Open Inventor\&. .SS "void SbDPViewVolume::transform (const \fBSbDPMatrix\fP &matrix)" Transform the viewing volume by \fImatrix\fP\&. .SS "\fBSbVec3d\fP SbDPViewVolume::getViewUp (void) const" Returns 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\&. .SH "Author" .PP Generated automatically by Doxygen for Coin from the source code\&.