Class FilterOutSmallRegions

  extended by org.critterai.nmgen.FilterOutSmallRegions
All Implemented Interfaces:

public final class FilterOutSmallRegions
extends Object
implements IOpenHeightFieldAlgorithm

Removes and merges small regions within a height field.

Applies two algorithms:

See Also:
Region Generation

Constructor Summary
FilterOutSmallRegions(int minUnconnectedRegionSize, int mergeRegionSize)
Method Summary
 void apply(OpenHeightfield field)
          Applies the algorithm to the height field.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public FilterOutSmallRegions(int minUnconnectedRegionSize,
                             int mergeRegionSize)

minUnconnectedRegionSize - The minimum region size for unconnected (island) regions. (Voxels)

Any generated regions that are not connected to any other region and are smaller than this size will be culled before final navmesh generation. I.e. No longer considered traversable.

Constraints: > 0

mergeRegionSize - Any regions smaller than this size will, if possible, be merged with larger regions. (Voxels)

Helps reduce the number of unnecessarily small regions that can be formed. This is especially an issue in diagonal path regions where inherent faults in the region generation algorithm can result in unnecessarily small regions.

If a region cannot be legally merged with a neighbor region, then it will be left alone.

Constraints: >= 0

See Also:
Detailed parameter information.
Method Detail


public void apply(OpenHeightfield field)
Applies the algorithm to the height field.

The height field must contain valid region information in order for this algorithm to be effective.

Specified by:
apply in interface IOpenHeightFieldAlgorithm
field - The field to apply the algorithm to.

Project Home and Source Code

Copyright 2010 Stephen Pratt. All rights reserved. Use is subject to license terms.