FMarchingCubes

Windows
MacOS
Linux

Inheritance Hierarchy

FMeshShapeGenerator

FMarchingCubes

References

Module

GeometricObjects

Header

/Engine/Plugins/Experimental/GeometryProcessing/Source/GeometricObjects/Public/Generators/MarchingCubes.h

Include

#include "Generators/MarchingCubes.h"

Syntax

class FMarchingCubes : public FMeshShapeGenerator

Variables

Name Description

Public variable

TAxisAlignedBox...

 

Bounds

Bounding-box we will mesh inside of.

Public variable

bool

 

bParallelCompute

Use multi-threading? Generally a good idea unless problem is very small or you are multi-threading at a higher level (which may be more efficient)

Public variable

TFunction< bool...

 

CancelF

If this function returns true, we should abort calculation

Public variable

FVector3i

 

CellDimensions

Cube indices range from [Origin,CellDimensions)

Protected variable

TMap< int64, do...

 

corner_values

Store corner values in hash table.

Protected variable

FDenseGrid3f

 

corner_values_grid

Store corner values in pre-allocated grid that has FMathf::MaxReal as sentinel.

Protected variable

FCriticalSectio...

 

corner_values_lock

Public variable

double

 

CubeSize

Length of edges of cubes that are marching.

Protected variable

FDenseGrid3i

 

done_cells

Protected variable

FCriticalSectio...

 

done_cells_lock

Protected variable

TMap< int64, in...

 

edge_vertices

Hash table for edge vertices

Protected variable

FCriticalSectio...

 

edge_vertices_lock

Protected variable

const int64

 

EDGE_X

Protected variable

const int64

 

EDGE_Y

Protected variable

const int64

 

EDGE_Z

Protected variable

FAxisAlignedBox...

 

GridBounds

Public variable

TFunction< doub...

 

Implicit

This is the function we will evaluate

Public variable

double

 

IsoValue

Mesh surface will be at this isovalue.

Protected variable

FAxisAlignedBox...

 

LastGridBounds

Protected variable

FCriticalSectio...

 

mesh_lock

Protected variable

bool

 

parallel_mesh_access

Public variable

ERootfindingMod...

 

RootMode

Which rootfinding method will be used to converge on surface along edges

Public variable

int

 

RootModeSteps

Number of iterations of rootfinding method (ignored for SingleLerp)

Public variable

int

 

SafetyMaxDimension

Max number of cells on any dimension; if exceeded, CubeSize will be automatically increased to fix

Constructors

Name Description

Public function

FMarchingCubes()

Destructors

Name Description

Public function Virtual

~FMarchingCubes()

Functions

Name Description

Protected function

int

 

append_triangle

(
    int A,
    int B,
    int C
)

Add triangle to mesh, with locking if we are computing in parallel

Protected function

int

 

append_vertex

(
    FVector3< double > V
)

Add vertex to mesh, with locking if we are computing in parallel

Protected function

FVector3i

 

cell_index

(
    const FVector3< double >& Pos
)

Protected function

int64

 

corner_hash

(
    int X,
    int Y,
    int Z
)

Protected function

int64

 

corner_hash

(
    const FVector3i& Idx
)

Corner and edge hash functions, these pack the coordinate integers into 16-bits, so max of 65536 in any dimension.

Protected function

FVector3< do...

 

corner_pos

(
    const FVector3i& IJK
)

Protected function

void

 

corner_pos

(
    const FVector3i& IJK,
    FVector3< double >& Pos
)

Protected function

double

 

corner_value

(
    const FVector3i& Idx
)

Protected function

double

 

corner_value_grid

(
    const FVector3i& Idx
)

Protected function

double

 

corner_value_nohash

(
    const FVector3i& Idx
)

Explicitly compute corner values as necessary

Protected function

int64

 

edge_hash

(
    const FVector3i& Idx1,
    const FVector3i& Idx2
)

Protected function

int

 

edge_vertex_id

(
    const FVector3i& Idx1,
    const FVector3i& Idx2,
    double F1,
    double F2
)

Protected function

void

 

find_iso

(
    const FVector3< double >& P1,
    const FVector3< double >& P2,
    double ValP1,
    double ValP2,
    FVector3< double >& PIso
)

Root-find the intersection along edge from f(P1)=ValP1 to f(P2)=ValP2

Protected function

void

 

generate_basic()

Fully sequential version, no threading

Protected function

void

 

generate_continuation

(
    TArrayView< const FVector3< double ...
)

Fully sequential version, no threading

Protected function

void

 

generate_continuation_parallel

(
    TArrayView< const FVector3< double ...
)

Parallel seed evaluation

Protected function

void

 

generate_parallel()

Processing z-slabs of cells in parallel

Public function

FMeshShapeGe...

 

GenerateContinuation

(
    TArrayView< const FVector3< double ...
)

Protected function

void

 

initialize_cell

(
    FGridCell& Cell,
    const FVector3i& Idx
)

Compute 3D corner-positions and field values for cell at index

Protected function

void

 

initialize_cell_values

(
    FGridCell& Cell,
    bool Shift
)

Protected function

void

 

initialize_cell_values_grid

(
    FGridCell& Cell,
    bool Shift
)

Protected function

void

 

initialize_cell_values_nohash

(
    FGridCell& Cell,
    bool Shift
)

Protected function

bool

 

polygonize_cell

(
    FGridCell& Cell,
    int VertIndexArray
)

Find edge crossings and generate triangles for this cell

Protected function

bool

 

set_cell_if_not_done

(
    const FVector3i& Idx
)

Protected function

void

 

SetDimensions()

Protected function

void

 

shift_cell_x

(
    FGridCell& Cell,
    int XIdx
)

Assume we just want to slide cell at XIdx-1 to cell at XIdx, while keeping yi and ZIdx constant.

Public function

bool

 

Validate()

Overridden from FMeshShapeGenerator

Name Description

Public function Virtual

FMeshShapeGe...

 

Generate()

Run MC algorithm and generate Output mesh

Classes

Name

Description

Protected struct

FGridCell

We pass Cells around, this makes code cleaner

Constants

Name

Description

EdgeIndices

Below here are standard marching-cubes tables.

EdgeTable

TriTable

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