Giter Site home page Giter Site logo

Hook up ephem calcs about aframe-ephem HOT 5 CLOSED

sirkitree avatar sirkitree commented on June 27, 2024
Hook up ephem calcs

from aframe-ephem.

Comments (5)

sirkitree avatar sirkitree commented on June 27, 2024

from @kentbye

Below is the code snippet from my nataltransits code that does the heavy lifting from moshier's ephemeris.
It takes an input date and a const.body (which is one of the planets) into $processor.calc. (the input dates are taken from the dropdown menus)

    for (var key in $moshier.body) {
      if (key != 'init' &&  key != 'earth' &&  key != 'sirius'){
        if ($moshier.body.hasOwnProperty(key)) {
          $const.body = $moshier.body[key];
          $processor.calc ($inputdate, $const.body);
          console.log(JSON.stringify($const.body));
          $planetLongitude[key] = Math.round(parseFloat($const.body.position.apparentLongitude)*10000)/10000;          
          $astrologicalSign = signs[Math.ceil($const.body.position.apparentLongitude/30)];
          if (key=='moon') {
	          $illuminatedFraction = $const.body.position.illuminatedFraction; 
	          if ($const.body.position.phaseDaysBefore) {
		          nextPhase = Math.round($const.body.position.phaseDaysBefore*24*100)/100 + " hrs until ";
	          } else {
			        nextPhase = Math.round($const.body.position.phaseDaysPast*24*100)/100 + " hrs after ";  
	          }
          }

          //Output the position to the screen.
          //document.getElementById(key).innerHTML = key + " = " + $astrologicalSign + " " + $const.body.position.apparentLongitude30String;
        }
      }
    }

from aframe-ephem.

sirkitree avatar sirkitree commented on June 27, 2024

Before I can implement this, I first have to figure out how to get the position of an element once it's been moved with your hand, and correlate that to the format that the moshier calculation expects. In the above, what is the value of $moshier.body?

from aframe-ephem.

sirkitree avatar sirkitree commented on June 27, 2024

I found a way to move the spheres and constrain them to a radius and a plane. next up is to make other sphere's move when you move just one, then I think I can plug in some calculations.

from aframe-ephem.

sirkitree avatar sirkitree commented on June 27, 2024

I currently have the ephemeris calculations hooked up to a radial dial. As you turn the volume up (so to speak) you increment the day, and as you turn it down, it decrements the days. Each value change recalculates the position of the planets and it looks really cool. The upper planets spin pretty fast, almost too fast, but the lower ones you can see orbit around you back and forth, sometimes reversing, as is typical when observed from earth.

Having the day radial is good, now to add one for the month and year.

from aframe-ephem.

sirkitree avatar sirkitree commented on June 27, 2024

Ephemeris calculations are hooked up. I'm not sure how accurate they are. I'm currently doing the following:

// these roughly correspond to Boston, MA
$const.tlong = -71.10; // longitude
$const.glat = 42.37; // latitude

// initial date
var date = {year: 1981, month: 10, day: 4, hours: 1, minutes: 52, seconds: 0};

// for each planet, calculate it's position from the moshier calculations give the date
var body = $moshier.body[planetName];
$processor.calc(date, body);

// sin and cos of the body position gives us the x and z
var xPos = Math.cos(body.position.apparentLongitude);
var zPos = Math.sin(body.position.apparentLongitude);

// y is just incrementally moving upwards from about knee height
var yPos = ((startPos + (index * 2) / planetTotal) * -1);

Closing this for now. I'm not sure if it's accurate, but it gives us values good enough for visualization. I'd like to open up a new issue from here if there are changes to the calculations.

from aframe-ephem.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.