public class Snapper3D extends Snapper
Modifier and Type | Field and Description |
---|---|
private Point3d[] |
grid |
private static double |
gridSize |
distanceFunction, lineDistanceFunction
Constructor and Description |
---|
Snapper3D(AbstractMetric distanceFunction,
DistanceFunctionType lineDistanceFunction) |
Snapper3D(double gridSize,
AbstractMetric distanceFunction,
DistanceFunctionType lineDistanceFunction) |
Modifier and Type | Method and Description |
---|---|
double[][] |
convert(Point3d[] array) |
Point3d[] |
createGrid(int xSize,
int ySize,
int zSize) |
Point3d[] |
doSnapping(double[][] centres) |
Point3d[] |
doSnapping(Point3d[] line) |
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
|
double[][] |
getGrid() |
Point3d[] |
getNeighbouringUnits(Point3d p) |
static double[] |
normalise(double[] vec) |
private Point3d[] |
snap(Point3d[] line)
Returns a snapped line of the given line.
|
private Point3d[] |
snapPoint(Point3d startPoint,
Point3d[] line,
int currentPosition,
int direction,
int bins)
Snaps the next point on the line.
|
private Point3d[] grid
private static double gridSize
public Snapper3D(AbstractMetric distanceFunction, DistanceFunctionType lineDistanceFunction)
public Snapper3D(double gridSize, AbstractMetric distanceFunction, DistanceFunctionType lineDistanceFunction)
public static double[] normalise(double[] vec)
public Point3d[] doSnapping(double[][] centres) throws SOMToolboxException
SOMToolboxException
public Point3d[] doSnapping(Point3d[] line) throws SOMToolboxException
SOMToolboxException
private int getDirection(Point3d current, Point3d next)
current
- current nodenext
- next node to go topublic Point3d[] createGrid(int xSize, int ySize, int zSize)
public double[][] getGrid()
public double[][] convert(Point3d[] array)
private Point3d[] snap(Point3d[] line)
private Point3d[] snapPoint(Point3d startPoint, Point3d[] line, int currentPosition, int direction, int bins)
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