Core 1.0
|
An oriented box. More...
#include <framebox.h>
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. | |
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.
|
inline |
Half diagonal vector.
Empty.
Creates a unit oriented box.
diagonal | Diagonal vector of the box, i.e. side lengths. |
frame | Frame. |
Creates an axis aligned box given two opposite corners.
Note that this constructor does not check the coordinates of the two vectors.
a,b | End opposite vertices of the box. |
|
explicit |
Creates an oriented box given a box and a Frame.
c | Center. |
x,y,z | Orthogonal axes. |
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.
bool OrientedBox::Intersect | ( | const OrientedBox & | other | ) | const |
Check if two oriented boxes intersect.
other | Second box. |
int OrientedBox::Intersect | ( | const Ray & | ray, |
double & | tmin, | ||
double & | tmax | ||
) | const |
Compute the intersection between a box and a ray.
ray | The ray. |
tmin,tmax | Intersection depths. |
double OrientedBox::R | ( | const Vector & | p | ) | const |
Computes the squared Euclidean distance between the oriented box and a point.
p | Point. |
double OrientedBox::Signed | ( | const Vector & | p | ) | const |
Computes the signed distance between the oriented box and a point.
p | Point. |
void OrientedBox::Transform | ( | const Frame & | frame | ) |
Transform an oriented box with a frame.
frame | The frame. |
|
inline |
Returns the k-th vertex of the oriented box.
k | Index. |