Navigation
API > API/Plugins > API/Plugins/PCG
Description
Marching Squares Types (16 of them). 0 in a corner means value is below Isovalue, and 1 means value is above (or equal) Isovalue. 00 00 00 00 01 01 01 01 | | | | | | | | | | |/ | | | | |/ | | | | | | | || | | | | | | | | | | | |\ | | /| | | | | | /| | | | | | 00 10 01 11 00 10 01 11 Type 0 Type 1 Type 2 Type 3 Type 4 Type 5 Type 6 Type 7
10 10 10 10 11 11 11 11 |/ | | | | | | | | | | | | | | | | | | | | | | | | | || | | | | | | | | | | | |\ | | | | | | /| |\ | | | 00 10 01 11 00 10 01 11 Type 8 Type 9 Type 10 Type 11 Type 12 Type 13 Type 14 Type 15 Marching Squares Algorithm (cf. https://en.wikipedia.org/wiki/Marching_squares) It takes some kind of map of values (like a heightmap, texture, etc...) and will return a list of coordinates on a grid that will form a line where the value in the map on the line is the isovalue passed as argument. It can be used for example to find isolines on the landscape, where the line will be where the landscape is a the "Isovalue" height. Marching Squares is discretizing the map of values into a 2D grid, of size CellCountX * CellCountY.
| Name | PCGSpatialAlgo::MarchingSquares |
| Type | function |
| Header File | /Engine/Plugins/PCG/Source/PCG/Public/SpatialAlgo/PCGMarchingSquares.h |
| Include Path | #include "SpatialAlgo/PCGMarchingSquares.h" |
| Source | /Engine/Plugins/PCG/Source/PCG/Private/SpatialAlgo/PCGMarchingSquares.cpp |
namespace PCGSpatialAlgo
{
TArray < FPCGMarchingSquareResult > PCGSpatialAlgo::MarchingSquares
(
const int32 CellCountX,
const int32 CellCountY,
const double Isovalue,
TFunctionRef < double)> ValueQuery,
bool bUseLinearInterpolation
)
}
Parameters
| Name | Remarks |
|---|---|
| CellCountX | Size of the grid on the X axis |
| CellCountY | Size of the grid on the Y axis |
| Isovalue | Defines the value where the lines computed will have in the map of values. |
| ValueQuery | Sampling function to get the value for the cell (X,Y). |
| bUseLinearInterpolation | If disabled, a point will be at the middle of cell edges. If we use linear interpolation the point will be linearly interpolated to be placed where the isovalue would be (using the values on each extremity of the cell edge, so requires 2 more sampling). |