| Core 1.0
    | 
An icosahedron. More...
#include <icosahedron.h>
| Public Member Functions | |
| Icosahedron (const Vector &, const double &) | |
| Creates an icosahedron given its center and radius. | |
| Icosahedron (const double &=1.0) | |
| Creates an icosahedron. | |
| double | Volume () const | 
| Compute the volume of the icosahedron. | |
| double | Area () const | 
| Compute the area of the icosahedron. | |
| double | Radius () const | 
| Return the radius of the circmscribed sphere of the icosi-dodecahedron. | |
| 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 | 
| Return the normal to the i-th face as a normalized vector. | |
| Box | GetBox () const | 
| Return the bounding box. | |
| Plane | GetPlane (int) const | 
| Return the plane of the k-th face. | |
| bool | Inside (const Vector &) const | 
| Check if a point is inside. | |
| Vector | RandomInside (Random &=Random::R239) const | 
| Generate a random vector inside the icosahedron. | |
| double | Signed (const Vector &) const | 
| Compute the approximate signed distance to the icosahedron. | |
| bool | Intersect (const Ray &, double &, double &, int &, int &) const | 
| Compute the intersection between an icosahedron and a ray. | |
| Static Public Member Functions | |
| static int | VertexIndex (int, int) | 
| Return the index of the j-th vertex of the i-th face. | |
| static int | VertexEdgeIndex (int, int) | 
| Return the index of the j-th vertex of the i-th edge. | |
| Protected Attributes | |
| Vector | c = Vector::Null | 
| Center. | |
| double | r = 1.0 | 
| Radius. | |
| Static Protected Attributes | |
| static const double | R2 = (1.0 / 4.0) * sqrt(10 + 2.0 * sqrt(5.0)) * 2.0 | 
| Radius of the circumscribed sphere of an icosahedron with edge length 2. | |
| static const double | Phi = (1 + sqrt(5.0)) / 2.0 | 
| Phi. | |
| static const Vector | vertex [12] | 
| Array of vertices. | |
| static const Vector | normal [20] | 
| Array of normals. | |
| static const int | edge [30][2] | 
| Array of edges. | |
| static const int | face [20][3] | 
| Array of pentagons. | |
| Friends | |
| std::ostream & | operator<< (std::ostream &s, const Icosahedron &icosahedron) | 
| Overloaded output-stream operator. | |
An icosahedron.
The following Cartesian coordinates define the vertices of an icosahedron with edge-length 2, centered at the origin.
(0, ± 1, ± φ)
( ± 1, ± φ,0)
( ± φ,0, ± 1)
where φ=(1+sqrt(5))/2 is the golden ratio.
| 
 | explicit | 
Creates an icosahedron given its center and radius.
| c | Center. | 
| r | Radius. | 
| 
 | explicit | 
Creates an icosahedron.
| r | Radius. | 
| bool Icosahedron::Inside | ( | const Vector & | p | ) | const | 
Check if a point is inside.
| p | The point. | 
| bool Icosahedron::Intersect | ( | const Ray & | ray, | 
| double & | ta, | ||
| double & | tb, | ||
| int & | fa, | ||
| int & | fb ) const | 
Compute the intersection between an icosahedron and a ray.
Intersect the ray with the planes corresponding to the faces of the convex icosahedron.
| ray | The ray. | 
| ta,tb | Intersection depths. | 
| fa,fb | Index of the intersected faces. | 
| Vector Icosahedron::RandomInside | ( | Random & | random = Random::R239 | ) | const | 
Generate a random vector inside the icosahedron.
Uses a simple rejection method.
| random | Random number generator. | 
| double Icosahedron::Signed | ( | const Vector & | p | ) | const | 
Compute the approximate signed distance to the icosahedron.
| p | Point. | 
| 
 | inlinestatic | 
Return the index of the j-th vertex of the i-th edge.
| i | Edge. | 
| j | Vertex (should be O or 1). | 
| 
 | friend | 
Overloaded output-stream operator.
| s | Stream. | 
| icosahedron | The icosahedron. |