Example #1
0
  public void calcPlanetaryPosition(Set<Planet> planets) {

    planetPos = new EnumMap<Planet, Double>(Planet.class);

    isReverse = new EnumMap<Planet, Boolean>(Planet.class);

    double[] res = new double[6];
    StringBuffer sbErr = new StringBuffer();

    for (Planet planet : planets) {

      int rc =
          sw.swe_calc_ut(sweDate.getJulDay(), planet.planetNo(), AstroConsts.iflag, res, sbErr);
      planetPos.put(planet, res[0]);

      if ((res[3] < 0) && (!Planet.isNode(planet))) {

        isReverse.put(planet, true);
      }
    }

    // No-way to compute ketu pos from swisseph
    Double rahuPos = planetPos.get(Planet.Rahu);

    if (rahuPos != null) {
      double ketuPos = (rahuPos + 180.00) % 360;
      planetPos.put(Planet.Ketu, ketuPos);
    }
    // System.out.println(sbErr);
  }
Example #2
0
  public double getPlanetSpeed(Planet planet) {

    double[] res = new double[6];
    StringBuffer sbErr = new StringBuffer();
    sw.swe_calc_ut(sweDate.getJulDay(), planet.planetNo(), AstroConsts.iflag, res, sbErr);
    return res[3];
  }
Example #3
0
  public static double calcNatonnataBalaDeg(SweDate birthSD, double birthTime) {

    SwissEph sw = new SwissEph();

    // sw.swe_set_ephe_path("d\\:\\\\AstroSoft");
    double et = birthSD.getJulDay() + birthSD.getDeltaT();
    DblObj E = new DblObj();
    StringBuffer sbErr = new StringBuffer();
    int diff = sw.swe_time_equ(et, E, sbErr);
    double EqnOfTime = E.val * 24 * -1;
    double bTimeDeg = (birthTime + EqnOfTime) * 15;

    if (bTimeDeg > 180) {
      bTimeDeg = 360 - bTimeDeg;
    }
    return bTimeDeg;
  }
Example #4
0
  public Rasi getAscendant(double birthLong, double birthLat) {
    double[] ac = new double[10];
    double[] positions = new double[13];

    sw.swe_houses(
        sweDate.getJulDay(), HOUSE_FLAG, birthLat, birthLong, HOUSE_SYSTEM, positions, ac);

    return Rasi.ofDeg(positions[1]);
  }
Example #5
0
  public HousePosition calcHousePosition(double birthLong, double birthLat) {

    double[] ac = new double[10];
    double[] positions = new double[13];

    sw.swe_houses(
        sweDate.getJulDay(), HOUSE_FLAG, birthLat, birthLong, HOUSE_SYSTEM, positions, ac);

    // System.out.println()
    HousePosition housePosition = new HousePosition(positions);
    housePosition.setSiderealTime((double) (ac[2] / 15));

    return housePosition;
  }
Example #6
0
  public void setAyanamsa(Ayanamsa ayanamsa) {

    sw.swe_set_sid_mode(ayanamsa.ayaValue(), 0.0, 0.0);
    calcPlanetaryPosition();
  }
Example #7
0
 public SwissHelper() {
   sw = new SwissEph();
   sw.swe_set_sid_mode(AstroSoft.getPreferences().getAyanamsa().ayaValue(), 0.0, 0.0);
 }
Example #8
0
 public double getAyanamsa() {
   return sw.swe_get_ayanamsa_ut(sweDate.getJulDay());
 }