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

The U4DSHAlgorithm class is in charge of implementing the Sutherland-Hodgman algorithm. More...

Inherits U4DEngine::U4DManifoldGeneration.

Public Member Functions

 U4DSHAlgorithm ()
 Constructor for the class.
 
 ~U4DSHAlgorithm ()
 Destructor for the class.
 
bool determineContactManifold (U4DDynamicAction *uAction1, U4DDynamicAction *uAction2, std::vector< SIMPLEXDATA > uQ, COLLISIONMANIFOLDONODE &uCollisionManifoldNode)
 Method which determines the collision contact manifold. It retrieves the collision contact points of the collision. More...
 
void determineCollisionManifold (U4DDynamicAction *uAction1, U4DDynamicAction *uAction2, std::vector< SIMPLEXDATA > uQ, COLLISIONMANIFOLDONODE &uCollisionManifoldNode)
 Method which determines the collision manifold. It computes the collision planes. More...
 
std::vector< U4DSegmentclipPolygons (std::vector< CONTACTEDGE > &uReferencePolygons, std::vector< CONTACTEDGE > &uIncidentPolygons)
 Method which clips polygons. More...
 
std::vector< CONTACTFACESmostParallelFacesToPlane (U4DDynamicAction *uAction, U4DPlane &uPlane)
 Method which computes the most parallel faces to collision plane. More...
 
std::vector< U4DTriangleprojectFacesToPlane (std::vector< CONTACTFACES > &uFaces, U4DPlane &uPlane)
 Method which projects polygon faces to collision plane. More...
 
std::vector< CONTACTEDGEgetEdgesFromFaces (std::vector< U4DTriangle > &uFaces, U4DPlane &uPlane)
 Method which extracs edges from a polygon face. More...
 
bool isCenterOfMassWithinReferencePlane (U4DDynamicAction *uAction, std::vector< CONTACTEDGE > &uReferencePolygons)
 Method which computes if the 3D entity center of mass is within the boundary of the reference plane. More...
 
- Public Member Functions inherited from U4DEngine::U4DManifoldGeneration
 U4DManifoldGeneration ()
 Constructor for the class.
 
 ~U4DManifoldGeneration ()
 Destructor for the class.
 
- Public Member Functions inherited from U4DEngine::U4DCollisionDetection
 U4DCollisionDetection ()
 Constructor for class.
 
virtual ~U4DCollisionDetection ()
 Destructor for class.
 
virtual bool collision (U4DDynamicAction *uAction1, U4DDynamicAction *uAction2, float dt)
 Method with returns true if a collision between two 3D entities have occurred. More...
 
virtual void determineCollisionManifold (U4DDynamicAction *uAction1, U4DDynamicAction *uAction2, std::vector< SIMPLEXDATA > uQ)
 Method which determines the collision manifold. More...
 
SIMPLEXDATA calculateSupportPointInDirection (U4DBoundingVolume *uBoundingVolume1, U4DBoundingVolume *uBoundingVolume2, U4DVector3n &uDirection)
 Method which computes the supporting point in a given direction. More...
 
U4DPoint3n determineClosestPointOnSimplexToPoint (U4DPoint3n &uPoint, std::vector< SIMPLEXDATA > uQ)
 Method which determines the closest 3D point on a simplex to a 3D point. More...
 
std::vector< float > determineBarycentricCoordinatesInSimplex (U4DPoint3n &uClosestPointToOrigin, std::vector< SIMPLEXDATA > uQ)
 Method which determines the Barycentric coordinates in a Simplex. More...
 

Detailed Description

The U4DSHAlgorithm class is in charge of implementing the Sutherland-Hodgman algorithm.

Member Function Documentation

◆ clipPolygons()

std::vector< U4DSegment > U4DEngine::U4DSHAlgorithm::clipPolygons ( std::vector< CONTACTEDGE > &  uReferencePolygons,
std::vector< CONTACTEDGE > &  uIncidentPolygons 
)

Method which clips polygons.

Parameters
uReferencePolygonsContainer holding the reference segments
uIncidentPolygonsContainer holding the incidient segments
Returns
Returns a container holding clipped sigments

◆ determineCollisionManifold()

void U4DEngine::U4DSHAlgorithm::determineCollisionManifold ( U4DDynamicAction uAction1,
U4DDynamicAction uAction2,
std::vector< SIMPLEXDATA uQ,
COLLISIONMANIFOLDONODE uCollisionManifoldNode 
)
virtual

Method which determines the collision manifold. It computes the collision planes.

Parameters
uAction13D model entity
uAction23D model entity
uQSimplex Data set
uCollisionManifoldNodeCollision Manifold node

Reimplemented from U4DEngine::U4DManifoldGeneration.

◆ determineContactManifold()

bool U4DEngine::U4DSHAlgorithm::determineContactManifold ( U4DDynamicAction uAction1,
U4DDynamicAction uAction2,
std::vector< SIMPLEXDATA uQ,
COLLISIONMANIFOLDONODE uCollisionManifoldNode 
)
virtual

Method which determines the collision contact manifold. It retrieves the collision contact points of the collision.

Parameters
uAction13D model entity
uAction23D model entity
uQSimplex Data set
uCollisionManifoldNodeCollision Manifold node
Returns
Returns true if the collision contact points were successfully computed

Reimplemented from U4DEngine::U4DManifoldGeneration.

◆ getEdgesFromFaces()

std::vector< CONTACTEDGE > U4DEngine::U4DSHAlgorithm::getEdgesFromFaces ( std::vector< U4DTriangle > &  uFaces,
U4DPlane uPlane 
)

Method which extracs edges from a polygon face.

Parameters
uFacesPolygon face
uPlanecollision plane
Returns
Returns a container holding the edges extracted from a polygon face

◆ isCenterOfMassWithinReferencePlane()

bool U4DEngine::U4DSHAlgorithm::isCenterOfMassWithinReferencePlane ( U4DDynamicAction uAction,
std::vector< CONTACTEDGE > &  uReferencePolygons 
)

Method which computes if the 3D entity center of mass is within the boundary of the reference plane.

Parameters
uAction3D model entity
uReferencePolygonsReference polygon
Returns
Returns true if the 3D entity center of mass is within the boundary of the reference plane

◆ mostParallelFacesToPlane()

std::vector< CONTACTFACES > U4DEngine::U4DSHAlgorithm::mostParallelFacesToPlane ( U4DDynamicAction uAction,
U4DPlane uPlane 
)

Method which computes the most parallel faces to collision plane.

Parameters
uActionDynamic action
uPlaneCollision plane
Returns
Returns the most parallel faces to plane

◆ projectFacesToPlane()

std::vector< U4DTriangle > U4DEngine::U4DSHAlgorithm::projectFacesToPlane ( std::vector< CONTACTFACES > &  uFaces,
U4DPlane uPlane 
)

Method which projects polygon faces to collision plane.

Parameters
uFacesPolygon faces
uPlaneCollision plane
Returns
Returns a container holding the projected polygon faces onto the collision plane