Geometry

Overview

Core geometry primitives used across all modules for spatial computation: circles, edges, polygons, rectangles, triangles, tiles, splines, Delaunay triangulation, Voronoi diagrams, MST, noise and visual effects.

FCCircle

Simple 2D circle defined by center and radius.

Name Description
center FVector2D center position
radius Circle radius (default 1.0)
pointInside Returns true if a point is inside the circle (distance² ≤ radius²)
FCCircle circle(FVector2D(100, 200), 500.0f);
bool inside = circle.pointInside(FVector2D(150, 250));

FCEdge

2D line segment with index, width, and spatial query functions.

Name Description
a Start point FVector2D
b End point FVector2D
index Edge identifier
width Edge width (used for corridor influence zone)
triIndex Array of triangle indices sharing this edge
length Returns the edge length
isNeighbour Returns true if two edges share a vertex
findNeighbourIn Returns all edges in an array that share a vertex with this edge
isNextNeighbour Returns true if this edge’s b equals the other’s a (clockwise order)
findNextNeighbourIn Returns all next-neighbours in an array
intersectionWith Computes the intersection point between two segments
pointOnEdgeWithDistance Returns true if a point is within tolerance of the edge, outputs distance
breakEdge Static: recursively subdivides edges with random midpoint displacement for organic shapes
closestEdge Static: finds the closest edge to a point in an array
closestEdgeWithin Static: returns all edges within a distance from a point
nearEdge Static: finds the nearest edge within its influence width
FCEdge edge(0, FVector2D(0, 0), FVector2D(100, 100));
float len = edge.length();

// Check if point is near the edge (within edge.width)
float dist;
bool near = edge.pointOnEdgeWithDistance(FVector2D(50, 60), dist);

// Intersection between two edges
FVector2D intersection;
bool intersects = edge.intersectionWith(otherEdge, intersection);

// Break edges recursively for organic corridors
TArray<FCEdge> broken = FCEdge::breakEdge(stream, edgeArray, 3);

// Find closest edge in a cell
FCEdge closest;
float distance;
FCEdge::closestEdge(FVector2D(50, 50), closest, distance, edgeArray);

FCTriangle

2D triangle with circumscribed circle for Delaunay triangulation.

Name Description
a First vertex FVector2D
b Second vertex FVector2D
c Third vertex FVector2D
index Triangle identifier
edgeIndex Array of edge indices forming this triangle
rayCC Circumscribed circle radius
centerCC Circumscribed circle center
toDelete Marked for deletion during triangulation
isInCircle Returns true if a point is inside the circumscribed circle
isCounterClockWise Returns true if vertices are in counter-clockwise order
isInTriangle Returns true if a point is inside the triangle
isNeighbour Returns true if the triangle shares a given edge
oppositeVertex Returns the vertex not on the given edge
hasVertex Returns true if the triangle contains the given vertex
FCTriangle tri(0, FVector2D(0, 0), FVector2D(100, 0), FVector2D(50, 100));
bool inside = tri.isInTriangle(FVector2D(50, 50));
bool ccw = tri.isCounterClockWise();
FVector2D opposite = tri.oppositeVertex(myEdge);

FCPolygon

2D polygon defined by edges and vertices, with centroid and bounding radius.

Name Description
index Polygon identifier
edgeMap Map of edge index to FCEdge
pointArray Ordered vertex array
centroid Computed centroid (area-weighted)
radius Maximum distance from centroid to any vertex
resize Returns a resized copy using a transform function applied relative to centroid
pointInside Ray-casting point-in-polygon test
FCPolygon poly(0, edgeMap, pointArray);
bool inside = poly.pointInside(FVector2D(50, 50));
FCPolygon smaller = poly.resize([](FVector2D v) { return v * 0.5; });

FCProceduralMeshData

Mesh data container used by worldmaker implementations for tile rendering.

Name Description
LOD Level of detail for this tile
nbPointPerSide Number of vertices per tile side
renderer Whether this tile should be rendered
cellSize Tile cell size (DynamicMesh only)
transform Tile transform (DynamicMesh only)
verticeArray Vertex positions (ProceduralMesh only)
normalArray Vertex normals (ProceduralMesh only)
triangleArray Triangle indices (ProceduralMesh only)
uvArray UV coordinates (ProceduralMesh only)
verticeColorArray Vertex colors (ProceduralMesh only)
tangentArray Tangents (ProceduralMesh only)

FCRectangle

2D axis-aligned rectangle with spatial queries, distance normalization and metadata.

Name Description
index Rectangle identifier
a Top-left corner
b Bottom-right corner
aa Top-right corner (computed)
bb Bottom-left corner (computed)
center Center point (computed)
extend Half-extent from center to b
height Rectangle height
width Rectangle width
margin Relaxation margin
maxValidSpawnDistanceFromCenter Min of half-height and half-width
metadata Optional UCAbstractRectangleMetadata attached to this rectangle
recalculateAll Recomputes all derived properties from a and b
overlap Returns true if two rectangles overlap (considering margins)
intersectAt Finds the intersection point of an edge with the rectangle boundary
pointInside Returns true if a point is inside (with optional tolerance)
pointToPercentage Normalizes a point to [0,1] range within the rectangle
normalizeDistanceToCenterAsRectangle Returns max of normalized X and Y distance (Chebyshev)
normalizeDistanceToCenterAsEllipse Returns elliptical normalized distance (inscribed or circumscribed)
uniformRepartition Distributes N points uniformly inside the rectangle
draw Renders the rectangle as a ProceduralMesh section
FCRectangle rect(0, FVector2D(0, 0), FVector2D(1000, 500));
bool inside = rect.pointInside(FVector2D(200, 300));
float dist = rect.normalizeDistanceToCenterAsRectangle(FVector2D(200, 300));
float ellDist = rect.normalizeDistanceToCenterAsEllipse(FVector2D(200, 300), true);
FVector2D pct = rect.pointToPercentage(FVector2D(500, 250)); // (0.5, 0.5)

// Intersection with an edge
TTuple<FVector2D, FCEdge> result;
if (rect.intersectAt(myEdge, result)) {
    FVector2D point = result.Get<0>();
    FCEdge side = result.Get<1>();
}

UCAbstractRectangleMetadata

Base UObject for metadata attached to rectangles. Extended by UCRoomMetadata and UCClusterMetadata.

Name Description
tag FName tag identifying this rectangle
setOriginPtr Sets the source rectangle pointer
getOriginPtr Returns the source rectangle pointer
getOrigin BlueprintCallable: returns a copy of the source rectangle
UCAbstractRectangleMetadata* meta = rect.metadata;
FName tag = meta->tag;
FCRectangle origin = meta->getOrigin();

CAlgoRelaxType

Enum defining the relaxation algorithm for rectangle spacing.

Name Description
FAST_LARGE Fast relaxation with large displacement steps
SLOW_SMALL Slow relaxation with small displacement steps, recalculates after each pair

FCRectangulator

Collection of rectangles with relaxation, spatial queries and debug rendering.

Name Description
stream Random stream for relaxation
rectangleMap Map of index to FCRectangle
rectangleMapIndex Ordered array of rectangle indices
closestRectangle Finds the closest rectangle to a point, returns distance
pointInside Returns true if a point is inside any rectangle, outputs the rectangle
relaxRoom Iterative overlap relaxation. Returns true if any overlap was resolved
centerList Returns an array of all rectangle centers
debugRectangle Draws debug boxes and MST arrows
FCRectangulator rectang;
FCRectangle closest;
float dist = rectang.closestRectangle(FVector2D(500, 500), closest);

FCRectangle containing;
if (rectang.pointInside(FVector2D(500, 500), containing)) {
    // point is inside 'containing'
}

FVector2D metaA(TNumericLimits<float>::Max(), TNumericLimits<float>::Max());
FVector2D metaB(TNumericLimits<float>::Lowest(), TNumericLimits<float>::Lowest());
bool hadOverlap = rectang.relaxRoom(CAlgoRelaxType::FAST_LARGE, 4.0, metaA, metaB);

FCTile

Hexagonal tile with axial/cube coordinate system and vertex computation.

Name Description
size Tile radius (center to vertex)
q Axial Q coordinate
r Axial R coordinate
axial FVector2D(q, r)
cube FVector(q, r, -q-r)
pixel World position computed from axial coordinates
a, b, c, d, e, f Six vertex positions of the hexagon
recalculateAll Recomputes all derived properties
vertexPosition Returns the position of vertex at given side index (0-5)
hexCoordToPixel Static: converts axial (q,r) to pixel position
pixelToHexCoord Static: converts pixel position to axial coordinates (with rounding)
cubeToAxial Static: converts cube to axial coordinates
axialToCube Static: converts axial to cube coordinates
cubeRound Static: rounds fractional cube coordinates to nearest hex
cubeRange Static: returns all cube coordinates within a range
FCTile tile(3, -2, 150.0f);
FVector2D worldPos = tile.pixel;
FVector2D vertex0 = tile.a; // top vertex

// Static conversions
FVector2D pixel = FCTile::hexCoordToPixel(3, -2, 150.0f);
FVector2D axial = FCTile::pixelToHexCoord(pixel.X, pixel.Y, 150.0f);

UCSplinator

Spline renderer that converts edge arrays into spline curves with ISM or SplineMesh rendering.

Name Description
splineArray Array of created USplineComponent
splineISM UHierarchicalInstancedStaticMeshComponent for ISM-based rendering
splineMeshArray Array of USplineMeshComponent for mesh-based rendering
clean Destroys all spline components and ISMs
drawSpline Converts an edge array into spline curves with ISM or SplineMesh rendering
UCSplinator* splinator = NewObject<UCSplinator>(myActor);
splinator->drawSpline(edgeArray,
    [](float x, float y) { return WorldUtility::zCalculate(x, y); },
    2.0f, myMesh, 100, true);
splinator->clean();

MstType

Enum defining MST corridor style.

Name Description
FLEX Flexible corridors following Delaunay edges directly
STRAIGHT L-shaped corridors with horizontal then vertical segments

FCMstData

Minimum Spanning Tree computed from a Delaunay edge map.

Name Description
mst Array of FCEdge forming the MST
FCMstData mstData(edgeMap, MstType::STRAIGHT, nullptr, 500);
for (const FCEdge& edge : mstData.mst) {
    // process corridor edge
}

FCTriangleData

Delaunay triangulation result with triangle map, edge map, border extraction and MST building.

Name Description
triMap Map of index to FCTriangle
edgeMap Map of index to FCEdge
retrieveBorderEdgeAsPolygon Returns the border edges as a FCPolygon
buildMST Builds a FCMstData from the edge map
FDelaunayMesh2 mesh = FCTriangulator::createTriangulation(vertexArray);
FCTriangleData triData = FCTriangulator::makeDelaunay(mesh);
FCMstData mst = triData.buildMST(MstType::STRAIGHT);
FCPolygon border = triData.retrieveBorderEdgeAsPolygon();

FCVoronoiData

Voronoi diagram computed from a Delaunay mesh.

Name Description
polyMap Map of point index to FCPolygon (Voronoi cells)
FCVoronoiData voronoi = FCTriangulator::makeVoronoi(mesh);
for (auto& [idx, poly] : voronoi.polyMap) {
    // process Voronoi cell
}

FCTriangulator

Static utility for Delaunay triangulation, Voronoi diagrams and debug rendering.

Name Description
createTriangulation Static: creates a FDelaunayMesh2 from a vertex array
makeDelaunay Static: builds FCTriangleData from a mesh with optional triangle filter
debugDelaunay Static: draws debug arrows for all Delaunay edges
makeVoronoi Static: builds FCVoronoiData from a mesh with optional polygon filter
debugVoronoi Static: draws debug arrows for Voronoi edges
debugVoronoi2 Static: draws debug arrows and centroid points for Voronoi polygons
TArray<FVector2D> points = rectang.centerList();
FDelaunayMesh2 mesh = FCTriangulator::createTriangulation(points);
FCTriangleData triData = FCTriangulator::makeDelaunay(mesh);
FCMstData mst = triData.buildMST(MstType::FLEX);
FCVoronoiData voronoi = FCTriangulator::makeVoronoi(mesh);

FCNoiseStruct

Noise layer configuration for multi-octave procedural noise generation.

Name Description
enable Enable this noise layer
description Layer name for editor display
strenghAkaNoiseOutputScale Output scale in meters (default 500)
octave Number of octaves (1-8)
frequenceDeBase Base frequency (default 0.001)
frequenceParOctave Frequency multiplier per octave (default 2.0)
amplitudeParOctave Amplitude multiplier per octave (default 0.5)
octaveDivisor NONE or AMPLITUDE_SUM normalization
redistribution Power curve exponent (default 1.0)
minValue Minimum value clamp (BASE_POSITIVE only)
layerAsMask Index of another layer used as mask (-1 = none)
noiseTransformEnum BASE, BASE_POSITIVE, or RIDGED
FCNoiseStruct ns;
ns.enable = true;
ns.strenghAkaNoiseOutputScale = 500.0f;
ns.octave = 4;
ns.frequenceDeBase = 0.001f;
ns.noiseTransformEnum = NoiseTransformEnum::RIDGED;
ns.octaveDivisor = OctaveDivisor::AMPLITUDE_SUM;

FCFastNoiseStruct

FastNoise library configuration wrapping UFastNoiseWrapper.

Name Description
enable Enable noise generation (default false)
noiseType EFastNoise_NoiseType (default SimplexFractal)
frequency Base frequency (default 0.001)
interp Interpolation method (default Quintic)
fractaltype Fractal type (default FBM)
octaves Number of octaves (default 3)
lacunarity Lacunarity (default 2.0)
gain Gain (default 0.5)
cellularJitter Cellular jitter (default 0.45)
cellularDistanceFunction Distance function (default Euclidean)
cellularReturnType Return type (default CellValue)
fastNoiseWrapper Transient: runtime UFastNoiseWrapper instance
FCFastNoiseStruct fns;
fns.enable = true;
fns.noiseType = EFastNoise_NoiseType::SimplexFractal;
fns.frequency = 0.001f;
fns.octaves = 4;

UCNoisator

Multi-layer noise generator with optional LRU cache. Combines FCFastNoiseStruct with an array of FCNoiseStruct layers. Supports 2D and 3D noise evaluation with masking, redistribution and multiple transform modes.

Name Description
noiseStructArray Array of FCNoiseStruct layers
fastNoiseStruct FCFastNoiseStruct configuration
cache Optional TLruCache<FVector2D, float> for 2D results
instanciate Static: creates and optionally registers a UCNoisator singleton
isEnable Returns true if the fast noise struct is enabled
noiseValue (FVector2D) Evaluates 2D noise at a point (cached if cache is set)
noiseValue (FVector) Evaluates 3D noise at a point
UCNoisator* noisator = nullptr;
UCNoisator::instanciate(outer, CSingletonName::CNAME_Singleton_WorldNoise,
    noisator, seed, fastNoiseStruct, noiseStructArray);

float value2D = noisator->noiseValue(FVector2D(x, y));
float value3D = noisator->noiseValue(FVector(x, y, z));

UCNoiseDataAsset

Data asset for noise configuration, editable in the Unreal Editor content browser.

Name Description
zoom Preview zoom level
origin Preview origin offset
colorMap Array of FCColorLimit (lowerLimit + color) for preview coloring
fastNoiseStruct FCFastNoiseStruct configuration
noiseStructArray Array of FCNoiseStruct layers
EraseAndConvertToMinusOneType Editor button: resets all layers to normalized [-1, 1] output
// Created via Content Browser -> Miscellaneous -> Data Asset -> UCNoiseDataAsset
// Configure layers and fast noise in the Details panel
// Used by spawners to instantiate UCNoisator at runtime

ECAntiAliasingDefinition

Enum for anti-aliasing methods.

Name Description
NOAA No anti-aliasing
FXAA Fast approximate anti-aliasing
TAA Temporal anti-aliasing
MSAAx2 Multi-sample AA 2x (requires forward shading)
MSAAx4 Multi-sample AA 4x (requires forward shading)
MSAAx8 Multi-sample AA 8x (requires forward shading)
TSR Temporal super resolution

FCShadowDefinition

Shadow configuration applied to generated meshes and ISMs.

Name Description
bCastCinematicShadow Cast cinematic shadow (default true)
bCastContactShadow Cast contact shadow (default true)
bCastDynamicShadow Cast dynamic shadow (default true)
bCastFarShadow Cast far shadow (default true)
bCastHiddenShadow Cast hidden shadow (default true)
bCastInsetShadow Cast inset shadow (default true)
bCastStaticShadow Cast static shadow (default true)
bCastVolumetricTranslucentShadow Cast volumetric translucent shadow (default true)
bCastDistanceFieldIndirectShadow Cast distance field indirect shadow (default true)
bCastShadowAsTwoSided Cast shadow as two-sided (default true)
FCShadowDefinition shadow;
shadow.bCastDynamicShadow = true;
shadow.bCastStaticShadow = false;
shadow.bCastContactShadow = true;