Visualization Library 2.1.0
A lightweight C++ OpenGL middleware for 2D/3D graphics
|
[Download] [Tutorials] [All Classes] [Grouped Classes] |
The AABB class implements an axis-aligned bounding box using vl::real precision. More...
#include <AABB.hpp>
Public Member Functions | |
AABB () | |
Constructs a null AABB. More... | |
AABB (const vec3 ¢er, real radius) | |
Constructs an AABB large enough to contain a sphere with the specified radius and center . More... | |
AABB (const vec3 &pt1, const vec3 &pt2, real displace=0) | |
Constructs an AABB large enough to contain the two specified points and enlarged by the amount specified by displace . More... | |
void | setNull () |
Sets ths AABB as null, that is, empty. More... | |
bool | isNull () const |
Returns true if the AABB is null. More... | |
bool | isPoint () const |
Returns true if the AABB contains a single point, that is, if the min and max corners of the AABB are equal. More... | |
void | enlarge (real displace) |
Enlarges the AABB in all directions by displace amount. More... | |
bool | intersects (const AABB &bb) const |
Returns true if an AABB intersects with the given AABB. More... | |
vec3 | clip (const vec3 &p, bool clipx=true, bool clipy=true, bool clipz=true) const |
Clips the position of the given p point to be inside an AABB. More... | |
bool | isInside (const vec3 &p, bool clipx, bool clipy, bool clipz) const |
Returns true if the given point is inside the AABB. More... | |
bool | isInside (const vec3 &p) const |
Returns true if the given point is inside the AABB. More... | |
real | width () const |
Returns the width of the AABB computed as max.x - min.x. More... | |
real | height () const |
Returns the height of the AABB computed as max.y - min.y. More... | |
real | depth () const |
Returns the depth of the AABB computed as max.z - min.z. More... | |
bool | operator== (const AABB &aabb) const |
Returns true if two AABB are identical. More... | |
bool | operator!= (const AABB &aabb) const |
Returns true if two AABB are not identical. More... | |
AABB | operator+ (const AABB &aabb) const |
Returns an AABB which contains the two source AABB. More... | |
AABB & | operator+= (const AABB &other) |
Enlarges (if necessary) an AABB so that it contains the given AABB. More... | |
AABB | operator+ (const vec3 &p) |
Returns an AABB which contains the source AABB and the given point. More... | |
const AABB & | operator+= (const vec3 &p) |
Enlarges (if necessary) an AABB to contain the given point. More... | |
vec3 | center () const |
Returns the center of the AABB. More... | |
real | longestSideLength () const |
Returns the longest dimension of the AABB. More... | |
void | addPoint (const vec3 &p, real radius) |
Updates the AABB to contain the given point. More... | |
void | addPoint (const vec3 &p) |
Updates the AABB to contain the given point. More... | |
void | transformed (AABB &out, const mat4 &mat) const |
Transforms an AABB by the given matrix and returns it into the out parameter. More... | |
AABB | transformed (const mat4 &mat) const |
Returns the AABB transformed by the given matrix. More... | |
const vec3 & | minCorner () const |
Returns the corner of the AABB with the minimum x y z coordinates. More... | |
const vec3 & | maxCorner () const |
Returns the corner of the AABB with the maximum x y z coordinates. More... | |
void | setMinCorner (real x, real y, real z) |
Sets the corner of the AABB with the minimum x y z coordinates. More... | |
void | setMinCorner (const vec3 &v) |
Sets the corner of the AABB with the minimum x y z coordinates. More... | |
void | setMaxCorner (real x, real y, real z) |
Sets the corner of the AABB with the maximum x y z coordinates. More... | |
void | setMaxCorner (const vec3 &v) |
Sets the corner of the AABB with the maximum x y z coordinates. More... | |
real | volume () const |
Returns the volume of the AABB. More... | |
Protected Attributes | |
vec3 | mMin |
vec3 | mMax |
The AABB class implements an axis-aligned bounding box using vl::real precision.
AABB::AABB | ( | ) |
AABB::AABB | ( | const vec3 & | center, |
real | radius | ||
) |
Constructs an AABB large enough to contain the two specified points and enlarged by the amount specified by displace
.
Definition at line 50 of file AABB.cpp.
References mMax, mMin, vl::Vector3< T_Scalar >::x(), vl::Vector3< T_Scalar >::y(), and vl::Vector3< T_Scalar >::z().
void AABB::addPoint | ( | const vec3 & | p, |
real | radius | ||
) |
Updates the AABB to contain the given point.
The point can represent a sphere if radius
> 0.
Definition at line 135 of file AABB.cpp.
References isNull(), mMax, mMin, vl::Vector3< T_Scalar >::x(), vl::Vector3< T_Scalar >::y(), and vl::Vector3< T_Scalar >::z().
Referenced by vl::Text::boundingRectTransformed(), vl::PixelLODEvaluator::evaluate(), operator+(), vl::VectorGraphics::popScissor(), vl::Text::rawboundingRect(), vl::CoreText::rawboundingRect(), and transformed().
|
inline |
Updates the AABB to contain the given point.
Definition at line 147 of file AABB.hpp.
References vl::Vector3< T_Scalar >::x(), vl::Vector3< T_Scalar >::y(), and vl::Vector3< T_Scalar >::z().
vec3 AABB::center | ( | ) | const |
Returns the center of the AABB.
Definition at line 184 of file AABB.cpp.
References maxCorner(), and minCorner().
Referenced by vl::TrackballManipulator::adjustView(), vl::Camera::adjustView(), vl::Array< bvec2, GLbyte, 2, GL_BYTE >::computeBoundingSphere(), vl::SceneManager::computeBounds(), vl::Geometry::computeBounds_Implementation(), vl::DistanceLODEvaluator::evaluate(), vl::Molecule::generateRings(), vl::RingExtractor::keepPlanarCycles(), vl::makeTeapot(), vl::Sphere::operator=(), and vl::RenderQueue::sort().
Clips the position of the given p
point to be inside an AABB.
Definition at line 92 of file AABB.cpp.
References isNull(), mMax, mMin, vl::Vector3< T_Scalar >::x(), vl::Vector3< T_Scalar >::y(), and vl::Vector3< T_Scalar >::z().
Referenced by isInside().
real AABB::depth | ( | ) | const |
void AABB::enlarge | ( | real | displace | ) |
real AABB::height | ( | ) | const |
Returns the height of the AABB computed as max.y - min.y.
Definition at line 158 of file AABB.cpp.
References isNull(), mMax, mMin, and vl::Vector3< T_Scalar >::y().
Referenced by vl::Text::boundingRect(), vl::CoreText::boundingRect(), vl::PixelLODEvaluator::evaluate(), and vl::VectorGraphics::popScissor().
bool AABB::intersects | ( | const AABB & | bb | ) | const |
Returns true if an AABB intersects with the given AABB.
Definition at line 72 of file AABB.cpp.
References isNull(), mMax, mMin, vl::Vector3< T_Scalar >::x(), and vl::Vector3< T_Scalar >::z().
bool AABB::isInside | ( | const vec3 & | p, |
bool | clipx, | ||
bool | clipy, | ||
bool | clipz | ||
) | const |
Returns true if the given point is inside the AABB.
This method allows you to restrict the test to any of the x, y, z axes.
Definition at line 122 of file AABB.cpp.
References clip().
Referenced by vl::OcclusionCullRenderer::render_pass2().
bool AABB::isInside | ( | const vec3 & | p | ) | const |
Returns true if the given point is inside the AABB.
Definition at line 128 of file AABB.cpp.
References maxCorner(), minCorner(), vl::Vector3< T_Scalar >::x(), vl::Vector3< T_Scalar >::y(), and vl::Vector3< T_Scalar >::z().
|
inline |
Returns true if the AABB is null.
Definition at line 60 of file AABB.hpp.
Referenced by addPoint(), vl::TrackballManipulator::adjustView(), vl::Camera::adjustView(), clip(), vl::Actor::computeBounds(), vl::Frustum::cull(), depth(), enlarge(), height(), intersects(), operator+(), vl::Sphere::operator=(), vl::RenderQueue::sort(), and width().
|
inline |
|
inline |
|
inline |
Returns the corner of the AABB with the maximum x y z coordinates.
Definition at line 193 of file AABB.hpp.
Referenced by vl::Text::boundingRect(), vl::CoreText::boundingRect(), vl::Text::boundingRectTransformed(), center(), vl::Plane::classify(), vl::PixelLODEvaluator::evaluate(), vlX::export_AABB(), isInside(), vl::Plane::isOutside(), vl::makeBox(), vl::Sphere::operator=(), vl::OcclusionCullRenderer::render_pass2(), vl::CoreText::renderBackground(), vl::CoreText::renderBorder(), vl::Text::renderText(), vl::CoreText::renderText(), and vl::RaycastVolume::setBox().
|
inline |
Returns the corner of the AABB with the minimum x y z coordinates.
Definition at line 190 of file AABB.hpp.
Referenced by vl::Text::boundingRect(), vl::CoreText::boundingRect(), vl::Text::boundingRectTransformed(), center(), vl::Plane::classify(), vl::PixelLODEvaluator::evaluate(), vlX::export_AABB(), isInside(), vl::Plane::isOutside(), vl::makeBox(), vl::Sphere::operator=(), vl::VectorGraphics::popScissor(), vl::OcclusionCullRenderer::render_pass2(), vl::CoreText::renderBackground(), vl::CoreText::renderBorder(), vl::Text::renderText(), vl::CoreText::renderText(), and vl::RaycastVolume::setBox().
|
inline |
Returns true if two AABB are not identical.
Definition at line 98 of file AABB.hpp.
References vl::operator+(), and vl::operator==().
|
inline |
|
inline |
Sets the corner of the AABB with the maximum x y z coordinates.
Definition at line 202 of file AABB.hpp.
Referenced by vl::Text::boundingRect(), vl::CoreText::boundingRect(), vlX::import_AABB(), vl::Terrain::init(), and vl::CoreText::renderText().
|
inline |
|
inline |
Sets the corner of the AABB with the minimum x y z coordinates.
Definition at line 196 of file AABB.hpp.
Referenced by vl::Text::boundingRect(), vl::CoreText::boundingRect(), vlX::import_AABB(), and vl::Terrain::init().
|
inline |
|
inline |
Sets ths AABB as null, that is, empty.
Definition at line 57 of file AABB.hpp.
Referenced by AABB(), vl::Text::boundingRectTransformed(), vl::SceneManager::computeBounds(), vl::PixelLODEvaluator::evaluate(), vl::ActorKdTree::harvestNonLeafActors(), vl::ActorKdTree::rebuildKdTree(), and transformed().
Transforms an AABB by the given matrix and returns it into the out
parameter.
Definition at line 165 of file AABB.hpp.
References addPoint(), and setNull().
Referenced by vl::Actor::computeBounds(), and vl::PixelLODEvaluator::evaluate().
|
inline |
Returns the volume of the AABB.
Definition at line 208 of file AABB.hpp.
Referenced by vl::ActorKdTree::rebuildKdTree().
real AABB::width | ( | ) | const |
Returns the width of the AABB computed as max.x - min.x.
Definition at line 151 of file AABB.cpp.
References isNull(), mMax, mMin, and vl::Vector3< T_Scalar >::x().
Referenced by vl::Text::boundingRect(), vl::CoreText::boundingRect(), vl::PixelLODEvaluator::evaluate(), vl::makeTeapot(), vl::VectorGraphics::popScissor(), vl::Text::renderText(), and vl::CoreText::renderText().
|
protected |
Definition at line 212 of file AABB.hpp.
Referenced by AABB(), addPoint(), clip(), depth(), enlarge(), height(), intersects(), operator+(), operator==(), and width().
|
protected |
Definition at line 211 of file AABB.hpp.
Referenced by AABB(), addPoint(), clip(), depth(), enlarge(), height(), intersects(), operator+(), operator==(), and width().
Visualization Library 2.1.0 Reference Documentation
Updated on Wed Mar 10 2021 16:02:46.
© Copyright Michele Bosi. All rights reserved.