NVIDIA OptiX 6.5 API nvidia_logo_transpbg.gif Up
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
optix::Aabb Class Reference

Public Member Functions

RT_HOSTDEVICE Aabb ()
 
RT_HOSTDEVICE Aabb (const float3 &min, const float3 &max)
 
RT_HOSTDEVICE Aabb (const float3 &v0, const float3 &v1, const float3 &v2)
 
RT_HOSTDEVICE bool operator== (const Aabb &other) const
 
RT_HOSTDEVICE float3 & operator[] (int i)
 
RT_HOSTDEVICE const float3 & operator[] (int i) const
 
RT_HOSTDEVICE void set (const float3 &min, const float3 &max)
 
RT_HOSTDEVICE void set (const float3 &v0, const float3 &v1, const float3 &v2)
 
RT_HOSTDEVICE void invalidate ()
 
RT_HOSTDEVICE bool valid () const
 
RT_HOSTDEVICE bool contains (const float3 &p) const
 
RT_HOSTDEVICE bool contains (const Aabb &bb) const
 
RT_HOSTDEVICE void include (const float3 &p)
 
RT_HOSTDEVICE void include (const Aabb &other)
 
RT_HOSTDEVICE void include (const float3 &min, const float3 &max)
 
RT_HOSTDEVICE float3 center () const
 
RT_HOSTDEVICE float center (int dim) const
 
RT_HOSTDEVICE float3 extent () const
 
RT_HOSTDEVICE float extent (int dim) const
 
RT_HOSTDEVICE float volume () const
 
RT_HOSTDEVICE float area () const
 
RT_HOSTDEVICE float halfArea () const
 
RT_HOSTDEVICE int longestAxis () const
 
RT_HOSTDEVICE float maxExtent () const
 
RT_HOSTDEVICE bool intersects (const Aabb &other) const
 
RT_HOSTDEVICE void intersection (const Aabb &other)
 
RT_HOSTDEVICE void enlarge (float amount)
 
RT_HOSTDEVICE bool isFlat () const
 
RT_HOSTDEVICE float distance (const float3 &x) const
 
RT_HOSTDEVICE float distance2 (const float3 &x) const
 
RT_HOSTDEVICE float signedDistance (const float3 &x) const
 

Public Attributes

float3 m_min
 
float3 m_max
 

Detailed Description

Axis-aligned bounding box.

Description

Aabb is a utility class for computing and manipulating axis-aligned bounding boxes (aabbs). Aabb is primarily useful in the bounding box program associated with geometry objects. Aabb may also be useful in other computation and can be used in both host and device code.

History

Aabb was introduced in OptiX 1.0.

See also RT_PROGRAM, rtGeometrySetBoundingBoxProgram

Constructor & Destructor Documentation

OPTIXU_INLINE RT_HOSTDEVICE optix::Aabb::Aabb ( )

Construct an invalid box

OPTIXU_INLINE RT_HOSTDEVICE optix::Aabb::Aabb ( const float3 &  min,
const float3 &  max 
)

Construct from min and max vectors

OPTIXU_INLINE RT_HOSTDEVICE optix::Aabb::Aabb ( const float3 &  v0,
const float3 &  v1,
const float3 &  v2 
)

Construct from three points (e.g. triangle)

Member Function Documentation

OPTIXU_INLINE RT_HOSTDEVICE float optix::Aabb::area ( ) const

Compute the surface area of the box

OPTIXU_INLINE RT_HOSTDEVICE float3 optix::Aabb::center ( ) const

Compute the box center

OPTIXU_INLINE RT_HOSTDEVICE float optix::Aabb::center ( int  dim) const

Compute the box center in the given dimension

OPTIXU_INLINE RT_HOSTDEVICE bool optix::Aabb::contains ( const float3 &  p) const

Check if the point is in the box

OPTIXU_INLINE RT_HOSTDEVICE bool optix::Aabb::contains ( const Aabb bb) const

Check if the box is fully contained in the box

OPTIXU_INLINE RT_HOSTDEVICE float optix::Aabb::distance ( const float3 &  x) const

Compute the minimum Euclidean distance from a point on the surface of this Aabb to the point of interest

OPTIXU_INLINE RT_HOSTDEVICE float optix::Aabb::distance2 ( const float3 &  x) const

Compute the minimum squared Euclidean distance from a point on the surface of this Aabb to the point of interest

OPTIXU_INLINE RT_HOSTDEVICE void optix::Aabb::enlarge ( float  amount)

Enlarge the box by moving both min and max by 'amount'

OPTIXU_INLINE RT_HOSTDEVICE float3 optix::Aabb::extent ( ) const

Compute the box extent

OPTIXU_INLINE RT_HOSTDEVICE float optix::Aabb::extent ( int  dim) const

Compute the box extent in the given dimension

OPTIXU_INLINE RT_HOSTDEVICE float optix::Aabb::halfArea ( ) const

Compute half the surface area of the box

OPTIXU_INLINE RT_HOSTDEVICE void optix::Aabb::include ( const float3 &  p)

Extend the box to include the given point

OPTIXU_INLINE RT_HOSTDEVICE void optix::Aabb::include ( const Aabb other)

Extend the box to include the given box

OPTIXU_INLINE RT_HOSTDEVICE void optix::Aabb::include ( const float3 &  min,
const float3 &  max 
)

Extend the box to include the given box

OPTIXU_INLINE RT_HOSTDEVICE void optix::Aabb::intersection ( const Aabb other)

Make the current box be the intersection between this one and another one

OPTIXU_INLINE RT_HOSTDEVICE bool optix::Aabb::intersects ( const Aabb other) const

Check for intersection with another box

OPTIXU_INLINE RT_HOSTDEVICE void optix::Aabb::invalidate ( )

Invalidate the box

OPTIXU_INLINE RT_HOSTDEVICE bool optix::Aabb::isFlat ( ) const

Check if the box is flat in at least one dimension

OPTIXU_INLINE RT_HOSTDEVICE int optix::Aabb::longestAxis ( ) const

Get the index of the longest axis

OPTIXU_INLINE RT_HOSTDEVICE float optix::Aabb::maxExtent ( ) const

Get the extent of the longest axis

OPTIXU_INLINE RT_HOSTDEVICE bool optix::Aabb::operator== ( const Aabb other) const

Exact equality

OPTIXU_INLINE RT_HOSTDEVICE float3 & optix::Aabb::operator[] ( int  i)

Array access

OPTIXU_INLINE RT_HOSTDEVICE const float3 & optix::Aabb::operator[] ( int  i) const

Const array access

OPTIXU_INLINE RT_HOSTDEVICE void optix::Aabb::set ( const float3 &  min,
const float3 &  max 
)

Set using two vectors

OPTIXU_INLINE RT_HOSTDEVICE void optix::Aabb::set ( const float3 &  v0,
const float3 &  v1,
const float3 &  v2 
)

Set using three points (e.g. triangle)

OPTIXU_INLINE RT_HOSTDEVICE float optix::Aabb::signedDistance ( const float3 &  x) const

Compute the minimum Euclidean distance from a point on the surface of this Aabb to the point of interest. If the point of interest lies inside this Aabb, the result is negative

OPTIXU_INLINE RT_HOSTDEVICE bool optix::Aabb::valid ( ) const

Check if the box is valid

OPTIXU_INLINE RT_HOSTDEVICE float optix::Aabb::volume ( ) const

Compute the volume of the box

Member Data Documentation

float3 optix::Aabb::m_max

Max bound

float3 optix::Aabb::m_min

Min bound