package models.distances;
import models.coordinates.EquatorialCoordinates;
import views.Astre;
/**
* Angular Euclidian 2D distance close to what can be seen from the Earth
* @author clement
*
*/
public class Simple2D extends Distance {
private static String name = "Simple2D";
private static String description = "Norme infinie déterminée par l'arc entre deux étoiles sur la sphère céleste";
private static final int dimension = 2;
/**
*
* @param a
* @param b
* @return The visible angle (in rad) between two stars
*/
@Override
public double get(Astre a, Astre b) {
EquatorialCoordinates ac = a.getCoodinates();
EquatorialCoordinates bc = b.getCoodinates();
double x1 = ac.getDeclinaison();
double x2 = bc.getDeclinaison();
double y1 = ac.getAscention();
double y2 = bc.getAscention();
double x = Math.abs(x1 - x2);
double y = Math.abs(y1 - y2);
return x+y;
}
@Override
public String getName() {
return name;
}
@Override
public String getDescription() {
return description;
}
@Override
public int getDimension(){
return dimension;
}
}