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

The U4DSegment class implements a geometrical representation of a segment in 3D space. More...

Public Member Functions

 U4DSegment ()
 Constructor which creates a segment with 3D points set to zero-components.
 
 U4DSegment (U4DPoint3n &uPointA, U4DPoint3n &uPointB)
 Constructor which creates a segment with the given 3D points.
 
 ~U4DSegment ()
 Destructor of the class.
 
 U4DSegment (const U4DSegment &a)
 Copy constructor for the 3D segment.
 
U4DSegmentoperator= (const U4DSegment &a)
 Copy constructor for the 3D segment. More...
 
bool operator== (const U4DSegment &uSegment)
 Method which compares if two 3D segments are equal. More...
 
bool operator!= (const U4DSegment &uSegment)
 Method which compares if two 3D segments are NOT equal. More...
 
U4DSegment negate ()
 Method which flips the direction of the 3D segment. That is, point AB becomes point BA. More...
 
U4DPoint3n closestPointOnSegmentToPoint (U4DPoint3n &uPoint)
 Determines the closest 3D point on the 3D segment to a 3D point. More...
 
bool isPointOnSegment (U4DPoint3n &uPoint)
 Determines if the point is on the segment. More...
 
float sqDistancePointSegment (U4DPoint3n &uPoint)
 Returns the squared distance between a 3D point and segment. More...
 
float normalizedSquareDistancePointSegment (U4DPoint3n &uPoint)
 Method which normalizes the square distance(magnitude) between a 3D point and the segment. More...
 
void getBarycentricCoordinatesOfPoint (U4DPoint3n &uPoint, float &baryCoordinateU, float &baryCoordinateV)
 Method which computes the Barycentric coordinates of the 3D point in the segment. More...
 
std::vector< U4DPoint3ngetPoints ()
 Method which returns the 3D endpoints of the segments. More...
 
void show ()
 Method which prints the 3D endpoints of the segments to the console log window.
 
bool isValid ()
 Method which tests if the segment is a valid 3D segment. More...
 

Public Attributes

U4DPoint3n pointA
 3D endPoint of segment
 
U4DPoint3n pointB
 3D endPoint of segment
 

Detailed Description

The U4DSegment class implements a geometrical representation of a segment in 3D space.

Member Function Documentation

◆ closestPointOnSegmentToPoint()

U4DPoint3n U4DEngine::U4DSegment::closestPointOnSegmentToPoint ( U4DPoint3n uPoint)

Determines the closest 3D point on the 3D segment to a 3D point.

Parameters
uPoint3D point to determine closest point
Returns
Returns the 3D point closest on segment

◆ getBarycentricCoordinatesOfPoint()

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

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

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

◆ getPoints()

std::vector< U4DPoint3n > U4DEngine::U4DSegment::getPoints ( )

Method which returns the 3D endpoints of the segments.

Returns
Returns the endpoints of the segment

◆ isPointOnSegment()

bool U4DEngine::U4DSegment::isPointOnSegment ( U4DPoint3n uPoint)

Determines if the point is on the segment.

Parameters
uPoint3D point to test if it lies on segment
Returns
Returns True if point is on segment

◆ isValid()

bool U4DEngine::U4DSegment::isValid ( )

Method which tests if the segment is a valid 3D segment.

Returns
Returns true if the segment is valid

◆ negate()

U4DSegment U4DEngine::U4DSegment::negate ( )

Method which flips the direction of the 3D segment. That is, point AB becomes point BA.

Returns
Returns the flip direction of the 3D segment. That is, point AB becomes point BA

◆ normalizedSquareDistancePointSegment()

float U4DEngine::U4DSegment::normalizedSquareDistancePointSegment ( U4DPoint3n uPoint)

Method which normalizes the square distance(magnitude) between a 3D point and the segment.

Parameters
uPoint3D point to calculate distance from
Returns
Returns the normalized square distance between point and segment

◆ operator!=()

bool U4DEngine::U4DSegment::operator!= ( const U4DSegment uSegment)

Method which compares if two 3D segments are NOT equal.

Parameters
uSegment3D segments to compare
Returns
Returns true if the 3D segments are NOT equal

◆ operator=()

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

Copy constructor for the 3D segment.

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

◆ operator==()

bool U4DEngine::U4DSegment::operator== ( const U4DSegment uSegment)

Method which compares if two 3D segments are equal.

Parameters
uSegment3D segments to compare
Returns
Returns true if the 3D segments are equal

◆ sqDistancePointSegment()

float U4DEngine::U4DSegment::sqDistancePointSegment ( U4DPoint3n uPoint)

Returns the squared distance between a 3D point and segment.

Parameters
uPoint3D point to calculate distance from
Returns
Squared distance between point and segment