movingregion
Class ObjectMatcher

java.lang.Object
  |
  +--movingregion.ObjectMatcher

public class ObjectMatcher
extends java.lang.Object

This class contains the code to discover which cycles in two sets of cycles that overlap, and run the moving cycle creation algorithm found in the TriangleRep class.


Constructor Summary
ObjectMatcher()
          Constructor without parameters.
ObjectMatcher(double minoverl, double minoverlmatch, double minoverlconc)
          Constructor with only the matching criterion parameters.
ObjectMatcher(LineWA[][] mregions0, LineWA[][] mregions1, double minoverl, double minoverlmatch, double minoverlconc)
          Constructor with all parameters.
 
Method Summary
 void addCycle(LineWA[] cycle, int time, int dx, int dy, double rot)
          Adds a cycle to one of the snapshots.
 void computeOverlapGraph()
          Computes the overlap graphs between the two sets of cycles already stored in this object.
 void findMatches(int whichregion)
          Matches all cycles in one snapshot which have matches in the other snapshot and adds the graph representations to the trianglereps list.
 int[][][] getMatchEdges()
          This function returns which cycles were used to create each moving cycle.
 TriangleRep[] getTriangleReps()
          Gets the result of the interpolation.
 void matchCycles()
          Matches the cycles of the two consecutive snapshots stored in this object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectMatcher

public ObjectMatcher()
Constructor without parameters. Initializes everything to default values

ObjectMatcher

public ObjectMatcher(double minoverl,
                     double minoverlmatch,
                     double minoverlconc)
Constructor with only the matching criterion parameters.
Parameters:
minoverl - The minimum overlap between two cycles that is required for an overlap graph edge to be inserted between the two.
minoverlmatch - The minimum overlap between two concavities for the interpolator to match them.
minoverlconc - The minimum overlap between two concavities for an overlap graph edge to be inserted between them by the concavity matcher.

ObjectMatcher

public ObjectMatcher(LineWA[][] mregions0,
                     LineWA[][] mregions1,
                     double minoverl,
                     double minoverlmatch,
                     double minoverlconc)
Constructor with all parameters. Initializes the class variables to the input values and runs the matching algorithm.
Parameters:
mregions0 - The first snapshot represented as a double array of LineWA objects. The outer array represents the cycles and the inner array the individual lines in each cycle.
mregions1 - The second snapshot represented as a double array of LineWA objects.
minoverl - The minimum overlap between two cycles that is required for an overlap graph edge to be inserted between the two.
minoverlmatch - The minimum overlap between two concavities for the interpolator to match them.
minoverlconc - The minimum overlap between two concavities for an overlap graph edge to be inserted between them by the concavity matcher.
Method Detail

addCycle

public void addCycle(LineWA[] cycle,
                     int time,
                     int dx,
                     int dy,
                     double rot)
Adds a cycle to one of the snapshots. This function may also move and rotate the cycle before inserting it.
Parameters:
cycle - The cycle represented as a LineWA array.
time - Which snapshot the cycle should be added to. This may be either 0 or 1.
dx - How much the cycle should be moved in the x direction.
dy - How much the cycle should be moved in the y direction.
rot - How many radians the cycle should be rotated.

computeOverlapGraph

public void computeOverlapGraph()
Computes the overlap graphs between the two sets of cycles already stored in this object.

findMatches

public void findMatches(int whichregion)
Matches all cycles in one snapshot which have matches in the other snapshot and adds the graph representations to the trianglereps list.
Parameters:
whichregion - Which snapshot should be matched. May be either 0 or 1.

matchCycles

public void matchCycles()
Matches the cycles of the two consecutive snapshots stored in this object.

getTriangleReps

public TriangleRep[] getTriangleReps()
Gets the result of the interpolation. This function must be called after the interpolation algorithm is run to get any meaningful result. (The interpolation algorithm is run by calling the matchCycles function or using the constructor with all parameters.)
Returns:
The graph representations of all the moving cycles created by interpolating the snapshots stored in this object. The graph representations are stored in a TriangleRep array.

getMatchEdges

public int[][][] getMatchEdges()
This function returns which cycles were used to create each moving cycle.
Returns:
A triple array of integers, which has the following structure: return_value[moving cycle][snapshot][index] = snapindex. Moving cycle is the index in the array returned by getTriangleReps of the moving cycle for which you want to know the snapshots. Snapshot is the snapshot, and index is the number in this list of the snapshot. snapindex is the index of the cycle in the list of cycles that makes up the snapshot.