org.critterai.nmgen
Class MatchNullRegionEdges

java.lang.Object
  extended by org.critterai.nmgen.MatchNullRegionEdges
All Implemented Interfaces:
IContourAlgorithm

public final class MatchNullRegionEdges
extends Object
implements IContourAlgorithm

Applies an algorithm to contours which results in null-region edges following the original detail source geometry edge more closely.

See Also:
Visualizations

Constructor Summary
MatchNullRegionEdges(float threshold)
          Constructor.
 
Method Summary
 void apply(ArrayList<Integer> sourceVerts, ArrayList<Integer> inoutResultVerts)
          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

MatchNullRegionEdges

public MatchNullRegionEdges(float threshold)
Constructor.

Parameters:
threshold - The maximum distance the edge of the contour may deviate from the source geometry.

Setting this lower will result in the navmesh edges following the geometry contour more accurately at the expense of an increased vertex count.

Setting the value to zero is not recommended since it can result in a large increase in the number of vertices at a high processing cost.

Constraints: >= 0

Method Detail

apply

public void apply(ArrayList<Integer> sourceVerts,
                  ArrayList<Integer> inoutResultVerts)
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.

Adds vertices from the source list to the result list such that if any null region vertices are compared against the result list, none of the vertices will be further from the null region edges than the allowed threshold.

Only null-region edges are operated on. All other edges are ignored.

The result vertices is expected to be seeded with at least two source vertices.

Specified by:
apply in interface IContourAlgorithm
Parameters:
sourceVerts - The source vertices that represent the contour in the form (x, y, z, regionID).
inoutResultVerts - 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.