| Support Forum G3D Web Page |
A generic triangle representation. More...
Public Member Functions | |
| Triangle (class BinaryInput &b) | |
| Triangle () | |
| Triangle (const Point3 &v0, const Point3 &v1, const Point3 &v2) | |
| ~Triangle () | |
| float | area () const |
| Vector3 | barycentric (const Point3 &P) const |
| result[i] is the weight applied to vertex(i) when blending More... | |
| Point3 | center () const |
| Barycenter. More... | |
| void | deserialize (class BinaryInput &b) |
| const Vector3 & | edge01 () const |
| vertex[1] - vertex[0] More... | |
| const Vector3 & | edge02 () const |
| vertex[2] - vertex[0] More... | |
| void | getBounds (class AABox &) const |
| void | getRandomSurfacePoint (Point3 &P, Vector3 &N=Vector3::ignore, Random &rnd=Random::common()) const |
| size_t | hashCode () const |
| bool | intersect (const class Ray &ray, float &distance, float baryCoord[3]) const |
| Intersect the ray at distance less than distance. More... | |
| const Vector3 & | normal () const |
| bool | operator== (const Triangle &other) const |
For two triangles to be equal they must have the same vertices in the same order. More... | |
| Triangle | otherSide () const |
| Invert winding. More... | |
| const Plane & | plane () const |
| Vector3::Axis | primaryAxis () const |
| Point3 | randomPoint (Random &rnd=Random::common()) const |
| Returns a random point in the triangle. More... | |
| void | serialize (class BinaryOutput &b) |
| const Point3 & | vertex (int n) const |
| 0, 1, or 2 More... | |
Friends | |
| class | CollisionDetection |
| class | Ray |
A generic triangle representation.
This should not be used as the underlying triangle for creating models; it is intended for providing fast property queries but requires a lot of storage and is mostly immutable.
|
explicit |
| G3D::Triangle::Triangle | ( | ) |
Referenced by otherSide().
| G3D::Triangle::~Triangle | ( | ) |
| float G3D::Triangle::area | ( | ) | const |
Referenced by G3D::TriangleShape::area().
result[i] is the weight applied to vertex(i) when blending
| Point3 G3D::Triangle::center | ( | ) | const |
Barycenter.
Referenced by G3D::TriangleShape::center().
| void G3D::Triangle::deserialize | ( | class BinaryInput & | b | ) |
|
inline |
vertex[1] - vertex[0]
Referenced by G3D::Ray::intersectionTime(), and G3D::PrecomputedRay::intersectionTime().
|
inline |
vertex[2] - vertex[0]
Referenced by G3D::Ray::intersectionTime(), and G3D::PrecomputedRay::intersectionTime().
| void G3D::Triangle::getBounds | ( | class AABox & | ) | const |
|
inline |
Referenced by G3D::TriangleShape::getRandomSurfacePoint().
|
inline |
Referenced by HashTrait< G3D::Triangle >::hashCode().
| bool G3D::Triangle::intersect | ( | const class Ray & | ray, |
| float & | distance, | ||
| float | baryCoord[3] | ||
| ) | const |
Intersect the ray at distance less than distance.
| distance | Set to the maximum distance (can be G3D::inf()) to search for an intersection. On return, this is the smaller of the distance to the intersection, if one exists, and the original value. |
| baryCoord | If a triangle is hit before distance, a the barycentric coordinates of the hit location on the triangle. Otherwise, unmodified. |
| const Vector3& G3D::Triangle::normal | ( | ) | const |
|
inline |
For two triangles to be equal they must have the same vertices in the same order.
That is, vertex[0] == vertex[0], etc.
|
inline |
Invert winding.
| const Plane& G3D::Triangle::plane | ( | ) | const |
|
inline |
| Point3 G3D::Triangle::randomPoint | ( | Random & | rnd = Random::common() | ) | const |
Returns a random point in the triangle.
Referenced by getRandomSurfacePoint(), and G3D::TriangleShape::randomInteriorPoint().
| void G3D::Triangle::serialize | ( | class BinaryOutput & | b | ) |
|
inline |
|
friend |
|
friend |
1.8.15