com.formulasearchengine.mathmltools.similarity.distances.earthmover.Feature2D Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mathml-similarity Show documentation
Show all versions of mathml-similarity Show documentation
API to calculate similarities between MathML documents.
package com.formulasearchengine.mathmltools.similarity.distances.earthmover;
/**
* @author Telmo Menezes ([email protected])
*/
public class Feature2D implements Feature {
private double x;
private double y;
public Feature2D(double x, double y) {
this.x = x;
this.y = y;
}
public double groundDist(Feature f) {
Feature2D f2d = (Feature2D) f;
double deltaX = x - f2d.x;
double deltaY = y - f2d.y;
return Math.sqrt((deltaX * deltaX) + (deltaY * deltaY));
}
}