[This is preliminary documentation and is subject to change.]

Builds region data for the heightfield using watershed partitioning.

Namespace: org.critterai.nmgen
Assembly: cai-nmgen (in cai-nmgen.dll) Version: 0.4.0.0 (0.4.0.0)

Syntax

         
 C#  Visual Basic  Visual C++ 
public bool BuildRegions(
	BuildContext context,
	int borderSize,
	int minRegionArea,
	int mergeRegionArea
)
Public Function BuildRegions ( _
	context As BuildContext, _
	borderSize As Integer, _
	minRegionArea As Integer, _
	mergeRegionArea As Integer _
) As Boolean
public:
bool BuildRegions(
	BuildContext^ context, 
	int borderSize, 
	int minRegionArea, 
	int mergeRegionArea
)

Parameters

context
BuildContext
The context to use duing the operation.
borderSize
Int32
The AABB border size to apply.
minRegionArea
Int32
The minimum area allowed for unconnected (island) regions. [Units: Spans]
mergeRegionArea
Int32
The maximum region size that will be considered for merging with another region. [Units: Spans]

Return Value

True if the operation completed successfully.

Remarks

Non-null regions consist of connected, non-overlapping walkable spans that form a single contour.

The region data is available via MaxRegion and GetSpanData(array<CompactSpan>[]()[][]).

If a region forms an area that is smaller than minRegionArea, all spans in the region is set to NullRegion.

Watershed partitioning can result in smaller than necessary regions, especially in diagonal corridors. mergeRegionArea helps reduce unecessarily small regions.

See Also