Core 1.0
|
An oriented box. More...
#include <framebox.h>
Public Member Functions | |
OrientedBox2 () | |
Empty. | |
OrientedBox2 (const Box2 &, const Frame2 &=Frame2::Id) | |
Creates an oriented box. More... | |
OrientedBox2 (const Vector2 &, const Frame2 &=Frame2::Id) | |
Creates an oriented box. More... | |
~OrientedBox2 () | |
Empty. | |
double | R (const Vector2 &) const |
Compute the squared Euclidean distance to the box. More... | |
double | Signed (const Vector2 &) const |
Compute the squared Euclidean distance to the box. More... | |
OrientedBox2 | Translated (const Vector2 &) const |
Return a box translated by a given vector. More... | |
OrientedBox2 | Rotated (const Matrix2 &) const |
Return a box rotated by a given matrix. More... | |
OrientedBox2 | Transformed (const Frame2 &) const |
Return a box transformed by a frame. More... | |
bool | Intersect (const Ray2 &, double &, double &) const |
Check the intersection between the box and a ray. More... | |
bool | Intersect (const Ray2 &) const |
Check the intersection between the box and a ray. More... | |
const Vector2 | Center () const |
Return the center of the oriented box. | |
Vector2 | Vertex (int) const |
Returns the k-th vertex of the oriented box. More... | |
Box2 | GetBox () const |
Compute the axis aligned bounding box enclosing the oriented box. | |
void | Draw (QGraphicsScene &, const QPen &=QPen(), const QBrush &=QBrush()) const |
Draws an oriented box. More... | |
Static Public Attributes | |
static double | epsilon = 1.0e-5 |
Internal \epsilon; constant. | |
Protected Attributes | |
Vector2 | length = Vector2::Null |
Half diagonal vector. | |
Protected Attributes inherited from Frame2 | |
Matrix2 | r |
Rotation matrix. | |
Vector2 | t |
Translation vector. | |
Additional Inherited Members | |
Protected Member Functions inherited from Frame2 | |
Frame2 (const Matrix2 &=Matrix2::Identity, const Vector2 &=Vector2::Null) | |
Creates a frame given a rotation matrix and a translation vector. More... | |
Frame2 (const Vector2 &, const Vector2 &, const Vector2 &) | |
Creates a frame given the origin and its orthogonal unit vectors. More... | |
~Frame2 () | |
Empty. | |
Matrix2 | R () const |
Returns the rotation matrix of the frame. | |
Vector2 | T () const |
Returns the translation vector of the frame. | |
Vector2 | GetVector (int) const |
Returns the i-th basis vector of the frame. More... | |
void | Compose (const Frame2 &) |
Compose the frame with another one. More... | |
Frame2 | Composed (const Frame2 &) const |
Compose the frame with another one. More... | |
Frame2 | Inverse () const |
Compute the inverse transformation. | |
Vector2 | Transform (const Vector2 &) const |
Transform a point out of the frame coordinate system. More... | |
Vector2 | InverseTransform (const Vector2 &) const |
Transform a point into the frame coordinate system. More... | |
Vector2 | TransformDirection (const Vector2 &) const |
Transform a direction vector out of the frame coordinate system. More... | |
Vector2 | InverseTransformDirection (const Vector2 &) const |
Transform a direction vector into the frame coordinate system. | |
Static Protected Member Functions inherited from Frame2 | |
static Frame2 | Translation (const Vector2 &) |
Creates a translation transformation. More... | |
static Frame2 | Rotation (const double &) |
Create a rotation frame about an arbitrary axis. More... | |
Static Protected Attributes inherited from Frame2 | |
static const Frame2 | Id |
Identity. | |
An oriented box.
|
explicit |
Creates an oriented box.
box | Box. |
frame | Frame. |
|
explicit |
Creates an oriented box.
half | Half size of the box (half diagonal). |
frame | Frame. |
void OrientedBox2::Draw | ( | QGraphicsScene & | scene, |
const QPen & | pen = QPen() , |
||
const QBrush & | brush = QBrush() |
||
) | const |
Draws an oriented box.
scene | Graphics scene. |
pen | The pen. |
brush | The brush. |
bool OrientedBox2::Intersect | ( | const Ray2 & | ray | ) | const |
Check the intersection between the box and a ray.
ray | The (normalized) ray. |
bool OrientedBox2::Intersect | ( | const Ray2 & | ray, |
double & | ta, | ||
double & | tb | ||
) | const |
Check the intersection between the box and a ray.
Note that intersections are sorted.
This function assumes that the ray is normalized, i.e. has a unit direction vector.
ray | The (normalized) ray. |
ta,tb | Intersection depths. |
double OrientedBox2::R | ( | const Vector2 & | p | ) | const |
Compute the squared Euclidean distance to the box.
p | Point. |
OrientedBox2 OrientedBox2::Rotated | ( | const Matrix2 & | r | ) | const |
Return a box rotated by a given matrix.
r | Rotation matrix. |
double OrientedBox2::Signed | ( | const Vector2 & | p | ) | const |
Compute the squared Euclidean distance to the box.
p | Point. |
OrientedBox2 OrientedBox2::Transformed | ( | const Frame2 & | f | ) | const |
Return a box transformed by a frame.
f | Transformation. |
OrientedBox2 OrientedBox2::Translated | ( | const Vector2 & | t | ) | const |
Return a box translated by a given vector.
t | Translation vector. |
|
inline |
Returns the k-th vertex of the oriented box.
k | Index. |