|
Core 1.0
|
An axis aligned octahedron. More...
#include <octahedron.h>
Public Member Functions | |
| Octahedron (const Vector &, const Vector &) | |
| Creates an octahedron given the vertices of its bounding box. | |
| Octahedron (const Vector &, const double &) | |
| Creates an octahedron given its center and radius. | |
| Octahedron (const double &) | |
| Creates an octahedron. | |
| double | Volume () const |
| Compute the volume of the octahedron. | |
| double | Area () const |
| Compute the area of the octahedron. | |
| Vector | Vertex (int) const |
| Return the i-th vertex as a vector. | |
| Vector | Vertex (int, int) const |
| Return the j-th vertex of the i-th face. | |
| Vector | Normal (int) const |
| Compute the normal to the i-th face as a normalized vector. | |
| Vector | Normal (const Vector &) const |
| Compute the normal vector between a point and the octahedron. | |
| double | R (const Vector &) const |
| Compute the squared Euclidean distance between a point and the octahedron. | |
| double | Signed (const Vector &) const |
| Compute the signed Euclidean distance between a point and the octahedron. | |
| Plane | GetPlane (int) const |
| Return the plane of the k-th face. | |
| Box | GetBox () const |
| Return the bounding box of the octahedron. | |
| bool | Inside (const Vector &) const |
| Check if a point is inside the octahedron. | |
Static Public Member Functions | |
| static int | VertexIndex (int, int) |
| Return the index of the j-th vertex of the i-th face. | |
Protected Attributes | |
| Vector | center = Vector::Null |
| Center. | |
| Vector | half |
| Half diagonal of the box. | |
| Vector | planenormal |
| Normal to the plane in the first octant. | |
| Vector | ezxn |
| Edge normals. | |
Static Protected Attributes | |
| static const int | face [8][3] |
| Array of triangles. | |
| static const Vector | vertex [6] |
| Array of internal vertexes for computing vertices. | |
An axis aligned octahedron.
Creates an octahedron given the vertices of its bounding box.
| a,b | Vectors. |
|
explicit |
Creates an octahedron given its center and radius.
| c | Center. |
| r | Radius. |
|
explicit |
Creates an octahedron.
| r | Radius. |
|
inline |
Compute the area of the octahedron.
It is 8 times the area of one of its triangular faces.
The code has been optimized, instead of computing the normal of the triangle using Triangle::Normal(), the cross product has been inlined.
| Plane Octahedron::GetPlane | ( | int | k | ) | const |
Return the plane of the k-th face.
| k | Index. |
| bool Octahedron::Inside | ( | const Vector & | p | ) | const |
Check if a point is inside the octahedron.
| p | Point. |
Compute the normal vector between a point and the octahedron.
| p | Point. |
| double Octahedron::R | ( | const Vector & | p | ) | const |
Compute the squared Euclidean distance between a point and the octahedron.
| p | The point. |
| double Octahedron::Signed | ( | const Vector & | p | ) | const |
Compute the signed Euclidean distance between a point and the octahedron.
| p | Point. |
|
inline |
Compute the volume of the octahedron.
It is 8 times the volume of a tetrahedron. Since three vectors are orthogonal, the volume is 1/6 the volume of a half box (thus 1/48 the volume of the box).