UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
UE::Geometry::FMeshSurfacePointSampling Class Reference

#include <MeshSurfacePointSampling.h>

Public Types

enum class  ESizeDistribution { Uniform = 0 , Smaller = 1 , Larger = 2 }
 
enum class  EInterpretWeightMode { RadiusInterp = 0 , RadiusInterpWithFill = 1 , WeightedRandom = 2 }
 

Public Member Functions

GEOMETRYCORE_API void ComputePoissonSampling (const FDynamicMesh3 &Mesh, FProgressCancel *Progress=nullptr)
 

Public Attributes

double SampleRadius = 10.0
 
uint32 MaxSamples = TNumericLimits<uint32>::Max()
 
double SubSampleDensity = 10.0
 
int32 RandomSeed = 0
 
int32 MaxSubSamplePoints = 50000000
 
int32 SamplingMethodVersion = INDEX_NONE
 
double MaxSampleRadius = 0.0
 
ESizeDistribution SizeDistribution = ESizeDistribution::Uniform
 
double SizeDistributionPower = 2.0
 
bool bUseVertexWeights = false
 
TArray< doubleVertexWeights
 
EInterpretWeightMode InterpretWeightMode = EInterpretWeightMode::RadiusInterpWithFill
 
bool bInvertWeights = false
 
bool bComputeBarycentrics = false
 
FGeometryResult Result
 
TArray< FFrame3dSamples
 
TArray< doubleRadii
 
TArray< int32TriangleIDs
 
TArray< FVector3dBarycentricCoords
 

Detailed Description

FMeshSurfacePointSampling computes oriented point samples on the surface of a Mesh using various sampling strategies, with controls over sample spacing.

Member Enumeration Documentation

◆ EInterpretWeightMode

Control how active Weights are used to affect point radius

Enumerator
RadiusInterp 

Weights are clamped to [0,1] and used to interpolate Min/Max Radius

RadiusInterpWithFill 

Weights are clamped to [0,1] and used to interpolate Min/Max Radius, with decay, so that smaller-radius samples will infill between large ones

WeightedRandom 

Weight is used to create nonuniform random sampling, ie it nudges the random point radius distribution but does not directly control it

◆ ESizeDistribution

Controls the distribution of sample radii

Enumerator
Uniform 

Uniform distribution of sizes, ie all equally likely

Smaller 

Distribution is weighted towards smaller points (T^Power)

Larger 

Distribution is weighted towards larger points (T^1/Power)

Member Function Documentation

◆ ComputePoissonSampling()

void FMeshSurfacePointSampling::ComputePoissonSampling ( const FDynamicMesh3 Mesh,
FProgressCancel Progress = nullptr 
)

Compute an approximate Poisson sampling of the mesh, either uniform or non-uniform depending on the settings above. The sampling will attempt to fully cover the mesh unless .MaxSamples is provided, in which case exactly that many samples will be generated and they will be randomly distributed (so not at all Poisson...!)

By default the sampling will be uniform - all points will be spaced at least .SampleRadius*2, ie no "collisions" between their bounding spheres.

If .MaxSampleRadius is larger than .SampleRadius, the sampling will be non-uniform, ie samples will be emitted with radii within this range. By default a random uniform distribution of radii will be attempted, .SizeDistribution and related parameters can be used to make this distribution non-uniform. The spacing between points will always be greater than the sum of their two sample radii, so again no collisions. However the "density" of the sampling will vary depending on how well the algorithm can find gaps to fill.

If .bUseVertexWeights is defined and valid VertexWeights are provided, they will be used to modulate the sampling radii. The .InterpretWeightMode setting controls how the weights are used to influence the sample radii.

The strategy used is to compute a much higher density sampling than needed (based on .SubSampleDensity), then iteratively select from that point set and decimate it within the radius of selected samples. The implementation also introduces various biases to increase performance. Generally increasing SubSampleDensity will result in more tightly-packed results, but at increasingly expensive computation time.

Member Data Documentation

◆ BarycentricCoords

TArray<FVector3d> UE::Geometry::FMeshSurfacePointSampling::BarycentricCoords

Barycentric Coordinates of each Sample Point in it's respective Triangle. Only computed if bComputeBarycentrics = true

◆ bComputeBarycentrics

bool UE::Geometry::FMeshSurfacePointSampling::bComputeBarycentrics = false

If true, barycentric coordinates output array will be populated

◆ bInvertWeights

bool UE::Geometry::FMeshSurfacePointSampling::bInvertWeights = false

If true, weights are inverted

◆ bUseVertexWeights

bool UE::Geometry::FMeshSurfacePointSampling::bUseVertexWeights = false

Control whether VertexWeights (if valid) will be interpolated to modulate sampling

◆ InterpretWeightMode

EInterpretWeightMode UE::Geometry::FMeshSurfacePointSampling::InterpretWeightMode = EInterpretWeightMode::RadiusInterpWithFill

Active weight interpretation mode

◆ MaxSampleRadius

double UE::Geometry::FMeshSurfacePointSampling::MaxSampleRadius = 0.0

If MaxSampleRadius > SampleRadius, then output point radii will be in range [SampleRadius, MaxSampleRadius]

◆ MaxSamples

uint32 UE::Geometry::FMeshSurfacePointSampling::MaxSamples = TNumericLimits<uint32>::Max()

Maximum number of samples requested. If 0 or default value, mesh will be maximally sampled

◆ MaxSubSamplePoints

int32 UE::Geometry::FMeshSurfacePointSampling::MaxSubSamplePoints = 50000000

Safety threshold for maximum number of points in subsampling.

◆ Radii

TArray<double> UE::Geometry::FMeshSurfacePointSampling::Radii

Radius of each Sample Point, length is the same as Samples array

◆ RandomSeed

int32 UE::Geometry::FMeshSurfacePointSampling::RandomSeed = 0

Random Seed used to initialize sampling strategies

◆ Result

FGeometryResult UE::Geometry::FMeshSurfacePointSampling::Result

Result of last computation

◆ SampleRadius

double UE::Geometry::FMeshSurfacePointSampling::SampleRadius = 10.0

Desired "radius" of sample points. Spacing between samples is at least 2x this value.

◆ Samples

TArray<FFrame3d> UE::Geometry::FMeshSurfacePointSampling::Samples

Oriented Sample Points on the mesh surface. Z axis of frame points along mesh normal, X and Y are arbitrary

◆ SamplingMethodVersion

int32 UE::Geometry::FMeshSurfacePointSampling::SamplingMethodVersion = INDEX_NONE

If < 0, the latest, recommended sampling methods will be used. Otherwise, requests a specific sampling method version. Set this for more consistent results across UE versions, at the risk of worse performance or quality. Valid versions are: Method 0: UE 5.5 and earlier sampling method. Slower initial (dense) point sampling, less robust to degenerate triangles. Method 1: Currently the default method.

◆ SizeDistribution

ESizeDistribution UE::Geometry::FMeshSurfacePointSampling::SizeDistribution = ESizeDistribution::Uniform

Active Size Distribution mode

◆ SizeDistributionPower

double UE::Geometry::FMeshSurfacePointSampling::SizeDistributionPower = 2.0

Used to define how extreme the Size Distribution shift is. Valid range is [1,10]

◆ SubSampleDensity

double UE::Geometry::FMeshSurfacePointSampling::SubSampleDensity = 10.0

Density of subsampling used in Poisson strategy. Larger numbers mean "more accurate" (but slower) results.

◆ TriangleIDs

TArray<int32> UE::Geometry::FMeshSurfacePointSampling::TriangleIDs

Triangle that contains each Sample Point, length is the same as Samples array

◆ VertexWeights

TArray<double> UE::Geometry::FMeshSurfacePointSampling::VertexWeights

Per-vertex weights, size must be == Max Vertex Index of input Mesh


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