at.tuwien.ifs.somtoolbox.visualization
Class Snapper3D
java.lang.Object
at.tuwien.ifs.somtoolbox.visualization.Snapper
at.tuwien.ifs.somtoolbox.visualization.Snapper3D
public class Snapper3D
- extends Snapper
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
grid
private Point3d[] grid
gridSize
private static double gridSize
Snapper3D
public Snapper3D(AbstractMetric distanceFunction,
DistanceFunctionType lineDistanceFunction)
Snapper3D
public Snapper3D(double gridSize,
AbstractMetric distanceFunction,
DistanceFunctionType lineDistanceFunction)
normalise
public static double[] normalise(double[] vec)
doSnapping
public Point3d[] doSnapping(double[][] centres)
throws SOMToolboxException
- Throws:
SOMToolboxException
doSnapping
public Point3d[] doSnapping(Point3d[] line)
throws SOMToolboxException
- Throws:
SOMToolboxException
getDirection
private int getDirection(Point3d current,
Point3d next)
- returns the direction between two nodes based on the following scheme: 0 7 left up up right up 1 \ | / 6 left - *
- right 6 / | \ 5 left down down right down 3 4
- Parameters:
current
- current nodenext
- next node to go to
- Returns:
- dir from current to next
createGrid
public Point3d[] createGrid(int xSize,
int ySize,
int zSize)
getGrid
public double[][] getGrid()
convert
public double[][] convert(Point3d[] array)
snap
private Point3d[] snap(Point3d[] 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.
snapPoint
private Point3d[] snapPoint(Point3d startPoint,
Point3d[] line,
int currentPosition,
int direction,
int bins)
- 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)bins
- number of bins
- Returns:
- a snapped line
getNeighbouringUnits
public Point3d[] getNeighbouringUnits(Point3d p)