geographiclib / geographiclib-c

C implementation of geodesic routines
MIT License
30 stars 3 forks source link

Ray-tracing Earth + H3 Hexagon edges... #2

Open SkybuckFlying opened 1 year ago

SkybuckFlying commented 1 year ago

A ray tracer is to ray trace earth, currently it works with a sphere, hopefully in future with an spheroid/ellipsoid.

The raytracer returns an x,y,z in 3d for the pixel be ray-traced and colliding with the sphere/ellipsoid.

This x,y,z is used to get H3 hexagon cells and edges/points.

Then an arc/great circle/great ellipse/line segment can be computed across these two edge points.

The distance towards these edges should be computed.

Basically a point to line segment distance, but on a sphere.

Basically closest distances to a line segment on a sphere.

This library seems very complex and an example of how to use this library to compute this would be nice.

Basically input data would be:

PointX,PointY, PointZ on sphere.

LineX1, LineY1, LineZ1 on sphere. LineX2, LineY2, LineZ2 on sphere.

Line describes the line segment.

Point describes a point next to the line segment.

The closest distance from this point to the line segment should be computed (ofcoursr across the sphere).

Such an example code would be very usefull for UFO Alert Tool, in case the aliens come ! LOL. No Joke.

cffk commented 1 year ago

This is what I call the interception problem. It is addressed in

Karney, Algorithms for geodesics, Section 8 https://doi.org/10.1007/s00190-012-0578-z

Baselga & Martinez-Llario, Intersection and point-to-line ..., Section 3 https://doi.org/10.1007/s11200-017-1020-z

I plan to address this problem in more detail in a future publication. ETA = 18 months.