ephem: how to get tilt angle of Earth? - astronomy

I am using python's package ephem.
I can not locate function to get tilt angle between ecliptic plane and equatorial plane.
Hope some one can help me.

Since 0° right ascension is defined as the point where the equatorial and ecliptic planes cross, they are farthest apart at 90° right ascension, where their distance from each other is the same as the Earth’s tilt on its axis:
from ephem import Equatorial, Ecliptic
p = Equatorial('90', '0', epoch='2000')
print Ecliptic(p).lat
The result is the Earth’s axial tilt at the beginning of the year 2000:
23:26:21.4

Bit of Googling might give you your answer:
Measure the tilt of the Earth today!
Measure the Tilt of the Earth on the Solstice!
Declination Angle

Related

Probability of intersection of two users with horizontal accuracy and vision area

I'm receiving data from GPS and store them in MySQL database. I have following columns:
User ID (int)
Latitude (double)
Longitude (double)
Horizontal Accuracy (double)
Horizontal accuracy is radius around Lat/Long, so my user with equivalent probability can be in any point of this area.
I need to find out probability that two users was intersecting. But I also have vision area, which is 30 meters. If horizontal accuracy would be 0 I could just measure area of intersection of two circles that have radius of 30 meters around lat/long. But in my case that's not possible because horizontal accuracy could be in range from 5 to 3000. Usually it's more than my vision area.
I think I can measure area of intersection of two cones where inner circle of this cone will have radius of horizontal accuracy + 30 meters and outer circle will have radius of horizontal accuracy. But this solution seems to be little bit complicated.
I want to hear some thoughts about that and other possible solution.
I've checked MySQL Spatial extension and as far I can see it can't do such calculations for me.
Thanks.
I worked on just such a problem as you are describing. How I approached it was to convert the Lat/Long (world coordinates) into X/Y (Cartesian coordinates) then I applied the Pythagorean Theorem a^2 + b^2 = c^2 to solve the problem.
First you need to convert the Lat/Long Coordinates.
To get X you Multiply the Radius by the cosine (cos) of the angle (NOTE: this angle has to be expressed as radians).
To get Y you do the same as above but use the sine function (sin).
To convert degrees to radials Multiply the angle by the quantity of PI (Approx. 3.14159...) / 180.
Radians = Angle * (PI / 180);
To solve for the c^2 "C Squared" c = SQRT (a*a + b*b);
For more information on Degrees to Radians: http://www.mathwarehouse.com/trigonometry/radians/convert-degee-to-radians.php
For more information on: Converting Lat/Long to X/Y coordinates: http://www.mathsisfun.com/polar-cartesian-coordinates.html
I usually find the information that I need for this kind of problem by asking a question on ask.com.
All the best.
Allan

HTML5 Canvas (or alternative): Moving lines to simulate meridians on a planet

This is my firs excursion on the HTML5 canvas, I have working knowledge of jQuery and Javascript.
I'm trying to create a "spinning globe" effect with it.
The idea is to have a circle and meridians "spinning" on it, to give the effect of a rotating globe.
I've drawn the circle and now I'm trying to create lines that start from the right (following the curve of the circle), move towards the centre straightnening up (in the middle they are straight) and follow the inverse curvature on the left, ending with the circle.
I'm trying to do this with the HTML5 canvas and jQuery but I'm not sure of where to start... should I create an arc and then try to animate it?
I'm even wondering if the canvas is the right tool or if I should use anything else.
Any suggestion is welcome!
Sebastian
You could use a quadratic bezier curve, which is basically just a curve with a start point, an end point, and a "control point" in the middle, which is what you would want to change as the globe spins. In this case, all of your lines would start and end at the north and south poles, respectively, of your "globe". For example, to make one of these lines:
// start drawing a line
canvas.beginPath();
// move the the top of your globe
canvas.moveTo(0,0);
/* draw a curve with the control point specified by the first two args,
* end point by the second two:
* (in your case, the control point would be in the middle of the globe) */
canvas.quadraticCurveTo(control_point_x, control_point_y, 0, 50);
// finish drawing, stroke and end
canvas.stroke();
canvas.closePath();
You would also have to take in to account how you will clear the lines after each frame, of course.
See: The Canvas element API, Complex Paths
This is what I got, didn't have the time to proceed any further: http://jsfiddle.net/Z6h3Z/
I use bezier curves where the two control points are in a sort of oval arc centered at the poles.
What I got stuck at is the distribution of points along the arc to look more realistic.

Connecting arcs on HTML5 Canvas

I am trying to make a donut chart using the arc function in the HTML5 canvas. I am wanting to know how to use the lineTo function to connect two arcs together.
At the moment I have a pie chart which has fixed central x/y coords, so making the slices is easy as once the arc of each slice is done, the lineTo method simply uses the the fixed coords.
However with a ring/donut chart, I have two arcs, one with a smaller radius, but no idea how to connect the ends together without horrifically complicated trigonometry. Is there any way to get the 'start' and 'end' x/y coords of the arc?
I have a current hackyish 'solution' of simply drawing a smaller white circle over the pie chart to give the ring graph, but I want to know the answer to the question above.
You just have to remember a little trigonometry. If your center point is x, y and radius is r; then the coordinates on the circle at an angle alpha are:
pointX = x + Math.cos(alpha) * r;
pointY = y + Math.sin(alpha) * r;
And you have two of those angles, corresponding to the starting and the ending point.
Why are you drawing arcs? Would'nt it be easier if you just draw the circle (or circles for the ring) and then draw radius?

How do I find the angle between the center of the earth and two latitude-longitude coordinates

I've got two LatLon (latitude-longitude) objects which represent two locations on the surface of the globe. I want to find the angle (in radians) between the center of the earth and these two LatLon objects.
I'm going to use this angle and the radius of the earth to calculate the arc length between the two locations (I figure this will give better precision than using simple Pythagoras, and be faster than computing the great circle distance).
I already have code to give me the Pythagorean distance and the great circle distance.
Using something like this - how to calculate the angle between two vectors
I thought this at first (after some calc on paper) is this Pythagorean thing?
angle_between_radian = sqrt(deltaLA^2 + deltaLO^2)*PI /180
edit: delta = delta>180?360-delta:delta
We working on sphere then above must wrong ^^. But this link may help:Calculate distance, bearing and more between Latitude/Longitude points.

Rotate a circle around another circle

Short question: Given a point P and a line segment L, how do I find the point (or points) on L that are exactly X distance from P, if it guaranteed that there is such a point?
The longer way to ask this question is with an image. Given two circles, one static and one dynamic, if you move the dynamic one towards the static one in a straight line, it's pretty easy to determine the point of contact (see 1, the green dot).
Now, if you move the dynamic circle towards the static circle at an angle, determining the point of contact is much more difficult, (see 2, the purple dot). That part I already have done. What I want to do is, after determining the point of contact, decrease the angle and determine the new point of contact (see 3, 4, the red dot).
In #4, you can see the angle is decreased by less than half, and the new point of contact is half-way between the straight-line point and the original point. In #7, you can see the angle is bisected, but the new point of contact moves much farther than half way back towards the straight-line point.
In my case, I always want to decrease the angle to 5/6ths its original value, but the original angle and distance between the circles are variable. The circles are all the same radius. The actual data I need after decreasing the angle is the vector between the new center of the dynamic circle and the static circle, that is, the blue line in 3, 4, 6, and 7, if that makes the calculation any easier.
So far, I know I have to move the dynamic circle along the line that the purple circle is a center of, towards the center of the static circle. Then the circle has to move directly back towards the original position of the dynamic circle. The hard part is knowing exactly how far back it has to move so that it's just touching the other circle.
To answer your short question, if you are on the Cartesian plane, then find the equation of the line L is sitting on (given the two endpoints of L, this is simple). Find the equation of the perpendicular to said line, which passes through P (this is done by taking the negative inverse of the slope, plugging in P's x and y values, and solving for the intercept). Then find the point where the two perpendicular lines intersect by using their equations as a single system of equations (with x's and y's equal). Then find the distance between the point of intersection and the point P, which is one leg of a triangle. Finally, with that distance and the distance X you are given, use Pythagorean theorem to find the distance of the other leg of the triangle. Now the point you are looking for is a point on L, and also on the line on which L sits. So using the distance you just obtained, the intersection point you had found before, and the equation of L's line, you can find the desired point's coordinates. There can only be a maximum of 2 such points, so all you have to test for is whether the coordinates of the points found are actually on L, or beyond L but still on its line. Sorry for the long answer and if you wanted a geometric explanation rather than an algebraic one.
Draw a circle with the same centre as the stationary circle and the radius of the sum of both radii. There are two intersections with the translation line of the moving circle's centre. The place of the moving circle's center at the time of contact is the closer of those two intersections.
Let the ends of your segment be A and B, and the center of your stationary circle be C. Let the radius of both circles be r. Let the center of the moving circle at the moment of collision be D. We have a triangle ACD, of which we know: the distance AC, because it is constant, the angle DAC, because that's what you are changing, and the distance CD, which is exactly 2r. Theoretically, two sides and angle should let you get all the rest of a triangle...