HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ImathBoxAlgo.h File Reference
#include "ImathNamespace.h"
#include "ImathBox.h"
#include "ImathLineAlgo.h"
#include "ImathMatrix.h"
#include "ImathPlane.h"
+ Include dependency graph for ImathBoxAlgo.h:

Go to the source code of this file.

Functions

template<class T >
IMATH_INTERNAL_NAMESPACE_HEADER_ENTER
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 T 
clip (const T &p, const Box< T > &box) IMATH_NOEXCEPT
 
template<class T >
IMATH_HOSTDEVICE constexpr T closestPointInBox (const T &p, const Box< T > &box) IMATH_NOEXCEPT
 
template<class T >
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 Vec3< T > 
closestPointOnBox (const Vec3< T > &p, const Box< Vec3< T >> &box) IMATH_NOEXCEPT
 
template<class S , class T >
IMATH_HOSTDEVICE Box< Vec3< S > > transform (const Box< Vec3< S >> &box, const Matrix44< T > &m) IMATH_NOEXCEPT
 
template<class S , class T >
IMATH_HOSTDEVICE void transform (const Box< Vec3< S >> &box, const Matrix44< T > &m, Box< Vec3< S >> &result) IMATH_NOEXCEPT
 
template<class S , class T >
IMATH_HOSTDEVICE Box< Vec3< S > > affineTransform (const Box< Vec3< S >> &box, const Matrix44< T > &m) IMATH_NOEXCEPT
 
template<class S , class T >
IMATH_HOSTDEVICE void affineTransform (const Box< Vec3< S >> &box, const Matrix44< T > &m, Box< Vec3< S >> &result) IMATH_NOEXCEPT
 
template<class T >
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 bool 
findEntryAndExitPoints (const Line3< T > &r, const Box< Vec3< T >> &b, Vec3< T > &entry, Vec3< T > &exit) IMATH_NOEXCEPT
 
template<class T >
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 bool 
intersects (const Box< Vec3< T >> &b, const Line3< T > &r, Vec3< T > &ip) IMATH_NOEXCEPT
 
template<class T >
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 bool 
intersects (const Box< Vec3< T >> &box, const Line3< T > &ray) IMATH_NOEXCEPT
 

Function Documentation

template<class S , class T >
IMATH_HOSTDEVICE Box<Vec3<S> > affineTransform ( const Box< Vec3< S >> &  box,
const Matrix44< T > &  m 
)

Transform a 3D box by a matrix whose rightmost column (0 0 0 1), and compute a new box that tightly encloses the transformed box. Return the transformed box.

As in the transform() function, use James Arvo's fast method if possible.

A transformed empty or infinite box is still empty or infinite.

Definition at line 270 of file ImathBoxAlgo.h.

template<class S , class T >
IMATH_HOSTDEVICE void affineTransform ( const Box< Vec3< S >> &  box,
const Matrix44< T > &  m,
Box< Vec3< S >> &  result 
)

Transform a 3D box by a matrix whose rightmost column is (0 0 0 1), and compute a new box that tightly encloses the transformed box. Return the transformed box in the result argument.

As in the transform() function, use James Arvo's fast method if possible.

A transformed empty or infinite box is still empty or infinite.

Definition at line 318 of file ImathBoxAlgo.h.

template<class T >
IMATH_INTERNAL_NAMESPACE_HEADER_ENTER IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T clip ( const T &  p,
const Box< T > &  box 
)
inline

Clip the coordinates of a point, p, against a Box<T>, box. Return the closest point to p that is inside the box.

Examples:
CHOP/CHOP_Blend.C, CHOP/CHOP_Spring.C, and SOP/SOP_BouncyAgent.C.

Definition at line 29 of file ImathBoxAlgo.h.

template<class T >
IMATH_HOSTDEVICE constexpr T closestPointInBox ( const T &  p,
const Box< T > &  box 
)
inline

Return the point in or on the Box<T>, box, that is closesest to the point, p.

Definition at line 53 of file ImathBoxAlgo.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Vec3<T> closestPointOnBox ( const Vec3< T > &  p,
const Box< Vec3< T >> &  box 
)

Return the point on the surface of the Box<T>, box, that is closest to point p.

If the box is empty, return p.

Definition at line 67 of file ImathBoxAlgo.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool findEntryAndExitPoints ( const Line3< T > &  r,
const Box< Vec3< T >> &  b,
Vec3< T > &  entry,
Vec3< T > &  exit 
)

Compute the points where a ray, r, enters and exits a 3D box, b:

Return true if the ray starts inside the box or if the ray starts outside and intersects the box, or return false otherwise (that is, if the ray does not intersect the box).

The entry and exit points are the points on two of the faces of the box when the function returns true (the entry end exit points may be on either side of the ray's origin), or undefined if the the function returns false.

Definition at line 372 of file ImathBoxAlgo.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool intersects ( const Box< Vec3< T >> &  b,
const Line3< T > &  r,
Vec3< T > &  ip 
)

Intersect a ray, r, with a 3D box, b, and compute the intersection point, returned inip`.

The intersection point is

  • the ray's origin if the ray starts inside the box
  • a point on one of the faces of the box if the ray starts outside the box
  • undefined when intersect() returns false
Returns
  • true if the ray starts inside the box or if the ray starts outside and intersects the box
  • false if the ray starts outside the box and intersects it, but the intersection is behind the ray's origin.
  • false if the ray starts outside and does not intersect it

Definition at line 642 of file ImathBoxAlgo.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool intersects ( const Box< Vec3< T >> &  box,
const Line3< T > &  ray 
)

Return whether the the ray ray interects the 3D box box.

Definition at line 900 of file ImathBoxAlgo.h.

template<class S , class T >
IMATH_HOSTDEVICE Box<Vec3<S> > transform ( const Box< Vec3< S >> &  box,
const Matrix44< T > &  m 
)

Transform a 3D box by a matrix, and compute a new box that tightly encloses the transformed box. Return the transformed box.

If m is an affine transform, then we use James Arvo's fast method as described in "Graphics Gems", Academic Press, 1990, pp. 548-550.

A transformed empty box is still empty, and a transformed infinite box is still infinite.

Definition at line 114 of file ImathBoxAlgo.h.

template<class S , class T >
IMATH_HOSTDEVICE void transform ( const Box< Vec3< S >> &  box,
const Matrix44< T > &  m,
Box< Vec3< S >> &  result 
)

Transform a 3D box by a matrix, and compute a new box that tightly encloses the transformed box. The transformed box is returned in the result argument.

If m is an affine transform, then we use James Arvo's fast method as described in "Graphics Gems", Academic Press, 1990, pp. 548-550.

A transformed empty box is still empty, and a transformed infinite box is still infinite

Definition at line 195 of file ImathBoxAlgo.h.