Core 1.0
Public Member Functions | Static Public Attributes | List of all members
OrientedBox Class Reference

An oriented box. More...

#include <framebox.h>

Inheritance diagram for OrientedBox:
Frame

Public Member Functions

 OrientedBox ()
 Half diagonal vector. More...
 
 OrientedBox (const Vector &, const Frame &)
 Creates a unit oriented box. More...
 
 OrientedBox (const Vector &, const Vector &)
 Creates an axis aligned box given two opposite corners. More...
 
 OrientedBox (const Vector &, const Vector &, const Vector &, const Vector &)
 Creates an oriented box given a box and a Frame. More...
 
 ~OrientedBox ()
 Empty.
 
const Vector Center () const
 Return the center of the oriented box.
 
Vector Vertex (int) const
 Returns the k-th vertex of the oriented box. More...
 
int Intersect (const Ray &, double &, double &) const
 Compute the intersection between a box and a ray. More...
 
double R (const Vector &) const
 Computes the squared Euclidean distance between the oriented box and a point. More...
 
double Signed (const Vector &) const
 Computes the signed distance between the oriented box and a point. More...
 
Box GetBox () const
 Compute the axis aligned bounding box enclosing the oriented box.
 
bool Inside (const Vector &) const
 Check if a point is inside the box. More...
 
void Transform (const Frame &)
 Transform an oriented box with a frame. More...
 
bool Intersect (const OrientedBox &) const
 Check if two oriented boxes intersect. More...
 

Static Public Attributes

static constexpr const double epsilon = 1.0e-5
 Internal \epsilon; constant.
 

Additional Inherited Members

- Protected Member Functions inherited from Frame
 Frame (const Matrix &=Matrix::Identity, const Vector &=Vector::Null)
 Creates a frame given a rotation matrix and a translation vector. More...
 
 Frame (const Vector &, const Vector &, const Vector &, const Vector &)
 Creates a frame given the origin and its orthogonal unit vectors. More...
 
 ~Frame ()
 Empty.
 
Matrix R () const
 Returns the rotation matrix of the frame.
 
Vector T () const
 Returns the translation vector of the frame.
 
Vector GetVector (int) const
 Returns the i-th basis vector of the frame. More...
 
void Compose (const Frame &)
 Compose the frame with another one. More...
 
Frame Composed (const Frame &) const
 Compose the frame with another one. More...
 
Frame Inverse () const
 Compute the inverse transformation.
 
Vector Transform (const Vector &) const
 Transform a point out of the frame coordinate system. More...
 
Vector InverseTransform (const Vector &) const
 Transform a point into the frame coordinate system. More...
 
Vector TransformDirection (const Vector &) const
 Transform a direction vector out of the frame coordinate system. More...
 
Vector InverseTransformDirection (const Vector &) const
 Transform a direction vector into the frame coordinate system.
 
Ray Transform (const Ray &) const
 Transform a ray out of the frame coordinate system. More...
 
Ray InverseTransform (const Ray &) const
 Transform a ray into the frame coordinate system. More...
 
Vector CircleVertex (const double &, int=1, int=2) const
 Compute the coordinates of a point on a circle inside the frame;. More...
 
Vector CircleNormal (const double &, int=1, int=2) const
 Compute the coordinates of the normal a point on a circle inside the frame;. More...
 
Vector SphereVertex (const double &, const double &, const double &, int=1, int=2, int=0) const
 Compute the coordinates of a point on a sphere inside the frame. More...
 
Vector SphereNormal (const double &, const double &, int=1, int=2, int=0) const
 Compute the coordinates of the normal of a point on a sphere inside the frame. More...
 
- Static Protected Member Functions inherited from Frame
static Frame Translation (const Vector &)
 Creates a translation transformation. More...
 
static Frame Rotation (const Vector &)
 Creates a rotation frame. More...
 
static Frame Rotation (const Vector &, const double &)
 Create a rotation frame about an arbitrary axis. More...
 
static Frame Rotation (const Vector &, const Vector &)
 Create a frame that rotates a normalized vector into another one. More...
 
static Frame Canonical (const Vector &, const Vector &)
 Given a point and a direction, compute the frame that brings these into a canonical coordinate system. More...
 
static Frame Orthonormal (const Vector &, const Vector &)
 Compute a frame given an origin and direction vector. More...
 
- Protected Attributes inherited from Frame
Matrix r
 Rotation matrix.
 
Vector t
 Translation vector.
 
- Static Protected Attributes inherited from Frame
static const Frame Id
 Identity.
 

Detailed Description

An oriented box.

The frame stores the center of the box and the axes as vectors. The size of the box is defined using a half-size length vector.

Constructor & Destructor Documentation

◆ OrientedBox() [1/4]

OrientedBox::OrientedBox ( )
inline

Half diagonal vector.

Empty.

◆ OrientedBox() [2/4]

OrientedBox::OrientedBox ( const Vector diagonal,
const Frame frame 
)
explicit

Creates a unit oriented box.

Parameters
diagonalDiagonal vector of the box, i.e. side lengths.
frameFrame.

◆ OrientedBox() [3/4]

OrientedBox::OrientedBox ( const Vector a,
const Vector b 
)
explicit

Creates an axis aligned box given two opposite corners.

Note that this constructor does not check the coordinates of the two vectors.

Parameters
a,bEnd opposite vertices of the box.

◆ OrientedBox() [4/4]

OrientedBox::OrientedBox ( const Vector c,
const Vector x,
const Vector y,
const Vector z 
)
explicit

Creates an oriented box given a box and a Frame.

Parameters
cCenter.
x,y,zOrthogonal axes.

Member Function Documentation

◆ Inside()

bool OrientedBox::Inside ( const Vector p) const

Check if a point is inside the box.

Simply check the position of the point against the three slabs of the oriented box.

◆ Intersect() [1/2]

bool OrientedBox::Intersect ( const OrientedBox other) const

Check if two oriented boxes intersect.

Parameters
otherSecond box.

◆ Intersect() [2/2]

int OrientedBox::Intersect ( const Ray ray,
double &  tmin,
double &  tmax 
) const

Compute the intersection between a box and a ray.

Parameters
rayThe ray.
tmin,tmaxIntersection depths.
See also
Box::Intersect(const Ray&,double&,double&) const

◆ R()

double OrientedBox::R ( const Vector p) const

Computes the squared Euclidean distance between the oriented box and a point.

Parameters
pPoint.
See also
box::R(const Vector&) const

◆ Signed()

double OrientedBox::Signed ( const Vector p) const

Computes the signed distance between the oriented box and a point.

Parameters
pPoint.
See also
box::Signed(const Vector&) const

◆ Transform()

void OrientedBox::Transform ( const Frame frame)

Transform an oriented box with a frame.

Parameters
frameThe frame.

◆ Vertex()

Vector OrientedBox::Vertex ( int  k) const
inline

Returns the k-th vertex of the oriented box.

Parameters
kIndex.