Package models.distances

Source Code of models.distances.Simple2D

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;
  }

}
TOP

Related Classes of models.distances.Simple2D

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.