at.tuwien.ifs.somtoolbox.clustering.functions
Class ComponentLine2DDistance

java.lang.Object
  extended by at.tuwien.ifs.somtoolbox.clustering.functions.ComponentLine2DDistance
All Implemented Interfaces:
ClusterElementFunctions<ComponentLine2D>

public class ComponentLine2DDistance
extends Object
implements ClusterElementFunctions<ComponentLine2D>


Field Summary
private  DistanceFunctionType distanceType
           
 
Fields inherited from interface at.tuwien.ifs.somtoolbox.clustering.functions.ClusterElementFunctions
DF
 
Constructor Summary
ComponentLine2DDistance(DistanceFunctionType distanceType)
           
 
Method Summary
static double areaLineDistance(Point2D[] line1, Point2D[] line2)
          Computes the distance between two lines by computing the area stretching between them.
static double curveSlope(Point2D start, Point2D end)
          Computes the slope of a line/curve between the given points.
 double distance(ComponentLine2D line1, ComponentLine2D line2)
           
 double distance(Point2D[] points1, Point2D[] points2)
           
static double editLineDistance(Point2D[] line1, Point2D[] line2)
          Computes the distance between two lines in terms of edit operations necessary to move one line onto the other.
static double euclideanLineDistance(Point2D[] line1, Point2D[] line2)
          Computes the distance between two lines in terms of absolute distances between single segments.
static double euclideanLineDistanceDifferentNumberOfStops(Point2D[] line1, Point2D[] line2)
           
static ClusterElementFunctions<ComponentLine2D> getEuclidean()
           
 int getIndexOfLineClosestToMean(Cluster<? extends ComponentLine2D> elements)
           
private static Point2D getNextValidPoint(Point2D[] line, int index)
           
private static Point2D getPreviousValidPoint(Point2D[] line, int index)
           
static boolean linesParallel(Point2D line1Begin, Point2D line1End, Point2D line2Begin, Point2D line2End)
          Computes if two lines are parallel to each other, by comparing their slopes.
 ComponentLine2D meanObject(Cluster<? extends ComponentLine2D> elements)
           
static double minimumEuclideanLineDistance(Point2D[] line1, Point2D[] line2)
          Computes the distance between two lines in terms of distances between single segments.
 String toString(Cluster<? extends ComponentLine2D> elements)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

distanceType

private DistanceFunctionType distanceType
Constructor Detail

ComponentLine2DDistance

public ComponentLine2DDistance(DistanceFunctionType distanceType)
Method Detail

getEuclidean

public static ClusterElementFunctions<ComponentLine2D> getEuclidean()

distance

public double distance(ComponentLine2D line1,
                       ComponentLine2D line2)
Specified by:
distance in interface ClusterElementFunctions<ComponentLine2D>

distance

public double distance(Point2D[] points1,
                       Point2D[] points2)

euclideanLineDistance

public static double euclideanLineDistance(Point2D[] line1,
                                           Point2D[] line2)
Computes the distance between two lines in terms of absolute distances between single segments.


getNextValidPoint

private static Point2D getNextValidPoint(Point2D[] line,
                                         int index)

getPreviousValidPoint

private static Point2D getPreviousValidPoint(Point2D[] line,
                                             int index)

euclideanLineDistanceDifferentNumberOfStops

public static double euclideanLineDistanceDifferentNumberOfStops(Point2D[] line1,
                                                                 Point2D[] line2)

minimumEuclideanLineDistance

public static double minimumEuclideanLineDistance(Point2D[] line1,
                                                  Point2D[] line2)
Computes the distance between two lines in terms of distances between single segments.


editLineDistance

public static double editLineDistance(Point2D[] line1,
                                      Point2D[] line2)
Computes the distance between two lines in terms of edit operations necessary to move one line onto the other. This basically computes distances for beginning and end points of single lines and penalises non parallel lines .


linesParallel

public static boolean linesParallel(Point2D line1Begin,
                                    Point2D line1End,
                                    Point2D line2Begin,
                                    Point2D line2End)
Computes if two lines are parallel to each other, by comparing their slopes.


curveSlope

public static double curveSlope(Point2D start,
                                Point2D end)
Computes the slope of a line/curve between the given points.


areaLineDistance

public static double areaLineDistance(Point2D[] line1,
                                      Point2D[] line2)
Computes the distance between two lines by computing the area stretching between them.


meanObject

public ComponentLine2D meanObject(Cluster<? extends ComponentLine2D> elements)
Specified by:
meanObject in interface ClusterElementFunctions<ComponentLine2D>

getIndexOfLineClosestToMean

public int getIndexOfLineClosestToMean(Cluster<? extends ComponentLine2D> elements)

toString

public String toString(Cluster<? extends ComponentLine2D> elements)
Specified by:
toString in interface ClusterElementFunctions<ComponentLine2D>