Class NullRegionMaxEdge

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

public final class NullRegionMaxEdge
extends Object
implements IContourAlgorithm

Adds vertices to a contour such that no null region edge segment exceeds the allowed edge length.

Only null region edges are operated on.

Constructor Summary
NullRegionMaxEdge(int maxEdgeLength)
Method Summary
 void apply(ArrayList<Integer> sourceVerts, ArrayList<Integer> resultVerts)
          Apply an algorithm to a contour.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public NullRegionMaxEdge(int maxEdgeLength)

maxEdgeLength - The maximum length of polygon edges that represent the border of the navmesh.

More vertices will be added to navmesh border edges if this value is exceeded for a particular edge. In certain cases this will reduce the number of thin, long triangles in the navmesh.

A value of zero will disable this feature.

Constraints: >= 0

Method Detail


public void apply(ArrayList<Integer> sourceVerts,
                  ArrayList<Integer> resultVerts)
Apply an algorithm to a contour.

The implementation is permitted to require that the the result vertices be seeded with existing data. In this case the argument becomes an in/out argument rather than just an out argument.

The resultVerts argument is expected to be seeded with at least one edge.

Specified by:
apply in interface IContourAlgorithm
sourceVerts - The source vertices that represent the contour in the form (x, y, z, regionID).
resultVerts - The contour vertices produced by the operation in the form (x, y, z, sourceIndex).

Source index is the index (not pointer) of the related source vertex in sourcVerts. E.g. If the vertex in resultsList references the vertex at position 12 of sourceVerts, then sourceIndex will be 3 (12 / 4).

Project Home and Source Code

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