public class MetricHelper
extends java.lang.Object
Constructor and Description |
---|
MetricHelper() |
Modifier and Type | Method and Description |
---|---|
static double |
calculateDistance(double p,
java.awt.geom.Point2D a,
java.awt.geom.Point2D b)
Calculates the (2-dimensional) p-distance between the vectors a and b
|
static double |
calculateDistance(java.awt.geom.Point2D a,
java.awt.geom.Point2D b,
java.lang.String metric)
Calculates the (2-dimensional) distance between the vectors a and b according to currentMetric
|
static double |
euclidianDistance(java.awt.geom.Point2D a,
java.awt.geom.Point2D b)
Calculates the (2-dimensional) euclidian distance between the vectors a and b
|
static double |
manhattanDistance(java.awt.geom.Point2D a,
java.awt.geom.Point2D b)
Calculates the (2-dimensional) manhattan/taxicab distance between the vectors a and b
|
static double |
maximumDistance(java.awt.geom.Point2D a,
java.awt.geom.Point2D b)
Calculates the (2-dimensional) maximum distance between the vectors a and b
|
static double |
pDistance(double p,
java.awt.geom.Point2D a,
java.awt.geom.Point2D b)
Calculates the (2-dimensional) p-distance between the vectors a and b
|
public static double calculateDistance(java.awt.geom.Point2D a, java.awt.geom.Point2D b, java.lang.String metric) throws java.lang.IllegalStateException
a
- vector between which the metric is calculatedb
- vector between which the metric is calculatedmetric
- java.lang.IllegalStateException
- gets thrown when currentMetric is either not set or set to a value that is not implementedpublic static double calculateDistance(double p, java.awt.geom.Point2D a, java.awt.geom.Point2D b) throws java.lang.IllegalArgumentException
a
- (2-dimensional) vector between which the metric is calculatedb
- (2-dimensional) vector between which the metric is calculatedjava.lang.IllegalArgumentException
- gets thrown when p-value is < 1 (and thus not implemented)public static double manhattanDistance(java.awt.geom.Point2D a, java.awt.geom.Point2D b)
a
- (2-dimensional) vector between which the metric is calculatedb
- (2-dimensional) vector between which the metric is calculatedpublic static double euclidianDistance(java.awt.geom.Point2D a, java.awt.geom.Point2D b)
a
- (2-dimensional) vector between which the metric is calculatedb
- (2-dimensional) vector between which the metric is calculatedpublic static double maximumDistance(java.awt.geom.Point2D a, java.awt.geom.Point2D b)
a
- (2-dimensional) vector between which the metric is calculatedb
- (2-dimensional) vector between which the metric is calculatedpublic static double pDistance(double p, java.awt.geom.Point2D a, java.awt.geom.Point2D b) throws java.lang.IllegalArgumentException
a
- (2-dimensional) vector between which the metric is calculatedb
- (2-dimensional) vector between which the metric is calculatedjava.lang.IllegalArgumentException
- gets thrown when p-value is < 1 (and thus not implemented)