Visualization Library v1.0.3

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Public Member Functions | Protected Attributes

vl::AABB Class Reference

The AABB class implements an axis-aligned bounding box using vl::real precision. More...

#include <AABB.hpp>

List of all members.

Public Member Functions

 AABB ()
 Constructs a null AABB.
 AABB (const vec3 &center, 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.
AABBoperator+= (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 AABBoperator+= (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 vec3minCorner () const
 Returns the corner of the AABB with the minimum x y z coordinates.
const vec3maxCorner () 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

Detailed Description

The AABB class implements an axis-aligned bounding box using vl::real precision.

Definition at line 44 of file AABB.hpp.


Constructor & Destructor Documentation

AABB::AABB (  )

Constructs a null AABB.

Definition at line 39 of file AABB.cpp.

References setNull().

AABB::AABB ( const vec3 center,
real  radius 
)

Constructs an AABB large enough to contain a sphere with the specified radius and center.

Definition at line 44 of file AABB.cpp.

References mMax, and mMin.

AABB::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.

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().


Member Function Documentation

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]
bool vl::AABB::isPoint (  ) const [inline]

Returns true if the AABB contains a single point, that is, if the min and max corners of the AABB are equal.

Definition at line 63 of file AABB.hpp.

void AABB::enlarge ( real  displace )

Enlarges the AABB in all directions by displace amount.

As a result every edge of the AABB will be displace*2 longer.

Definition at line 64 of file AABB.cpp.

References isNull(), mMax, and mMin.

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().

vec3 AABB::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.

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

Returns the depth of the AABB computed as max.z - min.z.

Definition at line 165 of file AABB.cpp.

References isNull(), mMax, mMin, and vl::Vector3< T_Scalar >::z().

bool vl::AABB::operator== ( const AABB aabb ) const [inline]

Returns true if two AABB are identical.

Definition at line 92 of file AABB.hpp.

References mMax, and mMin.

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==().

AABB AABB::operator+ ( const AABB aabb ) const

Returns an AABB which contains the two source AABB.

Definition at line 172 of file AABB.cpp.

References addPoint(), isNull(), mMax, and mMin.

AABB& vl::AABB::operator+= ( const AABB other ) [inline]

Enlarges (if necessary) an AABB so that it contains the given AABB.

Definition at line 107 of file AABB.hpp.

AABB vl::AABB::operator+ ( const vec3 p ) [inline]

Returns an AABB which contains the source AABB and the given point.

Definition at line 114 of file AABB.hpp.

const AABB& vl::AABB::operator+= ( const vec3 p ) [inline]

Enlarges (if necessary) an AABB to contain the given point.

Definition at line 122 of file AABB.hpp.

vec3 AABB::center (  ) const
real vl::AABB::longestSideLength (  ) const [inline]

Returns the longest dimension of the AABB.

Definition at line 132 of file AABB.hpp.

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::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().

void vl::AABB::transformed ( AABB out,
const mat4 mat 
) const [inline]

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().

AABB vl::AABB::transformed ( const mat4 mat ) const [inline]

Returns the AABB transformed by the given matrix.

Definition at line 182 of file AABB.hpp.

const vec3& vl::AABB::minCorner (  ) const [inline]
const vec3& vl::AABB::maxCorner (  ) const [inline]
void vl::AABB::setMinCorner ( real  x,
real  y,
real  z 
) [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(), vl::import_AABB(), and vl::Terrain::init().

void vl::AABB::setMinCorner ( const vec3 v ) [inline]

Sets the corner of the AABB with the minimum x y z coordinates.

Definition at line 199 of file AABB.hpp.

void vl::AABB::setMaxCorner ( real  x,
real  y,
real  z 
) [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]

Sets the corner of the AABB with the maximum x y z coordinates.

Definition at line 205 of file AABB.hpp.

real vl::AABB::volume (  ) const [inline]

Returns the volume of the AABB.

Definition at line 208 of file AABB.hpp.


Member Data Documentation

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().


The documentation for this class was generated from the following files:

Visualization Library v1.0.3 Reference Documentation
Copyright Michele Bosi. All rights reserved.
Updated on Tue Feb 7 2017 00:55:06.
Permission is granted to use this page to write and publish articles regarding Visualization Library.