SbViewVolume(3)
๐ SbViewVolume(3) ๐
Library Functions Manual โ SbViewVolume
okay bestie, sit down, hydrate, because we're about to get into the 3D math and honestly? it's giving iconic ๐
โจ NAME โจ
SbViewVolume โ the SbViewVolume class is a viewing volume in 3D space.
๐ SYNOPSIS ๐
#include <Inventor/SbLinear.h>
๐ Public Types
enum ProjectionType { ORTHOGRAPHIC = 0, PERSPECTIVE = 1 }
๐ฆ Public Member Functions
SbViewVolume (void)~SbViewVolume (void)void getMatrices (SbMatrix &affine, SbMatrix &proj) constSbMatrix getMatrix (void) constSbMatrix getCameraSpaceMatrix (void) constvoid projectPointToLine (const SbVec2f &pt, SbLine &line) constvoid projectPointToLine (const SbVec2f &pt, SbVec3f &line0, SbVec3f &line1) constvoid projectToScreen (const SbVec3f &src, SbVec3f &dst) constSbPlane getPlane (const float distFromEye) constSbVec3f getSightPoint (const float distFromEye) constSbVec3f getPlanePoint (const float distFromEye, const SbVec2f &normPoint) constSbRotation getAlignRotation (SbBool rightAngleOnly=FALSE) constfloat getWorldToScreenScale (const SbVec3f &worldCenter, float normRadius) constSbVec2f projectBox (const SbBox3f &box) constSbViewVolume narrow (float left, float bottom, float right, float top) constSbViewVolume narrow (const SbBox3f &box) constvoid 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) constSbViewVolume zNarrow (float nearval, float farval) constvoid scale (float factor)void scaleWidth (float ratio)void scaleHeight (float ratio)ProjectionType getProjectionType (void) constconst SbVec3f & getProjectionPoint (void) constconst SbVec3f & getProjectionDirection (void) constfloat getNearDist (void) constfloat getWidth (void) constfloat getHeight (void) constfloat getDepth (void) constvoid print (FILE *fp) constvoid getViewVolumePlanes (SbPlane planes[6]) constvoid transform (const SbMatrix &matrix)SbVec3f getViewUp (void) constSbBool intersect (const SbVec3f &p) constSbBool intersect (const SbVec3f &p0, const SbVec3f &p1, SbVec3f &closestpoint) constSbBool intersect (const SbBox3f &box) constSbBool outsideTest (const SbPlane &p, const SbVec3f &bmin, const SbVec3f &bmax) constconst SbDPViewVolume & getDPViewVolume (void) const
๐ Public Attributes
ProjectionType typeSbVec3f projPointSbVec3f projDirfloat nearDistfloat nearToFarSbVec3f llfSbVec3f lrfSbVec3f ulf
๐ธ Detailed Description ๐ธ
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.
See also
SbViewportRegion
๐ฅ Member Enumeration Documentation ๐ฅ
โญ enum SbViewVolume::ProjectionType
An SbViewVolume instance can represent either an orthogonal projection volume or a perspective projection volume.
See also
ortho(),perspective(),getProjectionType().
Enumerator
ORTHOGRAPHICโ Orthographic projection. โจPERSPECTIVEโ Perspective projection. ๐ฆ
๐ Constructor & Destructor Documentation ๐
๐ SbViewVolume::SbViewVolume (void )
Constructor. Heads up bestie โ this is the important part: the SbViewVolume instance will be uninitialized until you explicitly call ortho() or perspective(). no cap, don't be out here using it before that or it's giving chaos ๐ญ
See also
ortho(),perspective().
๐ SbViewVolume::~SbViewVolume (void )
Destructor. ๐ซถ
๐ Member Function Documentation ๐
void SbViewVolume::getMatrices (SbMatrix & affine, SbMatrix & proj) const
okay so bestie, this one is giving โgive me both matrices at once.โ It hands you the view volumeโs affine matrix and projection matrix, and you pass in affine and proj as references so they can be filled. No return value, just vibes.
- โจ See also:
getMatrix(),getCameraSpaceMatrix()
SbMatrix SbViewVolume::getMatrix (void ) const
Returns the combined affine and projection matrix. Like, one matrix that ate and left no crumbs. ๐
- โจ 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. Itโs giving โreset the camera to home base.โ ๐
๐ Note: the 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).
- โจ 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]. So like, keep it in the box, bestie. ๐ฆ
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. Two points, one line, iconic. โจ
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 โ no clone needed, they can share. ๐ซถ
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. Itโs giving โplane parallel to the clipping planes, but make it opposite direction.โ ๐
- โจ 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. Basically the point straight ahead at distFromEye. ๐
- โจ 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].
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.
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. Default is FALSE, so if you donโt say anything, itโs not right-angle-only. ๐
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 girlies rise. ๐งฎโจ
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. Slay.
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);
- โจ 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. So z is like a depth dial. ๐๏ธ
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]
- โจ 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. Perspective? Sheโs giving depth. ๐ฅ
- โจ 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.
๐ This function is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API.
Since: Coin 2.0
- โจ See also:
perspective()
void SbViewVolume::rotateCamera (const SbRotation & q)
Rotate the direction which the camera is pointing in. Camera spin, no cap. ๐
- โจ See also:
translateCamera().
void SbViewVolume::translateCamera (const SbVec3f & v)
Translate the camera position of the view volume. Camera slide to the left, camera slide to the right. ๐บ
- โจ 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 vibes. ๐
- โจ 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.
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 SbViewVolume::scale (float factor)
Scale width and height of viewing frustum by the given ratio around the projection plane center axis. Itโs giving โzoom but for the frustum.โ ๐
- โจ 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 go brrr. ๐
- โจ 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 go brrr. ๐
- โจ See also:
scale(),scaleWidth().
SbViewVolume::ProjectionType SbViewVolume::getProjectionType (void ) const
Return current view volume projection type, which can be either ORTHOGRAPHIC or PERSPECTIVE. Which one are you? ๐
- โจ See also:
SbViewVolume::ProjectionType
const SbVec3f & SbViewVolume::getProjectionPoint (void ) const
Returns the projection point, i.e. the camera position. Where the camera at? Right here. ๐
const SbVec3f & SbViewVolume::getProjectionDirection (void ) const
Returns the direction of projection, i.e. the direction the camera is pointing. Camera gaze direction. ๐๏ธ
- โจ See also:
getNearDist().
float SbViewVolume::getNearDist (void ) const
Returns distance from projection plane to near clipping plane. Near distance, not far distance. Bestie, keep up. ๐
- โจ See also:
getProjectionDirection().
float SbViewVolume::getWidth (void ) const
Returns width of viewing frustum in the projection plane. Width. Thatโs it. Thatโs the tweet. ๐ฆ
- โจ See also:
getHeight(),getDepth().
float SbViewVolume::getHeight (void ) const
Returns height of viewing frustum in the projection plane. Height. Vertical moment. โฌ๏ธ
- โจ 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 final frontier. ๐
- โจ See also:
getWidth(),getHeight().
void SbViewVolume::print (FILE * fp) const
Dump the state of this object to the file stream. Only works in debug version of library, method does nothing in an optimized compile. So if youโre optimized, this is a no-op, bestie. ๐
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.
๐ This method is an extension for Coin, and is not available in the original Open Inventor.
void SbViewVolume::transform (const SbMatrix & matrix)
Transform the viewing volume by matrix. Matrix go brrr. ๐ฅ
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 is up. โฌ๏ธโจ
SbBool SbViewVolume::intersect (const SbVec3f & p) const
Returns TRUE if p is inside the view volume. Inside? TRUE. Outside? Not today. ๐ช
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โs not 100% certain that the line segment intersects the volume even if this function returns TRUE.
closestpoint is set to the closest point on the line to the center ray of the view volume.
Since: Coin 2.3
SbBool SbViewVolume::intersect (const SbBox3f & box) const
Returns TRUE if box may be inside the view volume. May be. No promises. ๐
Since: Coin 2.3
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. Eight corners, all outside? Then TRUE, bestie.
const SbDPViewVolume & SbViewVolume::getDPViewVolume (void ) const
Returns the double precision version of this view volume. Double the precision, double the fun. ๐
๐ซถ Member Data Documentation ๐ซถ
Okay bestie, gather round. These are the data members of SbViewVolume, and every single one is tagged as internal to the library. That means the library considers them not likely to be of interest to the application programmer. Not me making it up โ that's the official vibe. But because we're completionists, here's the whole roster, no skips. ๐
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. ๐
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. โจ
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. ๐ฆ
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. ๐ธ
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. ๐
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. ๐
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. ๐
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. โญ
๐ Author ๐
Okay so this page? Generated automatically by Doxygen for Coin from the source code. So like, not a human author, just Doxygen doing its thing for Coin. ๐คโจ
Vibe check on the footer: source is Coin, version is Version 3.1.3, and the page is SbViewVolume(3). There's no date in the footer, bestie โ so we're not gonna invent one. Periodt. ๐
โจ
๐ฆ where this page comes from
- fedora 43: Coin3-devel 3.1.3-40.fc43 ยท GPL-2.0-only
- fedora 43: Coin3-devel 3.1.3-40.fc43 ยท GPL-2.0-only
- fedora 44: Coin3-devel 3.1.3-42.fc44 ยท GPL-2.0-only
- fedora 44: Coin3-devel 3.1.3-42.fc44 ยท GPL-2.0-only
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms