-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Distance is not calculated well #3
Comments
To add a bit more, the divergence becomes quite obvious if you enter a distance that is half the circumference of the earth, which you should never see over the horizon since it's on the other side of the world. It's impossible to see more anything no matter how tall if it's more than 1/4 the circumference from the horizon, since the growth in height would be parallel to the horizon. |
I would point out that your claim on the 1/4th circumference is not true. If you and the other object were both tall enough, you could see each other at all angles except for theta = pi. You'd have to be very tall (h >> R) but there is no need for an imposed inf value, as it comes naturally from the trig functions. https://www.desmos.com/calculator/neu5mpm5v4 |
But in general I agree with the point about using arclengths instead of direct distance, since it is easy to measure GPS location and calculate surface distance. For almost any application, casual or otherwise, you will know your surface coordinates and altitude. |
Sorry, didnt see you had responded to this. I think I didn't explain myself clearly. It's not 1/4 the distance from the observer, it's 1/4 the distance from the horizon point. Since the line of sight to the horizon touches the circle of the earth, it can be assumed that it is a tangent line. In your drawing, L'+L, or D. A ray drawn outwards from the circle, 90 degrees from the tangent intersection line, R would be parallel forever. This is exemplified in the identity tan(pi/2) = NaN. Additionally, you would need to impose an infinite value because when using the cosine theta_2, when theta_2 is beyond pi/2 radians from the tangent point, you wind up with negative values, which are meaningless in this context since height cannot be negative. Also, your graph is showing an error. L is not equal to R*theta in the drawing. R*theta is distance of the arc segment drawn between the lines R+h and R (An unlabeled arc segment). What you are going for is L=R*tan(theta). That error bubbles through the formula, causing the periodic behavior. If you look at the image and imagine extending the L' line out to infinity, you can see that it would be impossible to ever be periodic. (D is not circular) |
I'm afraid you've misinterpreted the drawing. I specifically emphasized in the caption that L, L' and D are arclengths. The nature of the drawing is such that it looks like they are labeling the tangent lines, but they simply aren't. L describes the distance along the surface you would travel in going from ray R to ray R+h. The direct distance between points is never used in the calculation; indeed the only reason the tangent line is there is to illustrate that they are right triangles and allow for theta = acos (R/(R+h)). D is, in fact, circular, so the result should absolutely be periodic. Do you have a problem with the calculation now that that's been cleared up? |
I have indeed. In that case it looks good, and it's getting the same results as my python implementation, differently derived, should have checked that first. Infact, graphing them together, we have exactly the same implementation. Your implementation does have negatives though, as does mine for the reasons that I stated earlier. The negative maxima on your selected scale is at (y=-4.1852*10^7). Additionally, there are undefined points at the asymtotes, the first one being at (20926000/5280) * (pi/2) + (20926000*acos(20926000/(20926000+h)))/5280. Same as mine, because we have the same implementation. |
You are right that there are negatives outside of the visible angles. I decided to make another graph which actually plots the situation in addition to calculating: https://www.desmos.com/calculator/ncx9b8ojzv |
The formula laid out doesn't caluclate distance well, as line of sight is not the measure of distance across a globe. instead I would make the assumption that the distance is an arc segment. This has the added benefit that when d_surface_0 < d_surface_1, the heigh for an obscuring object is calculated.
Example python code
The text was updated successfully, but these errors were encountered: