Package models.distances

Source Code of models.distances.EuclidianSimple2D

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 EuclidianSimple2D extends Distance {

  private static String name = "EuclideanSimple2D";
  private static String description = "Distance 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 = (x1 - x2);
    double y = (y1 - y2);
    double dist = Math.sqrt(x*x + y*y);
    return dist;
  }

  @Override
  public String getName() {
    return name;
  }

  @Override
  public String getDescription() {
    return description;
  }
 
  @Override
  public int getDimension(){
    return dimension;
  }

}
TOP

Related Classes of models.distances.EuclidianSimple2D

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.