TCachingMeshSDF

This is variant of [TSweepingMeshSDF](API\Plugins\GeometricObjects\Implicit\TSweepingMeshSDF) that does lazy evaluation of actual Distances, using mesh spatial data structure.

Windows
MacOS
Linux

References

Module

GeometricObjects

Header

/Engine/Plugins/Experimental/GeometryProcessing/Source/GeometricObjects/Public/Implicit/CachingMeshSDF.h

Include

#include "Implicit/CachingMeshSDF.h"

Syntax

template<class TriangleMeshType>
class TCachingMeshSDF

Remarks

This is variant of TSweepingMeshSDF that does lazy evaluation of actual Distances, using mesh spatial data structure. This is much faster if we are doing continuation-method marching cubes as only values on surface will be computed!

Compute discretely-sampled (I.e. gridded) signed distance field for a mesh only within a narrow band of the surface (within MaxDistQueryDist = MaxOffsetDistance + (2 * CellSize * FMathf::Sqrt2))

This code is based on the implementation found at https://github.com/christopherbatty/SDFGen

Variables

Name Description

Public variable

int

 

ApproxMaxCellsPerDimension

If the number of cells in any dimension may exceed this, CellSize will be automatically increased to keep cell count reasonable.

Public variable

bool

 

bComputeSigns

Should we try to compute signs? if not, Grid remains unsigned

Public variable

bool

 

bUseParallel

Most of this parallelizes very well, makes a huge speed difference.

Public variable

bool

 

bWantClosestTriGrid

Implementation computes the triangle closest to each Grid cell, can return this Grid if desired (only reason not to is avoid hanging onto memory)

Public variable

bool

 

bWantIntersectionsGrid

Grid of per-cell crossing or parity counts.

Public variable

TFunction< bool...

 

CancelF

If this function returns true, we should abort calculation

Public variable

float

 

CellSize

Public variable

FDenseGrid3i

 

ClosestTriGrid

Public variable

FVector3d

 

ExpandBounds

Bounds of Grid will be expanded this much in positive and negative directions.

Public variable

FDenseGrid3f

 

Grid

Public variable

FVector3f

 

GridOrigin

Public variable

EInsideModes

 

InsideMode

Public variable

FDenseGrid3i

 

IntersectionsGrid

Protected variable

double

 

MaxDistQueryDist

Public variable

float

 

MaxOffsetDistance

Max distance away from surface that we might need to evaluate

Public variable

const TriangleM...

 

Mesh

Public variable

const TMeshAABB...

 

Spatial

Protected variable

float

 

UpperBoundDistance

Constructors

Name Description

Public function

TCachingMeshSDF

(
    float CellSizeIn
)

Public function

TCachingMeshSDF

(
    const TriangleMeshType* MeshIn,
    float CellSizeIn,
    const TMeshAABBTree3< TriangleMeshT...,
    bool bAutoBuild
)

Functions

Name Description

Public function Const

float

 

At

(
    int I,
    int J,
    int K
)

Public function

FVector3f

 

CellCenter

(
    int I,
    int J,
    int K
)

Public function

void

 

CleanupUnwanted()

Public function

FVector3i

 

Dimensions()

Public function Const

const FDense...

 

GetClosestTriGrid()

Public function Const

const FDense...

 

GetGrid()

SDF Grid available after calling Compute()

Public function Const

const FVecto...

 

GetGridOrigin()

Origin of the SDF Grid, in same coordinates as mesh

Public function Const

const FDense...

 

GetIntersectionsGrid()

Public function

float

 

GetValue

(
    FVector3i Idx
)

Public function

void

 

Initialize()

Public function

TTriLinearGr...

 

MakeInterpolant()

Public function Static

int

 

Orientation

(
    double X1,
    double Y1,
    double X2,
    double Y2,
    double& TwiceSignedArea
)

Calculate twice signed area of triangle (0,0)-(X1,Y1)-(X2,Y2) return an SOS-determined sign (-1, +1, or 0 only if it's a truly degenerate triangle)

Public function Static

bool

 

PointInTriangle2d

(
    double X0,
    double Y0,
    double X1,
    double Y1,
    double X2,
    double Y2,
    double X3,
    double Y3,
    double& A,
    double& B,
    double& C
)

Robust test of (X0,Y0) in the triangle (X1,Y1)-(X2,Y2)-(X3,Y3) if true is returned, the barycentric coordinates are set in A,B,C.

Public function

bool

 

Validate()

Operators

Name Description

Public function Const

constexpr co...

 

operator[]

(
    FVector3i Idx
)

Enums

Name

Description

Public enum

EInsideModes

What counts as "inside" the mesh.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss