SbViewVolume(3)

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

πŸ’– SbViewVolume β€” the Coin3D manual, but make it make sense πŸ’–

okay bestie, listen. this is SbViewVolume(3) from the Coin fam. it's a whole viewing volume living in 3D space and it's genuinely iconic, no cap. grab a snack, this page is long so it comes in parts. ✨


✨ NAME ✨

SbViewVolume β€” the SbViewVolume class is a viewing volume in 3D space.

fr fr, that's the whole name. short, sweet, main character energy.


🌸 SYNOPSIS 🌸

first things first, you gotta pull it in:

#include <Inventor/SbViewVolume.h>

πŸŽ€ Public Types

enum ProjectionType { ORTHOGRAPHIC = 0, PERSPECTIVE = 1 }

πŸ¦‹ Public Member Functions

okay so here's the FULL roster, every single one, not skipping a thing:

SbViewVolume (void)
~SbViewVolume (void)
void getMatrices (SbMatrix &affine, SbMatrix &proj) const
SbMatrix getMatrix (void) const
SbMatrix getCameraSpaceMatrix (void) const
void projectPointToLine (const SbVec2f &pt, SbLine &line) const
void projectPointToLine (const SbVec2f &pt, SbVec3f &line0, SbVec3f
    &line1) const
void projectToScreen (const SbVec3f &src, SbVec3f &dst) const
SbPlane getPlane (const float distFromEye) const
SbVec3f getSightPoint (const float distFromEye) const
SbVec3f getPlanePoint (const float distFromEye, const SbVec2f
    &normPoint) const
SbRotation getAlignRotation (SbBool rightAngleOnly=FALSE) const
float getWorldToScreenScale (const SbVec3f &worldCenter, float
    normRadius) const
SbVec2f projectBox (const SbBox3f &box) const
SbViewVolume narrow (float left, float bottom, float right, float top)
    const
SbViewVolume narrow (const SbBox3f &box) const
void ortho (float left, float right, float bottom, float top, float
    nearval, float farval)
void perspective (float fovy, float aspect, float nearval, float farval)
void frustum (float left, float right, float bottom, float top, float
    nearval, float farval)
void rotateCamera (const SbRotation &q)
void translateCamera (const SbVec3f &v)
SbVec3f zVector (void) const
SbViewVolume zNarrow (float nearval, float farval) const
void scale (float factor)
void scaleWidth (float ratio)
void scaleHeight (float ratio)
ProjectionType getProjectionType (void) const
const SbVec3f & getProjectionPoint (void) const
const SbVec3f & getProjectionDirection (void) const
float getNearDist (void) const
float getWidth (void) const
float getHeight (void) const
float getDepth (void) const
void print (FILE *fp) const
void getViewVolumePlanes (SbPlane planes[6]) const
void transform (const SbMatrix &matrix)
SbVec3f getViewUp (void) const
SbBool intersect (const SbVec3f &p) const
SbBool intersect (const SbVec3f &p0, const SbVec3f &p1, SbVec3f
    &closestpoint) const
SbBool intersect (const SbBox3f &box) const
SbBox3f intersectionBox (const SbBox3f &box) const
SbBool outsideTest (const SbPlane &p, const SbVec3f &bmin, const SbVec3f
    &bmax) const
const SbDPViewVolume & getDPViewVolume (void) const

that's 40-something functions and yes we love her for it πŸ’…

πŸ“ Public Attributes

the raw, public, everybody-can-touch-them fields:

ProjectionType type
SbVec3f projPoint
SbVec3f projDir
float nearDist
float nearToFar
SbVec3f llf
SbVec3f lrf
SbVec3f ulf

🌈 Detailed Description

okay so, plot twist, the class description is the same sentence as the NAME section, because consistency:

The SbViewVolume class 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.

so basically: it holds your view volume, and it can translate between 2D projection-plane points and the 3D volume in BOTH directions, plus it does camera transforms and view volume transforms. multitasking queen πŸ‘‘

See also

  • SbViewportRegion

🧚 Member Enumeration Documentation

πŸ’œ enum SbViewVolume::ProjectionType

An SbViewVolume instance can represent either an orthogonal projection volume or a perspective projection volume.

like, pick your fighter. are we doing flat parallel vibes or everything-shrinks-toward-a-point vibes? πŸ¦‹

See also

  • ortho(), perspective(), getProjectionType().

Enumerator

  • ORTHOGRAPHIC β€” Orthographic projection.
  • PERSPECTIVE β€” Perspective projection.

those are the only two options and honestly? she doesn't need more.


πŸŽ€ Constructor & Destructor Documentation

🌸 SbViewVolume::SbViewVolume (void )

Constructor.

⚠️ okay bestie, real talk: the SbViewVolume instance will be uninitialized until you explicitly call ortho() or perspective(). do NOT skip that step. an uninitialized view volume is giving chaos energy and not the cute kind. 😭

See also

  • ortho(), perspective().

πŸ¦‹ SbViewVolume::~SbViewVolume (void )

Destructor.

that's it, that's the whole thing. she cleans up after herself. periodt. ✨


more parts coming, don't go anywhere πŸ’–

πŸ’– Member Function Documentation πŸ’–

void SbViewVolume::getMatrices (SbMatrix & affine, SbMatrix & proj) const

Okay so this one hands you both matrices at once: the view volume's affine matrix and the projection matrix. Two-for-one, slay. ✨

See also: getMatrix(), getCameraSpaceMatrix()

SbMatrix SbViewVolume::getMatrix (void ) const

Returns the combined affine and projection matrix. It's giving one matrix to rule them all 😌

See also: getMatrices(), getCameraSpaceMatrix()

SbMatrix SbViewVolume::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. origo is a whole vibe. ✨

Note: this matrix will not include the rotation necessary to make the camera up vector point along the positive Y-axis (i.e. camera roll is not accounted for). So don't come for me if your roll is sideways, bestie. πŸ™ˆ

See also: getMatrices(), getMatrix()

void SbViewVolume::projectPointToLine (const SbVec2f & pt, SbLine & line) const

Project the given 2D point from the projection plane into a 3D line. pt coordinates should be normalized to be within [0, 1]. No cap. πŸ’…

void SbViewVolume::projectPointToLine (const SbVec2f & pt, SbVec3f & line0, SbVec3f & line1) const

Project 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, while line1 will be the line endpoint, lying in the far plane. It's giving near to far realness. 🌈

void SbViewVolume::projectToScreen (const SbVec3f & src, SbVec3f & dst) const

Project the src point to a normalized set of screen coordinates in the projection plane and place the result in dst. ✨

It is safe to let src and dst be the same SbVec3f instance. self-assignment? we love to see it. 🫢

The z-coordinate of dst is monotonically increasing for points closer to the far plane. Note however that this is not a linear relationship, the dst z-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]. periodt. πŸ’…

SbPlane SbViewVolume::getPlane (const float distFromEye) const

Returns an SbPlane 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. parallel queen πŸ‘‘

See also: getSightPoint()

SbVec3f SbViewVolume::getSightPoint (const float distFromEye) const

Returns the point on the center line-of-sight from the camera position with the given distance. center line-of-sight is main character energy fr fr. ✨

See also: getPlane()

SbVec3f SbViewVolume::getPlanePoint (const float distFromEye, const SbVec2f & normPoint) const

Return the 3D point which projects to normPoint and lies on the plane perpendicular to the camera direction and 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]. okay bestie, normalize it. πŸ’–

SbRotation SbViewVolume::getAlignRotation (SbBool rightangleonly = FALSE) 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. align that object, slay. ✨

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. No cap. πŸ’…

float SbViewVolume::getWorldToScreenScale (const SbVec3f & worldCenter, float normRadius) const

Given a sphere with center in worldCenter and an initial radius of 1.0, return the scale factor needed to make this sphere have a normRadius radius when projected onto the near clipping plane. math but make it cute πŸŽ€

SbVec2f SbViewVolume::projectBox (const SbBox3f & box) const

Projects the given box onto the projection plane and returns the normalized screen space it occupies. box? projected. screen space? normalized. iconic. πŸ’–

SbViewVolume SbViewVolume::narrow (float left, float bottom, float right, float top) 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.: πŸͺŸ

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>. narrow it down, bestie. πŸ’…

See also: scale(), scaleWidth(), scaleHeight()

SbViewVolume SbViewVolume::narrow (const SbBox3f & 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. z coordinates? adjusting clipping planes? we love a depth queen. 🌈

void SbViewVolume::ortho (float left, float right, float bottom, float top, float nearval, float farval)

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]. negative Z-axis is the moment. πŸ’…

See also: perspective().

void SbViewVolume::perspective (float fovy, float aspect, float nearval, float farval)

Set up the view volume for perspective projections. The line of sight will be through origo along the negative Z-axis. origo? we go. ✨

See also: ortho().

void SbViewVolume::frustum (float left, float right, float bottom, float top, float nearval, float farval)

Set 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. off-center? we love an off-center moment. πŸ‘‘

This function is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API. Coin exclusive, bestie. πŸ’–

Since: Coin 2.0

See also: perspective()

void SbViewVolume::rotateCamera (const SbRotation & q)

Rotate the direction which the camera is pointing in. spin that camera. πŸ”„

See also: translateCamera().

void SbViewVolume::translateCamera (const SbVec3f & v)

Translate the camera position of the view volume. move it, move it. πŸ’«

See also: rotateCamera().

SbVec3f SbViewVolume::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 getProjectionDirection(). opposite direction? we love a contrarian. πŸ’…

See also: getProjectionDirection().

SbViewVolume SbViewVolume::zNarrow (float nearval, float farval) const

Return a copy SbViewVolume with narrowed depth by supplying parameters for new near and far clipping planes. narrow depth, big mood. πŸ¦‹

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. 1.0 near, 0.0 far, got it. ✨

See also: zVector().

void SbViewVolume::scale (float factor)

Scale width and height of viewing frustum by the given ratio around the projection plane center axis. scale it, slay it. πŸ’…

See also: scaleWidth(), scaleHeight().

void SbViewVolume::scaleWidth (float ratio)

Scale width of viewing frustum by the given ratio around the vertical center axis in the projection plane. width only? we respect the vertical center axis. πŸŽ€

See also: scale(), scaleHeight().

void SbViewVolume::scaleHeight (float ratio)

Scale height of viewing frustum by the given ratio around the horizontal center axis in the projection plane. height only? horizontal center axis? yes bestie. πŸ’–

See also: scale(), scaleWidth().

SbViewVolume::ProjectionType SbViewVolume::getProjectionType (void ) const

Return current view volume projection type, which can be either ORTHOGRAPHIC or PERSPECTIVE. pick your projection, periodt. 🌈

See also: SbViewVolume::ProjectionType

const SbVec3f & SbViewVolume::getProjectionPoint (void ) const

Returns the projection point, i.e. the camera position. camera position? that's the projection point. πŸ“

const SbVec3f & SbViewVolume::getProjectionDirection (void ) const

Returns the direction of projection, i.e. the direction the camera is pointing. where the camera is looking, bestie. πŸ‘€

See also: getNearDist().

float SbViewVolume::getNearDist (void ) const

Returns distance from projection plane to near clipping plane. near clipping plane distance, iconic. πŸ“

See also: getProjectionDirection().

float SbViewVolume::getWidth (void ) const

Returns width of viewing frustum in the projection plane. width check. ✨

See also: getHeight(), getDepth().

float SbViewVolume::getHeight (void ) const

Returns height of viewing frustum in the projection plane. height check. πŸ’…

See also: getWidth(), getDepth().

float SbViewVolume::getDepth (void ) const

Returns depth of viewing frustum, i.e. the distance from the near clipping plane to the far clipping plane. depth? the distance from near to far, periodt. 🌌

See also: getWidth(), getHeight().

void SbViewVolume::print (FILE * fp) const

Dump the state of this object to the fp file stream. Only works in debug version of library, method does nothing in an optimized build. debug only, bestie β€” optimized build gives you nothing. πŸ’€

void SbViewVolume::getViewVolumePlanes (SbPlane planes[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. six planes, one order, no cap. 🌈

This method is an extension for Coin, and is not available in the original Open Inventor. Coin exclusive again, slay. πŸ’–

void SbViewVolume::transform (const SbMatrix & matrix)

Transform the viewing volume by matrix. matrix makeover. ✨

SbVec3f SbViewVolume::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 vector? from lower left to upper left of the near plane. got it. πŸ¦‹

SbBool SbViewVolume::intersect (const SbVec3f & p) const

Returns TRUE if p is inside the view volume. inside? TRUE. outside? not our problem. πŸ’…

Since: Coin 2.3

SbBool SbViewVolume::intersect (const SbVec3f & p0, const SbVec3f & p1, SbVec3f & closestpoint) const

Returns TRUE if the line segment p0, p1 may intersect volume. Be aware that it is not 100% certain that the line segment intersects the volume even if this function returns TRUE. may intersect? key word may. πŸ™ˆ

closestpoint is set to the closest point on the line to the center ray of the view volume. closest point to the center ray, bestie. ✨

Since: Coin 2.3

SbBool SbViewVolume::intersect (const SbBox3f & box) const

Returns TRUE if box may be inside the view volume. may be inside? vibe check. πŸ’–

Since: Coin 2.3

SbBox3f SbViewVolume::intersectionBox (const SbBox3f & box) const

Calculates the bbox of the intersection between bbox and the view volume. intersection bbox? we love a calculated queen. πŸ“¦

Since: Coin 4.0

SbBool SbViewVolume::outsideTest (const SbPlane & p, const SbVec3f & bmin, const SbVec3f & bmax) const

Returns TRUE if all eight corner points in bmin, bmax is outside p. all eight corners outside? TRUE. periodt. πŸ’…

const SbDPViewVolume & SbViewVolume::getDPViewVolume (void ) const

Returns the double precision version of this view volume. double precision? she's fancy. πŸ’Ž

✨ MEMBER DATA DOCUMENTATION ✨

okay bestie, we made it to the data members πŸ’– this is where the class keeps its actual guts β€” and here's the tea: all of these are marked as internal to the library, which means they're not really for you, they're for the library's own little ecosystem. Like, they exist, they're real, but the manual is basically saying "bestie, don't touch, this is not your moment" πŸ’…

Every single one of them carries the exact same energy: This API member is considered internal to the library, as it is not likely to be of interest to the application programmer. no cap, that's the whole vibe for all eight of them 🌸


πŸ¦‹ ProjectionType SbViewVolume::type

This API member is considered internal to the library, as it is not likely to be of interest to the application programmer. it's giving backstage-pass-only πŸŽ€

πŸ¦‹ SbVec3f SbViewVolume::projPoint

This API member is considered internal to the library, as it is not likely to be of interest to the application programmer. lowkey just minding its own business fr fr ✨

πŸ¦‹ SbVec3f SbViewVolume::projDir

This API member is considered internal to the library, as it is not likely to be of interest to the application programmer. the direction of the projection, but like… not for you bestie πŸ’œ

πŸ¦‹ float SbViewVolume::nearDist

This API member is considered internal to the library, as it is not likely to be of interest to the application programmer. a whole float living its truth πŸ™ˆ

πŸ¦‹ float SbViewVolume::nearToFar

This API member is considered internal to the library, as it is not likely to be of interest to the application programmer. internal era only, periodt πŸ’…

πŸ¦‹ SbVec3f SbViewVolume::llf

This API member is considered internal to the library, as it is not likely to be of interest to the application programmer. lower-left-far, iconic naming honestly πŸ‘‘

πŸ¦‹ SbVec3f SbViewVolume::lrf

This API member is considered internal to the library, as it is not likely to be of interest to the application programmer. lower-right-far, serving coordinates πŸ’–

πŸ¦‹ SbVec3f SbViewVolume::ulf

This API member is considered internal to the library, as it is not likely to be of interest to the application programmer. upper-left-far, completing the lil trio πŸ¦‹


πŸ‘‘ AUTHOR πŸ‘‘

Generated automatically by Doxygen for Coin from the source code. not me being a robot-written glow-up, we love a queen that documents herself automatically βœ¨πŸ€–


and that's a wrap on SbViewVolume(3) bestie!! πŸŒˆπŸ’– this one's from Version 4.0.10, dated Thu Jun 25 2026 00:00:00, so you know it's fresh out the oven πŸ“ go forth and view some volumes, you absolute main character 🫢⭐

πŸ“¦ where this page comes from