UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
Levelset.cpp File Reference
#include "Chaos/Levelset.h"
#include "Containers/Queue.h"
#include "Misc/FileHelper.h"
#include "Misc/Paths.h"
#include "Async/ParallelFor.h"
#include <algorithm>
#include <vector>
#include "Chaos/ErrorReporter.h"
#include "Chaos/MassProperties.h"
#include "Chaos/TriangleMesh.h"
#include "Chaos/Sphere.h"
#include "Chaos/Box.h"
#include "Chaos/Capsule.h"
#include "Chaos/Convex.h"
#include "Chaos/GeometryQueries.h"

Namespaces

namespace  Chaos
 

Macros

#define MAX_CLAMP(a, comp, b)   (a >= comp ? b : a)
 
#define MIN_CLAMP(a, comp, b)   (a < comp ? b : a)
 
#define RANGE_CLAMP(a, comp, b)   ((a < 0 || comp <= a) ? b : a)
 

Functions

bool Chaos::Compare (const Pair< FReal *, TVec3< int32 > > &Other1, const Pair< FReal *, TVec3< int32 > > &Other2)
 
FReal Chaos::SolveQuadraticEquation (const FReal Phi, const FReal PhiX, const FReal PhiY, const FReal Dx, const FReal Dy)
 
void Chaos::GetGeomSurfaceSamples (const FSphere &InGeom, TArray< FVec3 > &OutSamples)
 
void Chaos::GetGeomSurfaceSamples (const TBox< FReal, 3 > &InGeom, TArray< FVec3 > &OutSamples)
 
void Chaos::GetGeomSurfaceSamples (const FCapsule &InGeom, TArray< FVec3 > &OutSamples)
 
void Chaos::GetGeomSurfaceSamples (const FConvex &InGeom, TArray< FVec3 > &OutSamples)
 
template<typename InnerT >
void Chaos::GetGeomSurfaceSamples (const TImplicitObjectScaled< InnerT > &InScaledGeom, TArray< FVec3 > &OutSamples)
 
void Chaos::GetGeomSurfaceSamplesExtended (const FSphere &InGeom, TArray< FVec3 > &OutSamples)
 
void Chaos::GetGeomSurfaceSamplesExtended (const TBox< FReal, 3 > &InGeom, TArray< FVec3 > &OutSamples)
 
void Chaos::GetGeomSurfaceSamplesExtended (const FCapsule &InGeom, TArray< FVec3 > &OutSamples)
 
void Chaos::GetGeomSurfaceSamplesExtended (const FConvex &InGeom, TArray< FVec3 > &OutSamples)
 
template<typename InnerT >
void Chaos::GetGeomSurfaceSamplesExtended (const TImplicitObjectScaled< InnerT > &InScaledGeom, TArray< FVec3 > &OutSamples)
 

Variables

int32 OutputFailedLevelSetDebugData = 0
 
FAutoConsoleVariableRef CVarOutputFailedLevelSetDebugData (TEXT("p.LevelSetOutputFailedDebugData"), OutputFailedLevelSetDebugData, TEXT("Output debug obj files for level set and mesh when error tolerances are too high"))
 
int32 FailureOnHighError = 0
 
FAutoConsoleVariableRef CVarFailureOnHighError (TEXT("p.LevelSetFailureOnHighError"), FailureOnHighError, TEXT("Set level sets with high error to null in the solver"))
 
Chaos::FRealSingle AvgDistErrorTolerance = 1.f
 
FAutoConsoleVariableRef CVarAvgDistErrorTolerance (TEXT("p.LevelSetAvgDistErrorTolerance"), AvgDistErrorTolerance, TEXT("Error tolerance for average distance between the triangles and generated levelset. Note this is a fraction of the average bounding box dimensions."))
 
Chaos::FRealSingle MaxDistErrorTolerance = 1.f
 
FAutoConsoleVariableRef CVarMaxDistErrorTolerance (TEXT("p.LevelSetMaxDistErrorTolerance"), MaxDistErrorTolerance, TEXT("Max error for the highest error triangle generated from a levelset. Note this is a fraction of the average bounding box dimensions."))
 
Chaos::FRealSingle AvgAngleErrorTolerance = 1.
 
FAutoConsoleVariableRef CVarAvgAngleErrorTolerance (TEXT("p.LevelSetAvgAngleErrorTolerance"), AvgAngleErrorTolerance, TEXT("Average error in of the mesh normal and computed normal on the level set."))
 
int32 NumOverlapSphereSamples = 16
 
FAutoConsoleVariableRef CVarNumOverlapSphereSamples (TEXT("p.LevelsetOverlapSphereSamples"), NumOverlapSphereSamples, TEXT("Number of spiral points to generate for levelset-sphere overlaps"))
 
int32 NumOverlapCapsuleSamples = 24
 
FAutoConsoleVariableRef CVarNumOverlapCapsuleSamples (TEXT("p.LevelsetOverlapCapsuleSamples"), NumOverlapCapsuleSamples, TEXT("Number of spiral points to generate for levelset-capsule overlaps"))
 

Macro Definition Documentation

◆ MAX_CLAMP

#define MAX_CLAMP (   a,
  comp,
 
)    (a >= comp ? b : a)

◆ MIN_CLAMP

#define MIN_CLAMP (   a,
  comp,
 
)    (a < comp ? b : a)

◆ RANGE_CLAMP

#define RANGE_CLAMP (   a,
  comp,
 
)    ((a < 0 || comp <= a) ? b : a)

Variable Documentation

◆ AvgAngleErrorTolerance

Chaos::FRealSingle AvgAngleErrorTolerance = 1.

◆ AvgDistErrorTolerance

Chaos::FRealSingle AvgDistErrorTolerance = 1.f

◆ CVarAvgAngleErrorTolerance

FAutoConsoleVariableRef CVarAvgAngleErrorTolerance(TEXT("p.LevelSetAvgAngleErrorTolerance"), AvgAngleErrorTolerance, TEXT("Average error in of the mesh normal and computed normal on the level set.")) ( TEXT("p.LevelSetAvgAngleErrorTolerance")  ,
AvgAngleErrorTolerance  ,
TEXT("Average error in of the mesh normal and computed normal on the level set."  
)

◆ CVarAvgDistErrorTolerance

FAutoConsoleVariableRef CVarAvgDistErrorTolerance(TEXT("p.LevelSetAvgDistErrorTolerance"), AvgDistErrorTolerance, TEXT("Error tolerance for average distance between the triangles and generated levelset. Note this is a fraction of the average bounding box dimensions.")) ( TEXT("p.LevelSetAvgDistErrorTolerance")  ,
AvgDistErrorTolerance  ,
TEXT("Error tolerance for average distance between the triangles and generated levelset. Note this is a fraction of the average bounding box dimensions."  
)

◆ CVarFailureOnHighError

FAutoConsoleVariableRef CVarFailureOnHighError(TEXT("p.LevelSetFailureOnHighError"), FailureOnHighError, TEXT("Set level sets with high error to null in the solver")) ( TEXT("p.LevelSetFailureOnHighError")  ,
FailureOnHighError  ,
TEXT("Set level sets with high error to null in the solver"  
)

◆ CVarMaxDistErrorTolerance

FAutoConsoleVariableRef CVarMaxDistErrorTolerance(TEXT("p.LevelSetMaxDistErrorTolerance"), MaxDistErrorTolerance, TEXT("Max error for the highest error triangle generated from a levelset. Note this is a fraction of the average bounding box dimensions.")) ( TEXT("p.LevelSetMaxDistErrorTolerance")  ,
MaxDistErrorTolerance  ,
TEXT("Max error for the highest error triangle generated from a levelset. Note this is a fraction of the average bounding box dimensions."  
)

◆ CVarNumOverlapCapsuleSamples

FAutoConsoleVariableRef CVarNumOverlapCapsuleSamples(TEXT("p.LevelsetOverlapCapsuleSamples"), NumOverlapCapsuleSamples, TEXT("Number of spiral points to generate for levelset-capsule overlaps")) ( TEXT("p.LevelsetOverlapCapsuleSamples")  ,
NumOverlapCapsuleSamples  ,
TEXT("Number of spiral points to generate for levelset-capsule overlaps"  
)

◆ CVarNumOverlapSphereSamples

FAutoConsoleVariableRef CVarNumOverlapSphereSamples(TEXT("p.LevelsetOverlapSphereSamples"), NumOverlapSphereSamples, TEXT("Number of spiral points to generate for levelset-sphere overlaps")) ( TEXT("p.LevelsetOverlapSphereSamples")  ,
NumOverlapSphereSamples  ,
TEXT("Number of spiral points to generate for levelset-sphere overlaps"  
)

◆ CVarOutputFailedLevelSetDebugData

FAutoConsoleVariableRef CVarOutputFailedLevelSetDebugData(TEXT("p.LevelSetOutputFailedDebugData"), OutputFailedLevelSetDebugData, TEXT("Output debug obj files for level set and mesh when error tolerances are too high")) ( TEXT("p.LevelSetOutputFailedDebugData")  ,
OutputFailedLevelSetDebugData  ,
TEXT("Output debug obj files for level set and mesh when error tolerances are too high"  
)

◆ FailureOnHighError

int32 FailureOnHighError = 0

◆ MaxDistErrorTolerance

Chaos::FRealSingle MaxDistErrorTolerance = 1.f

◆ NumOverlapCapsuleSamples

int32 NumOverlapCapsuleSamples = 24

◆ NumOverlapSphereSamples

int32 NumOverlapSphereSamples = 16

◆ OutputFailedLevelSetDebugData

int32 OutputFailedLevelSetDebugData = 0