SbDPViewVolume(3)
π NAME π
SbDPViewVolume β bestie, this is the class that is a double precision viewing volume in 3D space. That's literally it. That's the whole vibe. π¦
β¨ SYNOPSIS β¨
#include <Inventor/SbDPViewVolume.h>
π Public Types
enum ProjectionType { ORTHOGRAPHIC = 0, PERSPECTIVE = 1 }
π«Ά Public Member Functions
SbDPViewVolume (void)
~SbDPViewVolume (void)
void getMatrices (SbDPMatrix &affine, SbDPMatrix &proj) const
SbDPMatrix getMatrix (void) const
SbDPMatrix getCameraSpaceMatrix (void) const
void projectPointToLine (const SbVec2d &pt, SbDPLine &line) const
void projectPointToLine (const SbVec2d &pt, SbVec3d &line0, SbVec3d &line1) const
void projectToScreen (const SbVec3d &src, SbVec3d &dst) const
SbPlane getPlane (const double distFromEye) const
SbVec3d getSightPoint (const double distFromEye) const
SbVec3d getPlanePoint (const double distFromEye, const SbVec2d &normPoint) const
SbDPRotation getAlignRotation (SbBool rightAngleOnly=FALSE) const
double getWorldToScreenScale (const SbVec3d &worldCenter, double normRadius) const
SbVec2d projectBox (const SbBox3f &box) const
SbDPViewVolume narrow (double left, double bottom, double right, double top) const
SbDPViewVolume narrow (const SbBox3f &box) const
void ortho (double left, double right, double bottom, double top, double nearval, double farval)
void perspective (double fovy, double aspect, double nearval, double farval)
void frustum (double left, double right, double bottom, double top, double nearval, double farval)
void rotateCamera (const SbDPRotation &q)
void translateCamera (const SbVec3d &v)
SbVec3d zVector (void) const
SbDPViewVolume zNarrow (double nearval, double farval) const
void scale (double factor)
void scaleWidth (double ratio)
void scaleHeight (double ratio)
ProjectionType getProjectionType (void) const
const SbVec3d & getProjectionPoint (void) const
const SbVec3d & getProjectionDirection (void) const
double getNearDist (void) const
double getWidth (void) const
double getHeight (void) const
double getDepth (void) const
void print (FILE *fp) const
void getViewVolumePlanes (SbPlane planes[6]) const
void transform (const SbDPMatrix &matrix)
SbVec3d getViewUp (void) const
void copyValues (SbViewVolume &vv)
π Detailed Description π
SbDPViewVolume is a double precision viewing volume in 3D space. Say it with me now. π
Okay so this class is holding all the info you need to store a view volume. It's got methods for projecting primitives from or into the 3D volume, for doing camera transforms, view volume transforms, etc. It's giving main character of your rendering pipeline, ngl. β¨
Heads up bestie: be aware that this class is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API. So if you're porting old code, don't come for me. π
See also
SbViewportRegion
Since
- Coin 2.0
π¦ Member Enumeration Documentation π¦
enum SbDPViewVolume::ProjectionType
An SbDPViewVolume instance can represent either an orthogonal projection volume or a perspective projection volume. Pick your fighter. π
See also
ortho(),perspective(),getProjectionType().
Enumerator
ORTHOGRAPHICβ Orthographic projection.PERSPECTIVEβ Perspective projection.
π Constructor & Destructor Documentation π
SbDPViewVolume::SbDPViewVolume (void )
Constructor. And listen β the SbDPViewVolume instance will be uninitialized until you explicitly call ortho() or perspective(). Like, it's not gonna just figure itself out, bestie. You gotta tell it what it is. π«Ά
See also
ortho(),perspective().
SbDPViewVolume::~SbDPViewVolume (void )
Destructor. It's done, it's leaving the group chat, no notes. π
β¨ Member Function Documentation β¨
These are the methods, bestie. All of them. Every single one. Grab a snack, we're going through the whole roster π
π void SbDPViewVolume::getMatrices (SbDPMatrix & affine, SbDPMatrix & proj) const
Hands you back the view volume's affine matrix and its projection matrix, both at once, no cap.
See also:getMatrix(),getCameraSpaceMatrix()
π SbDPMatrix SbDPViewVolume::getMatrix (void ) const
Gives you the combined affine and projection matrix, already squished together into one. One matrix, both jobs, iconic behavior π
See also:getMatrices(),getCameraSpaceMatrix()
π SbDPMatrix SbDPViewVolume::getCameraSpaceMatrix (void ) const
Returns a matrix that translates the view volume camera back to origo, and rotates the camera so it'll point along the negative Z-axis.
β οΈ Heads up though β this matrix does not include the rotation needed to make the camera up vector point along the positive Y-axis. Translation: camera roll is not accounted for, so don't come for me when your roll goes missing π
See also:getMatrices(),getMatrix()
π void SbDPViewVolume::projectPointToLine (const SbVec2d & pt, SbDPLine & line) const
Projects the given 2D point from the projection plane into a 3D line. Slay.
Just make sure your pt coordinates are normalized to be within [0, 1], okay? That's the vibe check. β¨
π void SbDPViewVolume::projectPointToLine (const SbVec2d & pt, SbVec3d & line0, SbVec3d & line1) const
Same quest, different ending π« β this one projects the given 2D point from the projection plane into two points that define a 3D line. The first point, line0, is the corresponding point for the projection on the near plane, while line1 is the line endpoint, lying in the far plane.
π void SbDPViewVolume::projectToScreen (const SbVec3d & src, SbVec3d & dst) const
Takes your src point, projects it to a normalized set of screen coordinates in the projection plane, and drops the result in dst.
Good news: it is safe to let src and dst be the same SbVec3d instance. Same object, no drama π«Ά
The z-coordinate of dst is monotonically increasing for points closer to the far plane. But lowkey β it is not a linear relationship. The dst z-coordinate is calculated like this:
Orthogonal view: DSTz = (-2 * SRCz - far - near) / (far - near),
Perspective view: DSTz = (-SRCz * (far - near) - 2*far*near) / (far - near)
And the returned coordinates (dst) are normalized to be in range [0, 1]. Periodt. π
π SbPlane SbDPViewVolume::getPlane (const double distFromEye) const
Returns an SbPlane instance whose normal vector points in the opposite direction of where the camera is pointing. Which means the plane will be parallel to the near and far clipping planes. It's giving very parallel, very demure πΈ
See also: getSightPoint()
π SbVec3d SbDPViewVolume::getSightPoint (const double distFromEye) const
Returns the point on the center line-of-sight from the camera position, at the given distance. Literally just the spot the camera is staring at π―
See also: getPlane()
π SbVec3d SbDPViewVolume::getPlanePoint (const double distFromEye, const SbVec2d & normPoint) const
Returns the 3D point which projects to normPoint and lies on the plane that's perpendicular to the camera direction, sitting distFromEye distance away from the camera position.
normPoint should be given in normalized coordinates, where the visible render canvas is covered by the range [0.0, 1.0]. Yes, again with the [0.0, 1.0], it's a whole theme π
π SbDPRotation SbDPViewVolume::getAlignRotation (SbBool rightangleonly = FALSE) const
Returns a rotation that aligns an object so its positive x-axis is to the right and its positive y-axis is up in the view volume. Main character orientation energy π
If rightangleonly is TRUE, it'll create a rotation that aligns the x and y-axis with the closest orthogonal axes to right and up. Snapping to the grid, as one does β¨
π double SbDPViewVolume::getWorldToScreenScale (const SbVec3d & worldCenter, double normRadius) const
Picture a sphere with center in worldCenter and an initial radius of 1.0. Given that, this returns the scale factor needed to make the sphere have a normRadius radius when it's projected onto the near clipping plane. Math but make it cute π§
π SbVec2d SbDPViewVolume::projectBox (const SbBox3f & box) const
Projects the given box onto the projection plane and returns the normalized screen space it occupies. Box goes in, rectangle of screen space comes out π¦β‘οΈπΌοΈ
π SbDPViewVolume SbDPViewVolume::narrow (double left, double bottom, double right, double top) const
Returns a narrowed version of the view volume which is within the given [0, 1] normalized coordinates. Those coordinates are taken to be corner points of a normalized "view window" on the near clipping plane. I.e.:
SbDPViewVolume view;
view.ortho(0, 100, 0, 100, 0.1, 1000);
view = view.narrow(0.25, 0.5, 0.75, 1.0);
..and that will give you a view volume with corner points <25, 75> and <50, 100>. See? It zooms in on the vibes ππ
See also:scale(),scaleWidth(),scaleHeight()
π SbDPViewVolume SbDPViewVolume::narrow (const SbBox3f & box) const
Another narrowed version of the view volume, also within the given [0, 1] normalized coordinates β but this time it's box-flavored π
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. Memorize that, bestie, it comes back later π«Ά
π void SbDPViewVolume::ortho (double left, double right, double bottom, double top, double nearval, double farval)
Sets up the view volume as a rectangular box for orthographic parallel projections. The line of sight will be along the negative Z-axis, passing through the center of the plane defined by the point <(right+left)/2, (top+bottom)/2, 0>. Clean, flat, no perspective, no nonsense β¨
See also: perspective().
π void SbDPViewVolume::perspective (double fovy, double aspect, double nearval, double farval)
Sets up the view volume for perspective projections. The line of sight will go through origo along the negative Z-axis. Now everything's got that depth thing going on π₯
See also: ortho().
π void SbDPViewVolume::frustum (double left, double right, double bottom, double top, double nearval, double farval)
Sets up the frustum for perspective projection. This is an alternative to perspective() 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. So if you know that one, you already know this one π
See also: perspective()
π void SbDPViewVolume::rotateCamera (const SbDPRotation & q)
Rotates the direction which the camera is pointing in. The camera's whole angle, turned. Obsessed π«
See also: translateCamera().
π void SbDPViewVolume::translateCamera (const SbVec3d & v)
Translates the camera position of the view volume. Moving the camera, not rotating it β different dance move entirely πΊ
See also: rotateCamera().
π SbVec3d SbDPViewVolume::zVector (void ) const
Returns the vector pointing from the center of the view volume towards the camera. This is just the vector pointing in the opposite direction of getProjectionDirection(). It's the mirror twin, the opposite-energy sibling π
See also: getProjectionDirection().
π SbDPViewVolume SbDPViewVolume::zNarrow (double nearval, double farval) const
Returns a copy SbDPViewVolume with narrowed depth, by supplying parameters for new near and far clipping planes.
nearval and farval 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. Told you it'd come back π
See also: zVector().
π void SbDPViewVolume::scale (double factor)
Scales the width and height of the viewing frustum by the given ratio, around the projection plane center axis. Both dimensions, one call, efficient queen π
See also:scaleWidth(),scaleHeight().
π void SbDPViewVolume::scaleWidth (double ratio)
Scales the width of the viewing frustum by the given ratio, around the vertical center axis in the projection plane. Just the width. Just the vertical axis. Very specific, very slay β¨
See also:scale(),scaleHeight().
π void SbDPViewVolume::scaleHeight (double ratio)
Scales the height of the viewing frustum by the given ratio, around the horizontal center axis in the projection plane. The sibling of the one above πΈ
See also:scale(),scaleWidth().
π SbDPViewVolume::ProjectionType SbDPViewVolume::getProjectionType (void ) const
Returns the current view volume projection type, which can be either ORTHOGRAPHIC or PERSPECTIVE. Pick your fighter π
See also: SbDPViewVolume::ProjectionType
π const SbVec3d & SbDPViewVolume::getProjectionPoint (void ) const
Returns the coordinates of the center point in the projection plane. The middle. The moment. The main character of the projection plane π
π const SbVec3d & SbDPViewVolume::getProjectionDirection (void ) const
Returns the direction of projection, i.e. the direction the camera is pointing. Where the camera's looking, plainly stated π―
See also: getNearDist().
π double SbDPViewVolume::getNearDist (void ) const
Returns the distance from the projection plane to the near clipping plane. Short and sweet, just like this method π
See also: getProjectionDirection().
π double SbDPViewVolume::getWidth (void ) const
Returns the width of the viewing frustum in the projection plane.
See also:getHeight(),getDepth().
π double SbDPViewVolume::getHeight (void ) const
Returns the height of the viewing frustum in the projection plane.
See also:getWidth(),getDepth().
π double SbDPViewVolume::getDepth (void ) const
Returns the depth of the viewing frustum, i.e. the distance from the near clipping plane to the far clipping plane. Width, height, and now depth β the whole trio ate π
See also:getWidth(),getHeight().
π void SbDPViewVolume::print (FILE * fp) const
Dumps the state of this object to the fp file stream.
β οΈ But fr fr β this only works in a debug version of the library. In an optimized build, this method does nothing. So don't be shocked when your optimized build gives you silence π
π void SbDPViewVolume::getViewVolumePlanes (SbPlane planes[6]) const
Returns the six planes defining the view volume in the following order: left, bottom, right, top, near, far. The plane normals are directed into the view volume.
π‘ Little lore drop: this method is an extension for Coin, and is not available in the original Open Inventor. Coin-only behavior, iykyk π«Ά
π void SbDPViewVolume::transform (const SbDPMatrix & matrix)
Transforms the viewing volume by matrix. Boom. Done. β¨
π SbVec3d 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. Up is up, bestie, even in 3D πΈ
π void SbDPViewVolume::copyValues (SbViewVolume & vv)
Copies all values of a single precision SbViewVolume vv to the current double precision instance. Precision glow-up, we love to see it π
π Author
Generated automatically by Doxygen for Coin from the source code. The robots wrote the docs, I just gave them the group chat energy they deserved π
And that's a wrap on part 2, bestie!! π¦ This was Coin version 4.0.10, dated Thu Jun 25 2026 00:00:00, and the page you just read is SbDPViewVolume(3). Go forth and project responsibly π
β¨π₯
π¦ where this page comes from
- fedora 43: Coin4-devel 4.0.10-1.fc43 Β· BSD-3-Clause AND GPL-3.0-or-later
- fedora 43: Coin4-devel 4.0.10-1.fc43 Β· BSD-3-Clause AND GPL-3.0-or-later
- fedora 44: Coin4-devel 4.0.10-1.fc44 Β· BSD-3-Clause AND GPL-3.0-or-later
- fedora 44: Coin4-devel 4.0.10-1.fc44 Β· BSD-3-Clause AND GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms