Untold Engine  Beta v0.0.16
docs
U4DEngine::U4DTriangle Class Reference

The U4DTriangle class implements a geometrical representation of a 3D triangle. More...

Public Member Functions

 U4DTriangle ()
 Constructor which creates a 3D triangle with vertices all set to zero components.
 
 U4DTriangle (U4DPoint3n &uPointA, U4DPoint3n &uPointB, U4DPoint3n &uPointC)
 Constructor which creates a 3D triangle with the given vertex points.
 
 ~U4DTriangle ()
 Destructor for the class.
 
 U4DTriangle (const U4DTriangle &a)
 Copy constructor for the class.
 
U4DTriangleoperator= (const U4DTriangle &a)
 Copy constructor for the class. More...
 
bool operator== (const U4DTriangle &a)
 Method which determines if two 3D triangle are equal. That is, they have the same vertex 3D points. More...
 
bool operator!= (const U4DTriangle &a)
 Method which determines if two 3D triangle are NOT equal. That is, they DO NOT have the same vertex 3D points. More...
 
U4DPoint3n closestPointOnTriangleToPoint (U4DPoint3n &uPoint)
 Method which determins the closest 3D point on the 3D triangle from the given 3D point. More...
 
U4DPoint3n getCentroid ()
 Method which determines the centroid point of the triangle. More...
 
bool isPointOnTriangle (U4DPoint3n &uPoint)
 Method which determines if the 3D point lies on the 3D triangle. More...
 
void getBarycentricCoordinatesOfPoint (U4DPoint3n &uPoint, float &baryCoordinateU, float &baryCoordinateV, float &baryCoordinateW)
 Method which computes the Barycentric coordinates of the 3D point in the triangle. More...
 
U4DVector3n getTriangleNormal ()
 Method which returns a 3D normal vector to the triangle. The normal vector computation follows the right-hand rule. More...
 
std::vector< U4DSegmentgetSegments ()
 Method which returns all three vertices of the 3D triangle. More...
 
U4DTriangle projectTriangleOntoPlane (U4DPlane &uPlane)
 Method which returns a projected 3D triangle to a 3D plane. More...
 
float distanceToPlane (U4DPlane &uPlane)
 Method which computes the magnitude(distance) from the 3D triangle to a 3D plane. More...
 
float distanceSquareToPlane (U4DPlane &uPlane)
 Method which computes the square magnitude fromt the 3D triangle to a 3D plane. More...
 
float centroidDistanceToPlane (U4DPlane &uPlane)
 Method which computes the magnitude(distance) from the 3D triangle's centroid to a 3D plane. More...
 
float centroidSquareDistanceToPlane (U4DPlane &uPlane)
 Method which computes the square magnitude(distance) from the 3D triangle's centroid to a 3D plane. More...
 
void show ()
 Method which prints the vertices of the 3D triangle to the console log window.
 
bool isValid ()
 Method which test if the 3D triangle is valid. That is, if the points are not colinear. More...
 

Public Attributes

U4DPoint3n pointA
 3D vertex point of the triangle
 
U4DPoint3n pointB
 3D vertex point of the triangle
 
U4DPoint3n pointC
 3D vertex point of the triangle
 

Detailed Description

The U4DTriangle class implements a geometrical representation of a 3D triangle.

Member Function Documentation

◆ centroidDistanceToPlane()

float U4DEngine::U4DTriangle::centroidDistanceToPlane ( U4DPlane uPlane)

Method which computes the magnitude(distance) from the 3D triangle's centroid to a 3D plane.

Parameters
uPlane3D plane to compute centroid distance from
Returns
Returns the magnitude(distance) from the 3D triangle's centroid to a 3D plane

◆ centroidSquareDistanceToPlane()

float U4DEngine::U4DTriangle::centroidSquareDistanceToPlane ( U4DPlane uPlane)

Method which computes the square magnitude(distance) from the 3D triangle's centroid to a 3D plane.

Parameters
uPlane3D plane to compute centroid distance from
Returns
Returns the square magnitude(distance) from the 3D triangle's centroid to a 3D plane

◆ closestPointOnTriangleToPoint()

U4DPoint3n U4DEngine::U4DTriangle::closestPointOnTriangleToPoint ( U4DPoint3n uPoint)

Method which determins the closest 3D point on the 3D triangle from the given 3D point.

Parameters
uPoint3D point to determine closest point
Returns
Returns the closest 3D point to the triangle from the given 3D point

◆ distanceSquareToPlane()

float U4DEngine::U4DTriangle::distanceSquareToPlane ( U4DPlane uPlane)

Method which computes the square magnitude fromt the 3D triangle to a 3D plane.

Parameters
uPlane3D plane to compute distance
Returns
Returns the square magnitude from a 3D triangle to a 3D plane

◆ distanceToPlane()

float U4DEngine::U4DTriangle::distanceToPlane ( U4DPlane uPlane)

Method which computes the magnitude(distance) from the 3D triangle to a 3D plane.

Parameters
uPlane3D plane to compute distance
Returns
Returns the magnitude(distance) from a 3D triangle to a 3D plane

◆ getBarycentricCoordinatesOfPoint()

void U4DEngine::U4DTriangle::getBarycentricCoordinatesOfPoint ( U4DPoint3n uPoint,
float &  baryCoordinateU,
float &  baryCoordinateV,
float &  baryCoordinateW 
)

Method which computes the Barycentric coordinates of the 3D point in the triangle.

Parameters
uPoint3D point to compute barycentric coordinates from
baryCoordinateUu-component of the barycentric coordinates of the 3D point
baryCoordinateVv-component of the barycentric coordinates of the 3D point
baryCoordinateWw-component of the barycentric coordinates of the 3D point

◆ getCentroid()

U4DPoint3n U4DEngine::U4DTriangle::getCentroid ( )

Method which determines the centroid point of the triangle.

Returns
Returns a 3D point representing the centroid

◆ getSegments()

std::vector< U4DSegment > U4DEngine::U4DTriangle::getSegments ( )

Method which returns all three vertices of the 3D triangle.

Returns
Returns the three vertices of the 3D triangle

◆ getTriangleNormal()

U4DVector3n U4DEngine::U4DTriangle::getTriangleNormal ( )

Method which returns a 3D normal vector to the triangle. The normal vector computation follows the right-hand rule.

Returns
Returns a 3D vector representing the normal vector to the 3D triangle

◆ isPointOnTriangle()

bool U4DEngine::U4DTriangle::isPointOnTriangle ( U4DPoint3n uPoint)

Method which determines if the 3D point lies on the 3D triangle.

Parameters
uPoint3D point to test
Returns
Returns true if the given 3D point lies on the 3D triangle

◆ isValid()

bool U4DEngine::U4DTriangle::isValid ( )

Method which test if the 3D triangle is valid. That is, if the points are not colinear.

Returns
Returns true if the 3D triangle construction is valid.

◆ operator!=()

bool U4DEngine::U4DTriangle::operator!= ( const U4DTriangle a)

Method which determines if two 3D triangle are NOT equal. That is, they DO NOT have the same vertex 3D points.

Parameters
a3D triangle to test
Returns
Returns true if both triangles DO NOT have the same vertex 3D points

◆ operator=()

U4DTriangle & U4DEngine::U4DTriangle::operator= ( const U4DTriangle a)

Copy constructor for the class.

Parameters
a3D triangle to copy to
Returns
Returns a copy of the 3D triangle

◆ operator==()

bool U4DEngine::U4DTriangle::operator== ( const U4DTriangle a)

Method which determines if two 3D triangle are equal. That is, they have the same vertex 3D points.

Parameters
a3D triangle to test
Returns
Returns true if both triangles have the same vertex 3D points

◆ projectTriangleOntoPlane()

U4DTriangle U4DEngine::U4DTriangle::projectTriangleOntoPlane ( U4DPlane uPlane)

Method which returns a projected 3D triangle to a 3D plane.

Parameters
uPlane3D plane to compute projected 3D triangle
Returns
Returns a 3D triangle projected to a 3D plane