Jump to content
  • Advertisement
Sign in to follow this  
JY

Horizon point

This topic is 3730 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to trace a beam footprint on Earth from a satellite and am having problems when the beam doesn't intersect Earth (ray/sphere intersection is well document and i'm pretty sure i have a working implementation). So I want to be able to get the point on the horizon which is closest to the vector for a given line in space that passes by the sphere. Make sense? Please help! :) Thanks in advance JY

Share this post


Link to post
Share on other sites
Advertisement
I've sketched it out on paper and thought I was getting somewhere but it doesn't seem to be quite right...

I figured I could take the angle between the position vector and the direction vector using the dot product. Then I've got a right-angled triangle comprised of my position, direction and a vector perpendicular to the direction.

Using trig I can get the length of the direction vector that makes this right angled triangle. I then multiply that length by the normalised direction vector to give me a point in space which sits above Earth.

I then truncate this to be of length = Earth radius. This should give me the right point no?

Only when I draw it the positions for the horizon points seem to be on the other side of the world :(

Any help would be greatly appreciated.

Share this post


Link to post
Share on other sites
I think your description isn’t really clear. I haven’t understood what you want to obtain. Do you want to find the closest point on the Earth surface to the ray? Can you draw a picture of that?

Edit: I have studied what you have written in your second post and I think I have understood something. Here is the drawing I have done:

The circle is the earth with center O, P is the origin of the ray, d the direction.
If you project the vector (O - P) in the direction of the vector d (projd(O - P) in the drawing) you obtain a triangle.

The projection is:

projd(O - P) = dot((O - P),d)d / dot(d,d)

If d is a unit vector the formula above simplify to the following:

projd(O - P) = dot((O - P),d)d

If you want to obtain the point Q on the earth closer to the ray (given that the ray doesn’t intersect the earth) you can scale the vector projd(O - P) - (O - P) and sum it to O.

Q = normalize(projd(O - P) - (O - P))*radius + O

I hope this is what you want.

[Edited by - apatriarca on July 9, 2008 6:12:19 AM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!