SbDPViewVolume(3)

πŸ“¦ version 3.1.3, in fedora 43, fedora 44

πŸ’– SbDPViewVolume(3) πŸ’–

okay so bestie, this is the manual page for SbDPViewVolume(3) from the Library Functions Manual, and it is literally the double precision viewing volume in 3D space. no cap. πŸ’…


🌸 NAME 🌸

SbDPViewVolume β€” the SbDPViewVolume class is a double precision viewing volume in 3D space. periodt. ✨


✨ SYNOPSIS ✨

#include <Inventor/SbLinear.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 πŸ’–

okay so the SbDPViewVolume class is a double precision viewing volume in 3D space, and it is iconic. πŸ’…

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. slay. ✨

Be aware bestie: this class is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API. no cap. 🫢

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. vibe check passed. πŸ’œ

See also: ortho(), perspective(), getProjectionType().

✨ Enumerator ✨

  • ORTHOGRAPHIC β€” Orthographic projection. clean.
  • PERSPECTIVE β€” Perspective projection. main character energy.

πŸŽ€ Constructor & Destructor Documentation πŸŽ€

πŸ’– SbDPViewVolume::SbDPViewVolume (void ) πŸ’–

Constructor. Note that the SbDPViewVolume instance will be uninitialized until you explicitly call ortho() or perspective(). so don’t skip that step, bestie. 😭

See also: ortho(), perspective().

πŸ’– SbDPViewVolume::~SbDPViewVolume (void ) πŸ’–

Destructor. πŸ¦‹

πŸ’– MEMBER FUNCTION DOCUMENTATION πŸ’–

okay bestie, buckle UP, because this is the big one β€” literally every method SbDPViewVolume has, and we're going through all of them together 🫢 no skipping, no "you get the idea", we're doing the whole list. hydrate first. πŸ’§


void SbDPViewVolume::getMatrices (SbDPMatrix & affine, SbDPMatrix & proj) const

gives you both matrices at once: the view volume's affine matrix lands in affine, and the projection matrix lands in proj. two-for-one, we love a bundle deal πŸ’…

  • See also: getMatrix(), getCameraSpaceMatrix()

SbDPMatrix SbDPViewVolume::getMatrix (void ) const

hands you the affine and projection matrices combined into one single matrix. the everything bagel of matrices ✨

  • 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 points along the negative z axis. iconic little glow-up for your camera 🌈

heads up though: this matrix will 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 it about the roll, it never claimed that πŸ’€
  • See also: getMatrices(), getMatrix()

void SbDPViewVolume::projectPointToLine (const SbVec2d & pt, SbDPLine & line) const

takes a 2D point pt from the projection plane and projects it into a 3D line, which it drops into line.

and bestie, pt coordinates should be normalized to be within [0, 1]. keep it in range, okay? πŸŽ€

void SbDPViewVolume::projectPointToLine (const SbVec2d & pt, SbVec3d & line0, SbVec3d & line1) const

same idea but it gives you two points instead of a line object β€” two points define the 3D line, that's just geometry, she's math-ing πŸ’…

  • line0 is the first point: the corresponding point for the projection on the near plane.
  • line1 is the line endpoint, lying in the far plane.

void SbDPViewVolume::projectToScreen (const SbVec3d & src, SbVec3d & dst) const

projects the src point into a normalized set of screen coordinates on the projection plane, and drops the result in dst. plot twist: it is totally safe to let src and dst be the same SbVec3d instance. no need to make a copy, she's handling it 🫢

the z-coordinate of dst is monotonically increasing for points closer to the far plane. but ngl, it's 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 the range [0, 1]. yes ma'am ✨

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 is parallel to the near and far clipping planes. it's giving "chill, parallel, unbothered" 🌸

  • See also: getSightPoint()

SbVec3d SbDPViewVolume::getSightPoint (const double distFromEye) const

returns the point sitting on the center line-of-sight from the camera position, at the distance you give it. right on the main character axis πŸ’–

  • See also: getPlane()

SbVec3d SbDPViewVolume::getPlanePoint (const double distFromEye, const SbVec2d & normPoint) const

returns the 3D point that projects to normPoint and lies on the plane perpendicular to the camera direction, distFromEye distance away from the camera position. it's exactly where you think it is, and she found it πŸ”₯

normPoint should be given in normalized coordinates, where the visible render canvas is covered by the range [0.0, 1.0].

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. posture check for your geometry πŸ’…

if rightangleonly is TRUE, it creates a rotation that aligns the x and y axes with the closest orthogonal axes to right and up. snappy and square, periodt.

double SbDPViewVolume::getWorldToScreenScale (const SbVec3d & worldCenter, double normRadius) const

picture a sphere centered at worldCenter with an initial radius of 1.0. this returns the scale factor you'd need to make that sphere have a normRadius radius when it's projected onto the near clipping plane. math bestie said "I got you" πŸ“βœ¨

SbVec2d SbDPViewVolume::projectBox (const SbBox3f & box) const

projects the given box onto the projection plane and returns the normalized screen space it occupies. box go in, footprint come out πŸŽ€

SbDPViewVolume SbDPViewVolume::narrow (double left, double bottom, double right, double top) const

returns a narrowed version of the view volume, confined to the given [0, 1] normalized coordinates. those coordinates are treated as the corner points of a normalized "view window" on the near clipping plane. like zooming into a crop of the frame, lowkey obsessed πŸ¦‹

example time, exact and verbatim:

SbDPViewVolume view;
view.ortho(0, 100, 0, 100, 0.1, 1000);
view = view.narrow(0.25, 0.5, 0.75, 1.0);
  • See also: scale(), scaleWidth(), scaleHeight()

SbDPViewVolume SbDPViewVolume::narrow (const SbBox3f & box) const

also returns a narrowed version of the view volume within the given [0, 1] normalized coordinates, but this time from a box. the box's x and y coordinates are the corner points of a normalized "view window" on the near clipping plane. the box z coordinates 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

so z is basically inverted vibes, don't fight it πŸ’€

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 goes along the negative z axis, straight through the center of the plane defined by the point <(right+left)/2, (top+bottom)/2, 0>.

  • 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 goes through origo, along the negative z axis. classic, iconic, never misses πŸ”₯

  • 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 volume you want (e.g. off center volumes). same arguments and functionality as the corresponding OpenGL glFrustum() function. it's giving "I know a guy who knows OpenGL" 😌

  • See also: perspective()

void SbDPViewVolume::rotateCamera (const SbDPRotation & q)

rotates the direction the camera is pointing in. spin her around, she's fine with it πŸ’…

  • See also: translateCamera().

void SbDPViewVolume::translateCamera (const SbVec3d & v)

translates the camera position of the view volume. move her, don't shake her 🫢

  • See also: rotateCamera().

SbVec3d SbDPViewVolume::zVector (void ) const

returns the vector pointing from the center of the view volume towards the camera. that's just the vector pointing in the opposite direction of getProjectionDirection(). petty? maybe. correct? absolutely πŸ’œ

  • See also: getProjectionDirection().

SbDPViewVolume SbDPViewVolume::zNarrow (double nearval, double farval) const

returns a copy SbDPViewVolume with narrowed depth, by supplying parameters for the new near and far clipping planes. depth-restricted queen πŸ‘‘

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
  • 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 at once, symmetrical slay ✨

  • 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. width only, respect the boundary 🌸

  • 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. vertical queen behavior πŸŽ€

  • See also: scale(), scaleWidth().

SbDPViewVolume::ProjectionType SbDPViewVolume::getProjectionType (void ) const

returns the current view volume projection type, which can be either ORTHOGRAPHIC or PERSPECTIVE. two options, no in-between, no "it's complicated" πŸ’…

  • See also: SbDPViewVolume::ProjectionType

const SbVec3d & SbDPViewVolume::getProjectionPoint (void ) const

returns the coordinates of the center point in the projection plane. the literal center of attention 🫢

const SbVec3d & SbDPViewVolume::getProjectionDirection (void ) const

returns the direction of projection β€” aka the direction the camera is pointing. where she's looking, that's the vibe check result ✨

  • See also: getNearDist().

double SbDPViewVolume::getNearDist (void ) const

returns the distance from the projection plane to the near clipping plane. close-up energy πŸ“

  • See also: getProjectionDirection().

double SbDPViewVolume::getWidth (void ) const

returns the width of the viewing frustum in the projection plane. horizontally speaking πŸ’–

  • See also: getHeight(), getDepth().

double SbDPViewVolume::getHeight (void ) const

returns the height of the viewing frustum in the projection plane. vertically speaking 🌈

  • 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. the full range, front to back, no notes πŸ’œ

  • See also: getWidth(), getHeight().

void SbDPViewVolume::print (FILE * fp) const

dumps the state of this object to the file stream. ⚠️ but bestie, this only works in the debug version of the library β€” in an optimized compile, the method does absolutely nothing. so if you're getting silence, it's not ghosting you, it's just optimized 😭

void SbDPViewVolume::getViewVolumePlanes (SbPlane planes[6]) const

returns the six planes defining the view volume, in exactly this order: left, bottom, right, top, near, far. plane normals are directed into the view volume. memorise the order, it's the whole assignment πŸ“š

this method is an extension for Coin, and is not available in the original Open Inventor. homegrown, exclusive, one of a kind πŸ’…

void SbDPViewVolume::transform (const SbDPMatrix & matrix)

transforms the viewing volume by matrix. glow-up applied ✨

SbVec3d SbDPViewVolume::getViewUp (void ) const

returns the view up vector for this view volume. it's a vector that's 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, no cap 🫢


πŸ“œ AUTHOR πŸ“œ

Generated automatically by Doxygen for Coin from the source code. (yes bestie, a robot wrote the boring bits and I did the ✨delivery✨)


and that's the whole page, start to finish, no crumbs left πŸ’– this was written for Coin Version 3.1.3, on the SbDPViewVolume(3) page β€” if you ever need her again she's filed right there under that name. go forth and project things, you absolute icon πŸ‘‘βœ¨

πŸ“¦ where this page comes from