at.tuwien.ifs.somtoolbox.visualization
Class Snapper2D
java.lang.Object
at.tuwien.ifs.somtoolbox.visualization.Snapper
at.tuwien.ifs.somtoolbox.visualization.Snapper2D
public class Snapper2D
- extends Snapper
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
grid
private Point2D[] grid
gridSums
private double[] gridSums
gridDiffs
private double[] gridDiffs
Snapper2D
public Snapper2D(AbstractMetric distanceFunction,
DistanceFunctionType lineDistanceFunction,
int xSize,
int ySize)
createGrid
public Point2D[] createGrid(int xSize,
int ySize)
snapPoint
private Point2D[] snapPoint(Point2D startPoint,
Point2D[] line,
int currentPosition,
int direction)
- Snaps the next point on the line.
- Parameters:
startPoint
- the point to start fromline
- the line to snapcurrentPosition
- the current position on the linedirection
- forward (1) or backwards (-1)
- Returns:
- a snapped line
snap
public Point2D[][] snap(Point2D[][] lines)
snap
public Point2D[] snap(Point2D[] line)
- Returns a snapped line of the given line. Snapping the metro lines means to find a line as similar as possible to
the given line, which has all bin centres in the unit centres, and line segments are connected in multiples of
45° degree angles to each other.
TODO: Consider disallowing 135° / 315° as too sharp turns.
getNeighbouringUnits
public Point2D[] getNeighbouringUnits(Point2D p)
- Finds the four units around the given point.
- Parameters:
p
- point to find neighbours for.
- Returns:
- four neighbours.