SbDPViewVolume(3)

πŸ“¦
version 4.0.10 Β· 4 versions
, in fedora 43, fedora 44

πŸ’– 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