UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
UE::Geometry::TMeshDijkstra< PointSetType > Class Template Reference

#include <MeshDijkstra.h>

Classes

struct  FSeedPoint
 

Public Member Functions

 TMeshDijkstra (const PointSetType *PointSetIn)
 
void Reset ()
 
void ComputeToMaxDistance (const TArray< FSeedPoint > &SeedPointsIn, double ComputeToMaxDistanceIn)
 
void ComputeToMaxDistance (const TArray< FVector2d > &SeedPointsIn, double ComputeToMaxDistanceIn)
 
bool ComputeToTargetPoint (const TArray< FSeedPoint > &SeedPointsIn, int32 TargetPointID, double ComputeToMaxDistanceIn=TNumericLimits< double >::Max())
 
double GetMaxGraphDistance () const
 
int32 GetMaxGraphDistancePointID () const
 
int32 GetSeedExternalIDForPointSetID (int32 PointID)
 
bool HasDistance (int32 PointID) const
 
double GetDistance (int32 PointID) const
 
bool FindPathToNearestSeed (int32 PointID, TArray< int32 > &PathToSeedOut, int32 MaxLength=100000)
 

Static Public Member Functions

static double InvalidDistance ()
 

Public Attributes

const PointSetTypePointSet
 
TUniqueFunction< FVector3d(int32)> GetPositionFunc
 
bool bEnableDistanceWeighting = false
 
TUniqueFunction< double(int32 FromVID, int32 ToVID, int32 SeedVID, double EuclideanDistance)> GetWeightedDistanceFunc
 

Detailed Description

template<class PointSetType>
class UE::Geometry::TMeshDijkstra< PointSetType >

TMeshDijkstra computes graph distances on a mesh from seed point(s) using Dijkstra's algorithm.

Templated on the point set type, which must provide positions, normals, and neighbours. Currently will only work for FDynamicMesh3 and FDynamicPointSet3 because of call to PointSetType->VtxVerticesItr()

Constructor & Destructor Documentation

◆ TMeshDijkstra()

template<class PointSetType >
UE::Geometry::TMeshDijkstra< PointSetType >::TMeshDijkstra ( const PointSetType PointSetIn)
inline

Construct TMeshDijkstra for the given PointSet. We will hold a reference to this PointSet for the lifetime of the class.

Member Function Documentation

◆ ComputeToMaxDistance() [1/2]

template<class PointSetType >
void UE::Geometry::TMeshDijkstra< PointSetType >::ComputeToMaxDistance ( const TArray< FSeedPoint > &  SeedPointsIn,
double  ComputeToMaxDistanceIn 
)
inline

Computes graph distances outwards from seed points to all points that are less/equal to ComputeToMaxDistance from the seed.

Parameters
SeedPointsInseed points used to initialize computation, ie geodesics propagate out from this point set
ComputeToMaxDistancetarget graph-distance radius, will not compute/set distances on points with graph-distance larger than this

◆ ComputeToMaxDistance() [2/2]

template<class PointSetType >
void UE::Geometry::TMeshDijkstra< PointSetType >::ComputeToMaxDistance ( const TArray< FVector2d > &  SeedPointsIn,
double  ComputeToMaxDistanceIn 
)
inline

Computes graph distances outwards from seed points to all points that are less/equal to ComputeToMaxDistance from the seed.

Parameters
SeedPointsIn2D tuples that define seed points as (PointID, InitialDistance) pairs
ComputeToMaxDistancetarget graph-distance radius, will not compute/set distances on points with graph-distance larger than this

◆ ComputeToTargetPoint()

template<class PointSetType >
bool UE::Geometry::TMeshDijkstra< PointSetType >::ComputeToTargetPoint ( const TArray< FSeedPoint > &  SeedPointsIn,
int32  TargetPointID,
double  ComputeToMaxDistanceIn = TNumericLimits<double>::Max() 
)
inline

Computes graph distances outwards from seed points to all points that are less/equal to ComputeToMaxDistance from the seed, or until TargetPointID is reached. This is useful for finding shortest paths between two points

Parameters
SeedPointsInseed points used to initialize computation, ie geodesics propagate out from this point set
TargetPointIDthe target point, computation stops when this point is reached
ComputeToMaxDistancetarget graph-distance radius, will not compute/set distances on points with graph-distance larger than this

◆ FindPathToNearestSeed()

template<class PointSetType >
bool UE::Geometry::TMeshDijkstra< PointSetType >::FindPathToNearestSeed ( int32  PointID,
TArray< int32 > &  PathToSeedOut,
int32  MaxLength = 100000 
)
inline

Find path from a point to the nearest seed point

Parameters
PointIDstarting point, assumption is that we have computed dijkstra to this point
PathToSeedOutpath is returned here, includes PointID and seed point as last element
MaxLengthif PathToSeedOut grows beyond this length, we abort the search
Returns
true if valid path was found

◆ GetDistance()

template<class PointSetType >
double UE::Geometry::TMeshDijkstra< PointSetType >::GetDistance ( int32  PointID) const
inline
Returns
the distance calculated for index PointID

◆ GetMaxGraphDistance()

template<class PointSetType >
double UE::Geometry::TMeshDijkstra< PointSetType >::GetMaxGraphDistance ( ) const
inline
Returns
the maximum graph distance encountered during the computation

◆ GetMaxGraphDistancePointID()

template<class PointSetType >
int32 UE::Geometry::TMeshDijkstra< PointSetType >::GetMaxGraphDistancePointID ( ) const
inline
Returns
vertex id associated with the maximum graph distance returned by GetMaxGraphDistance()

◆ GetSeedExternalIDForPointSetID()

template<class PointSetType >
int32 UE::Geometry::TMeshDijkstra< PointSetType >::GetSeedExternalIDForPointSetID ( int32  PointID)
inline
Returns
the ExternalID of the SeedPoint that is closest to PointID, or -1 if PointID does not have a valid graph distance

◆ HasDistance()

template<class PointSetType >
bool UE::Geometry::TMeshDijkstra< PointSetType >::HasDistance ( int32  PointID) const
inline
Returns
true if the distance for index PointID was calculated

◆ InvalidDistance()

template<class PointSetType >
static double UE::Geometry::TMeshDijkstra< PointSetType >::InvalidDistance ( )
inlinestatic
Returns
distance value that indicates invalid or uncomputed distance

◆ Reset()

template<class PointSetType >
void UE::Geometry::TMeshDijkstra< PointSetType >::Reset ( )
inline

Reset internal data structures but keep allocated memory

Member Data Documentation

◆ bEnableDistanceWeighting

template<class PointSetType >
bool UE::Geometry::TMeshDijkstra< PointSetType >::bEnableDistanceWeighting = false

If enabled, when computing local point-pair distances, GetWeightedDistanceFunc() will be called with the Euclidean distance to allow for alternative metrics

◆ GetPositionFunc

Return the 3D Position of a given Point in the PointSet. This function is set to PointSet->GetVertex() in the constructor below, but can be replaced with an external function if necessary (eg to provide deformed mesh positions, etc)

◆ GetWeightedDistanceFunc

Called when computing pairwise point distances between neighbours FromVID and ToVID, to allow for alternative distance metrics. SeedVID is the seed point that FromVID's value was propagated from (ie point reached by gradient walk) EuclideanDistance is the distance between the two input points

◆ PointSet

template<class PointSetType >
const PointSetType* UE::Geometry::TMeshDijkstra< PointSetType >::PointSet

PointSet we are calculating on


The documentation for this class was generated from the following file: