![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#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< double > | VertexWeights |
| EInterpretWeightMode | InterpretWeightMode = EInterpretWeightMode::RadiusInterpWithFill |
| bool | bInvertWeights = false |
| bool | bComputeBarycentrics = false |
| FGeometryResult | Result |
| TArray< FFrame3d > | Samples |
| TArray< double > | Radii |
| TArray< int32 > | TriangleIDs |
| TArray< FVector3d > | BarycentricCoords |
FMeshSurfacePointSampling computes oriented point samples on the surface of a Mesh using various sampling strategies, with controls over sample spacing.
Control how active Weights are used to affect point radius
| 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.
Barycentric Coordinates of each Sample Point in it's respective Triangle. Only computed if bComputeBarycentrics = true
If true, barycentric coordinates output array will be populated
Control whether VertexWeights (if valid) will be interpolated to modulate sampling
| EInterpretWeightMode UE::Geometry::FMeshSurfacePointSampling::InterpretWeightMode = EInterpretWeightMode::RadiusInterpWithFill |
Active weight interpretation mode
| double UE::Geometry::FMeshSurfacePointSampling::MaxSampleRadius = 0.0 |
If MaxSampleRadius > SampleRadius, then output point radii will be in range [SampleRadius, MaxSampleRadius]
| uint32 UE::Geometry::FMeshSurfacePointSampling::MaxSamples = TNumericLimits<uint32>::Max() |
Maximum number of samples requested. If 0 or default value, mesh will be maximally sampled
| int32 UE::Geometry::FMeshSurfacePointSampling::MaxSubSamplePoints = 50000000 |
Safety threshold for maximum number of points in subsampling.
Radius of each Sample Point, length is the same as Samples array
| int32 UE::Geometry::FMeshSurfacePointSampling::RandomSeed = 0 |
Random Seed used to initialize sampling strategies
| FGeometryResult UE::Geometry::FMeshSurfacePointSampling::Result |
Result of last computation
| double UE::Geometry::FMeshSurfacePointSampling::SampleRadius = 10.0 |
Desired "radius" of sample points. Spacing between samples is at least 2x this value.
Oriented Sample Points on the mesh surface. Z axis of frame points along mesh normal, X and Y are arbitrary
| 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.
| ESizeDistribution UE::Geometry::FMeshSurfacePointSampling::SizeDistribution = ESizeDistribution::Uniform |
Active Size Distribution mode
| double UE::Geometry::FMeshSurfacePointSampling::SizeDistributionPower = 2.0 |
Used to define how extreme the Size Distribution shift is. Valid range is [1,10]
| double UE::Geometry::FMeshSurfacePointSampling::SubSampleDensity = 10.0 |
Density of subsampling used in Poisson strategy. Larger numbers mean "more accurate" (but slower) results.
Triangle that contains each Sample Point, length is the same as Samples array
Per-vertex weights, size must be == Max Vertex Index of input Mesh