Visualization Library v1.0.3A 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. | |
AABB (const vec3 ¢er, real radius) | |
Constructs an AABB large enough to contain a sphere with the specified radius and center . | |
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 . | |
void | setNull () |
Sets ths AABB as null, that is, empty. | |
bool | isNull () const |
Returns true if the AABB is null. | |
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. | |
void | enlarge (real displace) |
Enlarges the AABB in all directions by displace amount. | |
bool | intersects (const AABB &bb) const |
Returns true if an AABB intersects with the given AABB. | |
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. | |
bool | isInside (const vec3 &p, bool clipx, bool clipy, bool clipz) const |
Returns true if the given point is inside the AABB. | |
bool | isInside (const vec3 &p) const |
Returns true if the given point is inside the AABB. | |
real | width () const |
Returns the width of the AABB computed as max.x - min.x. | |
real | height () const |
Returns the height of the AABB computed as max.y - min.y. | |
real | depth () const |
Returns the depth of the AABB computed as max.z - min.z. | |
bool | operator== (const AABB &aabb) const |
Returns true if two AABB are identical. | |
bool | operator!= (const AABB &aabb) const |
Returns true if two AABB are not identical. | |
AABB | operator+ (const AABB &aabb) const |
Returns an AABB which contains the two source AABB. | |
AABB & | operator+= (const AABB &other) |
Enlarges (if necessary) an AABB so that it contains the given AABB. | |
AABB | operator+ (const vec3 &p) |
Returns an AABB which contains the source AABB and the given point. | |
const AABB & | operator+= (const vec3 &p) |
Enlarges (if necessary) an AABB to contain the given point. | |
vec3 | center () const |
Returns the center of the AABB. | |
real | longestSideLength () const |
Returns the longest dimension of the AABB. | |
void | addPoint (const vec3 &p, real radius) |
Updates the AABB to contain the given point. | |
void | addPoint (const vec3 &p) |
Updates the AABB to contain the given point. | |
void | transformed (AABB &out, const mat4 &mat) const |
Transforms an AABB by the given matrix and returns it into the out parameter. | |
AABB | transformed (const mat4 &mat) const |
Returns the AABB transformed by the given matrix. | |
const vec3 & | minCorner () const |
Returns the corner of the AABB with the minimum x y z coordinates. | |
const vec3 & | maxCorner () const |
Returns the corner of the AABB with the maximum x y z coordinates. | |
void | setMinCorner (real x, real y, real z) |
Sets the corner of the AABB with the minimum x y z coordinates. | |
void | setMinCorner (const vec3 &v) |
Sets the corner of the AABB with the minimum x y z coordinates. | |
void | setMaxCorner (real x, real y, real z) |
Sets the corner of the AABB with the maximum x y z coordinates. | |
void | setMaxCorner (const vec3 &v) |
Sets the corner of the AABB with the maximum x y z coordinates. | |
real | volume () const |
Returns the volume of the AABB. | |
Protected Attributes | |
vec3 | mMin |
vec3 | mMax |
The AABB class implements an axis-aligned bounding box using vl::real precision.
Definition at line 44 of file AABB.hpp.
AABB::AABB | ( | ) |
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 vl::AABB::setNull | ( | ) | [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(), and transformed().
bool vl::AABB::isNull | ( | ) | const [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().
bool vl::AABB::isPoint | ( | ) | const [inline] |
void AABB::enlarge | ( | real | displace ) |
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().
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().
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().
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::Text::renderText(), and vl::CoreText::renderText().
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(), and vl::PixelLODEvaluator::evaluate().
real AABB::depth | ( | ) | const |
bool vl::AABB::operator== | ( | const AABB & | aabb ) | const [inline] |
bool vl::AABB::operator!= | ( | const AABB & | aabb ) | const [inline] |
Returns true if two AABB are not identical.
Definition at line 98 of file AABB.hpp.
References vl::operator==().
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::Sphere::operator=(), and vl::RenderQueue::sort().
real vl::AABB::longestSideLength | ( | ) | const [inline] |
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::Text::rawboundingRect(), vl::CoreText::rawboundingRect(), and transformed().
void vl::AABB::addPoint | ( | const vec3 & | p ) | [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().
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().
const vec3& vl::AABB::minCorner | ( | ) | const [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(), vl::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().
const vec3& vl::AABB::maxCorner | ( | ) | const [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(), vl::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().
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(), vl::import_AABB(), and vl::Terrain::init().
void vl::AABB::setMinCorner | ( | const vec3 & | v ) | [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(), vl::import_AABB(), vl::Terrain::init(), and vl::CoreText::renderText().
void vl::AABB::setMaxCorner | ( | const vec3 & | v ) | [inline] |
real vl::AABB::volume | ( | ) | const [inline] |
vec3 vl::AABB::mMin [protected] |
Definition at line 211 of file AABB.hpp.
Referenced by AABB(), addPoint(), clip(), depth(), enlarge(), height(), intersects(), operator+(), operator==(), and width().
vec3 vl::AABB::mMax [protected] |
Definition at line 212 of file AABB.hpp.
Referenced by AABB(), addPoint(), clip(), depth(), enlarge(), height(), intersects(), operator+(), operator==(), and width().