TrinityCore
|
#include <Triangle.h>
Public Member Functions | |
Triangle (class BinaryInput &b) | |
void | serialize (class BinaryOutput &b) |
void | deserialize (class BinaryInput &b) |
Triangle () | |
Triangle (const Point3 &v0, const Point3 &v1, const Point3 &v2) | |
~Triangle () | |
const Point3 & | vertex (int n) const |
const Vector3 & | edge01 () const |
const Vector3 & | edge02 () const |
float | area () const |
Vector3::Axis | primaryAxis () const |
const Vector3 & | normal () const |
Point3 | center () const |
const Plane & | plane () const |
Point3 | randomPoint () const |
void | getRandomSurfacePoint (Point3 &P, Vector3 &N=Vector3::ignore()) const |
bool | operator== (const Triangle &other) const |
size_t | hashCode () const |
void | getBounds (class AABox &) const |
bool | intersect (const class Ray &ray, float &distance, float baryCoord[3]) const |
Intersect the ray at distance less than distance. More... | |
Private Member Functions | |
void | init (const Vector3 &v0, const Vector3 &v1, const Vector3 &v2) |
Private Attributes | |
Vector3 | _vertex [3] |
Vector3 | edgeDirection [3] |
float | edgeMagnitude [3] |
Plane | _plane |
Vector3::Axis | _primaryAxis |
Vector3 | _edge01 |
Vector3 | _edge02 |
float | _area |
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.
G3D::Triangle::Triangle | ( | class BinaryInput & | b | ) |
G3D::Triangle::Triangle | ( | ) |
float G3D::Triangle::area | ( | ) | const |
Vector3 G3D::Triangle::center | ( | ) | const |
Barycenter
void G3D::Triangle::deserialize | ( | class BinaryInput & | b | ) |
vertex[1] - vertex[0]
vertex[2] - vertex[0]
void G3D::Triangle::getBounds | ( | class AABox & | out | ) | const |
|
inline |
|
inline |
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. |
For two triangles to be equal they must have the same vertices in the same order. That is, vertex[0] == vertex[0], etc.
|
inline |
Vector3 G3D::Triangle::randomPoint | ( | ) | const |
Returns a random point in the triangle.
void G3D::Triangle::serialize | ( | class BinaryOutput & | b | ) |
0, 1, or 2
|
friend |
|
friend |
|
private |
|
private |
vertex[1] - vertex[0]
|
private |
vertex[2] - vertex[0]
|
private |
|
private |
|
private |
|
private |
edgeDirection[i] is the normalized vector v[i+1] - v[i]
|
private |