maspack.util
Class FastMarcherBase

java.lang.Object
  extended by maspack.util.FastMarcherBase
Direct Known Subclasses:
FastDijkstraMarcher, FastRadialMarcher

public abstract class FastMarcherBase
extends java.lang.Object

Base class for fast marching types of algorithms

Author:
Antonio

Constructor Summary
FastMarcherBase(int dataSize, FastMarcherUtility utility)
          Creates a FastMarcher object for a given data size, and uses the supplied utility object to connect to data for finding neighbours and computing distances
 
Method Summary
 void clear()
          Removes internal distance and voronoi arrays so they will be re-created on the next call to @{link march(int)
static IndexedBinaryHeap createDistanceHeap(double[] distance)
          Creates a binary heap that is useful for finding the farthest point in the supplied array of distances.
 double[] getDistance()
          Retrieves a vector of the current distances
 IndexedBinaryHeap getDistanceHeap()
          Retrieves an associated distance binary heap.
 int getFarthest()
          Gets the index of the farthest point, -1 if distances are not initialized
 int[] getVoronoi()
          Gets the voronoi region assignments.
 void initializeArrays()
          Creates distance and voronoi arrays if required, and fills them with their default values (distance=infinity, voronoi=-1).
 void march(int start)
          Performs the fast marching algorithm starting at data point with index start.
 void march(int[] start)
          Performs the fast marching algorithm starting at points with indices given in start.
 void march(int[] start, int[] voronoi, double[] distance)
          Performs the fast marching algorithm starting at data points with indices given by start, using the supplied voronoi and distance arrays instead of this object's internal version.
 void march(int start, int[] voronoi, double[] distance)
          Performs the fast marching algorithm starting at data point with index start, using the supplied voronoi and distance arrays instead of this object's internal versions.
 void reset()
          Creates and/or re-initializes internal set of distance and voronoi arrays
 void setDistance(double[] d)
          Sets the distance vector to use
 void setDistanceHeap(IndexedBinaryHeap distHeap)
          Useful for farthest point sampling, sets a heap to be updated every time a distance value is assigned.
 void setVoronoi(int[] v)
          Sets the vector to be used to hold voronoi indicies
 void startmarch(int start)
           
 void startmarch(int[] start)
          Performs the fast marching algorithm starting at data points with indices given by start, using the supplied voronoi and distance arrays instead of this object's internal version.
 int step()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FastMarcherBase

public FastMarcherBase(int dataSize,
                       FastMarcherUtility utility)
Creates a FastMarcher object for a given data size, and uses the supplied utility object to connect to data for finding neighbours and computing distances

Method Detail

createDistanceHeap

public static IndexedBinaryHeap createDistanceHeap(double[] distance)
Creates a binary heap that is useful for finding the farthest point in the supplied array of distances.


setDistanceHeap

public void setDistanceHeap(IndexedBinaryHeap distHeap)
Useful for farthest point sampling, sets a heap to be updated every time a distance value is assigned.

Parameters:
distHeap -

getDistanceHeap

public IndexedBinaryHeap getDistanceHeap()
Retrieves an associated distance binary heap. If one does not exist, creates one. This is useful for keeping track of the farthest point


getFarthest

public int getFarthest()
Gets the index of the farthest point, -1 if distances are not initialized


getDistance

public double[] getDistance()
Retrieves a vector of the current distances


setDistance

public void setDistance(double[] d)
Sets the distance vector to use


getVoronoi

public int[] getVoronoi()
Gets the voronoi region assignments. Each value corresponds to the index of the data element that was used as a starting point


setVoronoi

public void setVoronoi(int[] v)
Sets the vector to be used to hold voronoi indicies

Parameters:
v -

initializeArrays

public void initializeArrays()
Creates distance and voronoi arrays if required, and fills them with their default values (distance=infinity, voronoi=-1).


march

public void march(int[] start)
Performs the fast marching algorithm starting at points with indices given in start.


march

public void march(int start)
Performs the fast marching algorithm starting at data point with index start.


march

public void march(int start,
                  int[] voronoi,
                  double[] distance)
Performs the fast marching algorithm starting at data point with index start, using the supplied voronoi and distance arrays instead of this object's internal versions.


march

public void march(int[] start,
                  int[] voronoi,
                  double[] distance)
Performs the fast marching algorithm starting at data points with indices given by start, using the supplied voronoi and distance arrays instead of this object's internal version.


startmarch

public void startmarch(int start)

startmarch

public void startmarch(int[] start)
Performs the fast marching algorithm starting at data points with indices given by start, using the supplied voronoi and distance arrays instead of this object's internal version.


step

public int step()

clear

public void clear()
Removes internal distance and voronoi arrays so they will be re-created on the next call to @{link march(int)


reset

public void reset()
Creates and/or re-initializes internal set of distance and voronoi arrays