UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FVoronoiDiagram Class Reference

#include <Voronoi.h>

Public Member Functions

VORONOI_API FVoronoiDiagram (const TArrayView< const FVector > &Sites, double ExtraBoundingSpace, double SquaredDistSkipPtThreshold=UE_KINDA_SMALL_NUMBER)
 
VORONOI_API FVoronoiDiagram (const TArrayView< const FVector > &Sites, const FBox &Bounds, double ExtraBoundingSpace, double SquaredDistSkipPtThreshold=UE_KINDA_SMALL_NUMBER)
 
VORONOI_API FVoronoiDiagram (int32 ExpectedNumSites, const FBox &Bounds, double ExtraBoundingSpace)
 
 FVoronoiDiagram ()
 
 FVoronoiDiagram (const FVoronoiDiagram &Other)=delete
 
FVoronoiDiagramoperator= (const FVoronoiDiagram &Other)=delete
 
 FVoronoiDiagram (FVoronoiDiagram &&Other)=default
 
FVoronoiDiagramoperator= (FVoronoiDiagram &&Other)=default
 
VORONOI_API void Initialize (const TArrayView< const FVector > &Sites, const FBox &Bounds, double ExtraBoundingSpace, double SquaredDistSkipPtThreshold=UE_KINDA_SMALL_NUMBER)
 
VORONOI_API ~FVoronoiDiagram ()
 
int32 Num () const
 
VORONOI_API void AddSites (const TArrayView< const FVector > &Sites, double SquaredDistSkipPtThreshold=0.0f)
 
VORONOI_API void ComputeAllCellsSerial (TArray< FVoronoiCellInfo > &AllCells)
 
VORONOI_API void ComputeAllCells (TArray< FVoronoiCellInfo > &AllCells, int32 ApproxSitesPerThread=-1)
 
VORONOI_API void ComputeAllNeighbors (TArray< TArray< int32 > > &AllNeighbors, bool bExcludeBounds=true, int32 ApproxSitesPerThread=-1)
 
VORONOI_API void ComputeCellEdgesSerial (TArray< TTuple< FVector, FVector > > &Edges, TArray< int32 > &CellMember)
 
VORONOI_API void ComputeCellEdges (TArray< TTuple< FVector, FVector > > &Edges, TArray< int32 > &CellMember, int32 ApproxSitesPerThread=-1)
 
VORONOI_API int32 FindCell (const FVector &Pos, FVoronoiComputeHelper &ComputeHelper, FVector &OutFoundSite) const
 
int32 FindCell (const FVector &Pos, FVoronoiComputeHelper &ComputeHelper) const
 
VORONOI_API FVoronoiComputeHelper GetComputeHelper () const
 
int32 ApproxSitesPerThreadWithDefault (int32 ApproxSitesPerThreadIn)
 

Static Public Member Functions

static VORONOI_API FBox GetBounds (const TArrayView< const FVector > &Sites, double ExtraBoundingSpace=UE_DOUBLE_KINDA_SMALL_NUMBER)
 

Static Public Attributes

VORONOI_API static const int MinDefaultSitesPerThread = 150
 

Constructor & Destructor Documentation

◆ FVoronoiDiagram() [1/6]

FVoronoiDiagram::FVoronoiDiagram ( const TArrayView< const FVector > &  Sites,
double  ExtraBoundingSpace,
double  SquaredDistSkipPtThreshold = UE_KINDA_SMALL_NUMBER 
)

Create a Voronoi diagram with the given sites, in a box bounding containing those sites

Parameters
SitesVoronoi sites for the diagram
ExtraBoundingSpaceVoronoi diagram will be computed within the bounding box of the sites + this amount of extra space in each dimension
SquaredDistSkipPtThresholdA safety threshold to avoid creating invalid cells: sites that are within this distance of an already-added site will not be added (If you know there will be no duplicate sites, can set to zero for faster perf.)

◆ FVoronoiDiagram() [2/6]

FVoronoiDiagram::FVoronoiDiagram ( const TArrayView< const FVector > &  Sites,
const FBox Bounds,
double  ExtraBoundingSpace,
double  SquaredDistSkipPtThreshold = UE_KINDA_SMALL_NUMBER 
)

Create a Voronoi diagram with the given sites, in a given bounding box

Parameters
SitesVoronoi sites for the diagram
BoundsBounding box within which to compute the Voronoi diagram
ExtraBoundingSpaceVoronoi diagram will be computed within the input Bounds + this amount of extra space in each dimension
SquaredDistSkipPtThresholdA safety threshold to avoid creating invalid cells: sites that are within this distance of an already-added site will not be added. (If you know there will be no duplicate sites, can set to zero for faster perf.)

◆ FVoronoiDiagram() [3/6]

FVoronoiDiagram::FVoronoiDiagram ( int32  ExpectedNumSites,
const FBox Bounds,
double  ExtraBoundingSpace 
)

Make a container for a Voronoi diagram without any points. Call AddSites() after to finish creating the diagram.

Parameters
ExpectedNumSitesHow many sites you expect to add in total
BoundsBounding box within which to compute the Voronoi diagram
ExtraBoundingSpaceAmount to expand the bounding box before computing the Voronoi diagram

◆ FVoronoiDiagram() [4/6]

FVoronoiDiagram::FVoronoiDiagram ( )
inline

Make an empty diagram, to be filled in with a subsequent call to "Initialize()"

◆ FVoronoiDiagram() [5/6]

FVoronoiDiagram::FVoronoiDiagram ( const FVoronoiDiagram Other)
delete

◆ FVoronoiDiagram() [6/6]

FVoronoiDiagram::FVoronoiDiagram ( FVoronoiDiagram &&  Other)
default

◆ ~FVoronoiDiagram()

FVoronoiDiagram::~FVoronoiDiagram ( )
default

Member Function Documentation

◆ AddSites()

void FVoronoiDiagram::AddSites ( const TArrayView< const FVector > &  Sites,
double  SquaredDistSkipPtThreshold = 0.0f 
)

◆ ApproxSitesPerThreadWithDefault()

int32 FVoronoiDiagram::ApproxSitesPerThreadWithDefault ( int32  ApproxSitesPerThreadIn)
inline

◆ ComputeAllCells()

void FVoronoiDiagram::ComputeAllCells ( TArray< FVoronoiCellInfo > &  AllCells,
int32  ApproxSitesPerThread = -1 
)

◆ ComputeAllCellsSerial()

void FVoronoiDiagram::ComputeAllCellsSerial ( TArray< FVoronoiCellInfo > &  AllCells)

◆ ComputeAllNeighbors()

void FVoronoiDiagram::ComputeAllNeighbors ( TArray< TArray< int32 > > &  AllNeighbors,
bool  bExcludeBounds = true,
int32  ApproxSitesPerThread = -1 
)

◆ ComputeCellEdges()

void FVoronoiDiagram::ComputeCellEdges ( TArray< TTuple< FVector, FVector > > &  Edges,
TArray< int32 > &  CellMember,
int32  ApproxSitesPerThread = -1 
)

◆ ComputeCellEdgesSerial()

void FVoronoiDiagram::ComputeCellEdgesSerial ( TArray< TTuple< FVector, FVector > > &  Edges,
TArray< int32 > &  CellMember 
)

◆ FindCell() [1/2]

int32 FVoronoiDiagram::FindCell ( const FVector Pos,
FVoronoiComputeHelper ComputeHelper 
) const
inline

◆ FindCell() [2/2]

int32 FVoronoiDiagram::FindCell ( const FVector Pos,
FVoronoiComputeHelper ComputeHelper,
FVector OutFoundSite 
) const

Find the closest Voronoi cell to a given position

Parameters
PosPosition to query for closest point
ComputeHelperA valid helper as returned by GetComputeHelper() for this voronoi diagram
OutFoundSiteThe position of the closest Voronoi site, if any
Returns
The id of the Voronoi cell containing the given position, or -1 if position is outside diagram

◆ GetBounds()

FBox FVoronoiDiagram::GetBounds ( const TArrayView< const FVector > &  Sites,
double  ExtraBoundingSpace = UE_DOUBLE_KINDA_SMALL_NUMBER 
)
static

◆ GetComputeHelper()

FVoronoiComputeHelper FVoronoiDiagram::GetComputeHelper ( ) const

◆ Initialize()

void FVoronoiDiagram::Initialize ( const TArrayView< const FVector > &  Sites,
const FBox Bounds,
double  ExtraBoundingSpace,
double  SquaredDistSkipPtThreshold = UE_KINDA_SMALL_NUMBER 
)

Create a Voronoi diagram with the given sites, in a given bounding box. Any previous data is discarded.

Parameters
SitesVoronoi sites for the diagram
BoundsBounding box within which to compute the Voronoi diagram
ExtraBoundingSpaceVoronoi diagram will be computed within the input Bounds + this amount of extra space in each dimension
SquaredDistSkipPtThresholdA safety threshold to avoid creating invalid cells: sites that are within this distance of an already-added site will not be added. (If you know there will be no duplicate sites, can set to zero for faster perf.)

◆ Num()

int32 FVoronoiDiagram::Num ( ) const
inline

◆ operator=() [1/2]

FVoronoiDiagram & FVoronoiDiagram::operator= ( const FVoronoiDiagram Other)
delete

◆ operator=() [2/2]

FVoronoiDiagram & FVoronoiDiagram::operator= ( FVoronoiDiagram &&  Other)
default

Member Data Documentation

◆ MinDefaultSitesPerThread

const int FVoronoiDiagram::MinDefaultSitesPerThread = 150
static

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