Clock | mathbabe

Guest post by Sander O’Neil

Clock | mathbabe

This is a follow up to this post https://mathbabe.org/2015/03/12/earths-aphelion-and-perihelion/ from 2015

also try other experiments on my website:

https://mroneilportfolio.weebly.com/analemma.html

This JavaScript program is a clock/map/single star-star chart in the style of Geochron.

lets look at the elements of the site

The info here is your location and the time, these should be pulled directly from your computer and your IP address, the location isn’t exact for security reasons but it should point to the nearest city/wherever your WIFI is routed through. day and time of day are represented in numbers but rewritten into something understandable in the box below.

This is a star chart, but just for the sun.

This is a polar graph where distance from the center is the angular distance to straight upward, the light blue circle represents points in the sky above the horizon, dark blue represents below the horizon. Keen thinkers will already realize that this means the outside circle on this graph is actual the point in the sky which represents straight down, (or straight up for people on your Antipode)

The yellow circle is the suns current position in the sky,

the white squares represent where the sun will be in the sky in the next 24 hours, 1 square per hour.

the white line is where the sun will be every other day at this time for the next 365 days. (on my chart 12:47 pm)

On this Equirectangular projection of the earth each pixel moved up/down or left/right represents the same change in angle in latitude or longitude respectively

The yellow circle represents the point on earth closest and pointing most directly at the sun.

the red/black line represents the sunset/sunrise line. On the black side the sun cannot be seen, on the red side it can. As can be seen from this line, the sun has just risen in Hawaii and is soon to set over Greece.

The red horizontal line is your latitude.

The white vertical line is your longitude.

the yellow squares represent where the sun will be in the sky in the next 24 hours, 1 square per hour.

the white line is where the sun will be every other day at this time for the next 365 days.

the yellow and orange curves give some sense of where the sun is most directly warming currently.

Principles

The way I have actually gotten these positions is basically the most complicated possible method.

const f1 = vec(-783.79 / 2, 0);
const f2 = vec(783.79 / 2, 0);
let a = 23455;
let c = Math.abs(f1[0] - f2[0]) / 2;
let b = Math.sqrt(a * a - c * c);

const goal_angle_to_orbital_pos = (goal_angle) => {
    let angle = goal_angle + 0;
    let M = goal_angle - 0.0167086 * Math.sin(goal_angle - Math.PI);
    let goal_dif = M - goal_angle;

    for (let n = 0; n < 10; n += 1) {
        angle += goal_dif;
        M = angle - 0.0167086 * Math.sin(angle - Math.PI);
        goal_dif = goal_angle - M;
    }

    p = vec(Math.cos(angle) * a, Math.sin(angle) * b);
    return math.subtract(f1, p);
}

const rev_transform_planet = (p, a) => {
    const angle = a * 365.25 * 366.25 / 365.25;
    const day_matrix = rotationMatrix(2, angle); // Z-axis rotation

    const earth_tilt = math.unit(-23.5, 'deg').toNumber('rad');
    const tilt_matrix = rotationMatrix(1, earth_tilt); // Y-axis rotation

    const angle_tilt_to_elipse = -0.22363;
    const day_tilt_to_elipse = rotationMatrix(2, angle_tilt_to_elipse); // Z-axis rotation

    p = vec3(p[0], p[1], 0);
    let rotated_point = math.multiply(day_matrix, math.multiply(tilt_matrix, math.multiply(day_tilt_to_elipse, p)));
    rotated_point = normalize(rotated_point._data);
    const angle_rev = a * 365.25;

    let longitude = Math.atan2(rotated_point[1], rotated_point[0])-0.24385;
    let latitude = Math.atan2(rotated_point[2], Math.sqrt(rotated_point[1] * rotated_point[1] + rotated_point[0] * rotated_point[0]))

    return [vec(longitude, latitude), Math.abs(angle_rev + 0.22363) % (2 * Math.PI), rotated_point];
};

const year_to_angle = (t) => { return t * 2.0 * Math.PI - (182.0) / 365.25 }
const day_hour_to_angle = (d, h) => { return ((d - 182.0) / 365.25 + h / 365.25 / 24) * 2.0 * Math.PI }
const day_hour_to_year = (d, h) => { return ((d) / 365.25 + h / 365.25 / 24) }


Basically I’ve got the dynamics of the earths orbit of off Wikipedia and created a ellipse out of it. there is a concept in orbital mechanics of an imaginary angle called the mean anomaly which is an angle that changes at a constant rate through an orbit. It is not hard to calculate what the current mean anomaly is but it is only possible to estimate the real position of a point based on its mean anomaly. That is why my goal_angle_to_orbital_pos function performs 10 guesses and corrections. This is technically not an exact solution for the earths location in orbit but it gets 5 times more accurate with each correction so its indiscernible after 10 corrections

You will see odd corrections here, some constants thrown in. This is because the orbit and rotation of the earth are not all aligned. For instance the Apoapsis is 182 days off of the start of the year.

Future work

Tell me what you think of the NESW arrangement of the star chart. It is a little strange but you would use the chart in its current form by setting it on the ground. If it was going to represent looking up then it should be NORTH WEST SOUTH EAST.

Tell me if the location and time are correct for you, and anything else you want to see.

https://mroneilportfolio.weebly.com/clock.html

also you can go to my GitHub and just download the clock.html file and run it locally for the best experience https://github.com/Sander-ONeil/sun-timing/

LEAVE A REPLY

Please enter your comment!
Please enter your name here

More like this

14×14 Math Magic Square

  Finding the pattern is  definitely a challenge

26×26 Mahmood's Math Magic Square

  Finding the pattern is  definitely a challenge

100 x 100 Mahmood’s Most Perfect Math Magic Square

100 x 100 Mahmood's Most Perfect Math Magic Square is a square grid containing the numbers 1...