|
| Triangle () |
| Empty.
|
|
| Triangle (const Vector &, const Vector &, const Vector &) |
| Create a triangle. More...
|
|
| ~Triangle () |
| Empty.
|
|
Vector | operator[] (int) const |
| Return the i-th vertex. More...
|
|
Vector | Vertex (const double &, const double &) const |
| Compute a point in the triangle, given uv-coordinates. More...
|
|
bool | Intersect (const Ray &, double &) const |
| Compute the intersection between a ray and a triangle. More...
|
|
bool | Intersect (const Ray &, double &, double &, double &) const |
| Compute the intersection between a ray and a triangle. More...
|
|
bool | Intersect (const Sphere &) const |
| Check if a sphere intersects or contains a triangle. More...
|
|
void | Translate (const Vector &) |
| Translates a triangle by a given vector. More...
|
|
void | Rotate (const Matrix &) |
| Rotates a triangle. More...
|
|
void | Scale (const Vector &) |
| Scale a triangle. More...
|
|
void | Transform (const Frame &) |
| Transforms a triangle given a frame transformation. More...
|
|
Triangle | Transformed (const FrameScaled &) const |
| Transforms a triangle given a frame transformation. More...
|
|
void | Shrink (const double &) |
| Shrinks a triangle. More...
|
|
Vector | Normal () const |
| Compute the normal vector of the triangle. More...
|
|
Vector | AreaNormal () const |
| Compute the normal vector of the triangle, and scale the normal using its area. More...
|
|
Vector | Center () const |
| Compute the barycenter of the triangle.
|
|
double | R (const Vector &) const |
| Computes the squared distance between a point and a triangle. More...
|
|
Vector | Normal (const Vector &) const |
| Computes the normal vector to a triangle. More...
|
|
Sphere | Inscribed () const |
| Compute the sphere inscribed in the triangle. More...
|
|
Sphere | Circumscribed () const |
| Compute the sphere circumscribing the triangle. More...
|
|
double | Area () const |
| Compute the area of the triangle.
|
|
double | Aspect () const |
| Computes the aspect ratio of the triangle. More...
|
|
Box | GetBox () const |
| Computes the axis aligned box enclosing the triangle.
|
|
int | Intersect (const Triangle &, int &, Vector &, Vector &) const |
| Check if two triangles intersect. More...
|
|
int | Intersect (const Plane &, Segment &) const |
| Compute the intersection between a triangle and a plane. More...
|
|
int | Intersect (const double &, Segment &) const |
| Compute the intersection between a triangle and a horizontal plane. More...
|
|
Vector | BarycentricCoordinates (const Vector &) const |
| Compute the barycentric coordinates of an argument vector with respect to the triangle. More...
|
|
void | Subdivide (int, QVector< Vector > &, QVector< int > &) const |
| Create an n-adic subdivision of a triangle. More...
|
|
double | InscribedRadius () const |
| Compute the radius of the circle inscribed in the triangle. More...
|
|
double | CircumscribedRadius () const |
| Compute the radius of the circumscribed circle of the triangle.
|
|
Vector | RandomInside (Random &=Random::R239) const |
| Generate a random vector inside the triangle. More...
|
|
Base minimum storage triangle class.
The data-structure of the triangle does not include the normalized normal vector.
Vector Triangle::BarycentricCoordinates |
( |
const Vector & |
p | ) |
const |
Compute the barycentric coordinates of an argument vector with respect to the triangle.
If the point lies within the triangle, the coordinates are positive and form a partition of the unity. This no longer holds if the point is outside of the triangle.
Note that this function is not the most efficient, as it relies on the evaluation of the area formed by the triangles pab, pbc, and pca.
- Parameters
-
Sphere Triangle::Inscribed |
( |
| ) |
const |
Compute the sphere inscribed in the triangle.
The center of the sphere is the center of (A,a), (B,b) and (C,c) where A, B and C are the vertices of the triangle and coefficients a, b and c represent the length of their facing edge.
bool Triangle::Intersect |
( |
const Ray & |
ray, |
|
|
double & |
t |
|
) |
| const |
Compute the intersection between a ray and a triangle.
After Tomas Moller and Ben Trumbore, Fast, minimum storage ray-triangle intersection, Journal of graphics tools, 2(1):21-28, 1997.
- Parameters
-
ray | The ray (direction should be of unit length). |
t | Intersection depth. |
bool Triangle::Intersect |
( |
const Ray & |
ray, |
|
|
double & |
t, |
|
|
double & |
u, |
|
|
double & |
v |
|
) |
| const |
Compute the intersection between a ray and a triangle.
Return the barycentric coordinates of the intersection if within the triangle.
After Tomas Moller and Ben Trumbore, Fast, minimum storage ray-triangle intersection, Journal of graphics tools, 2(1):21-28, 1997.
- Parameters
-
ray | The ray (direction should be of unit length). |
t | Intersection depth. |
u,v | Parametric coordinates of the intersection depth in the triangle. |
bool Triangle::Intersect |
( |
const Sphere & |
sphere | ) |
const |
Check if a sphere intersects or contains a triangle.
It does not attempt to compute the set of intersection.
If a triangle vertex lies exactly on the sphere, then no intersection occurs. Apart from this limit case, the algorithm proceeds as follows.
1. All three triangle vertices are contained in the sphere. The sphere completely contains the triangle.
2. At least one vertex is inside the sphere and at least one vertex is outside the sphere. The sphere and triangle intersect.
3. All three vertices are outside the sphere. The sphere and triangle intersect when the distance from sphere center to triangle is less than the sphere radius.
- Parameters
-
int Triangle::Intersect |
( |
const Triangle & |
U, |
|
|
int & |
coplanar, |
|
|
Vector & |
isectpt1, |
|
|
Vector & |
isectpt2 |
|
) |
| const |
Check if two triangles intersect.
This function analyses all cases : edge intersecting coplanar triangles, fully inside or outside triangles, face intersecting triangles in three dimensionnal space.
- Parameters
-
U | Triangle. |
isectpt1,isectpt2 | end vertices of segment if intersection occurs. |
coplanar | Coplanar flag. |
After T. Moller, A Fast Triangle-Triangle Intersection Test, Journal of graphics tools, 2(2):25-30, 1997.
Generate a random vector inside the triangle.
After R. Osada, T. Funkhouser, B. Chazelle, D. Dobkin. Shape Distributions, ACM Transactions on Graphics, 21(4), 807-832, 2002.
- Parameters
-
random | Random number generator. |