jes notes Index Gallery . Signed Distance Functions Shaft passers Snap issues

2025-05-25

Last modified: 2025-05-25 22:20:33

< 2025-05-21 2025-05-27 >

Line of sight map

The idea is that it would be an OpenStreetMap view or whatever, except you pick some vantage point on the map, and then anything that is obscured by terrain has hatch marks or lines or whatever drawn over it.

So you can tell from any particular spot what you ought to be able to see.

And maybe we let you specify a viewing altitude as well, in case you're not at ground level.

I think for every point on a 10px by 10px grid on the screen, draw an imaginary line from the vantage point to that point. Cast a ray along that imaginary line. If it hits the ground then draw a solid line from the point where it first hits the ground to the point we're measuring to.

That way everything that is obscured by terrain will have solid lines drawn over it.

So I think the first step is a map viewer that gives me the capability to draw lines on top of it. Is MapLibreGL the best tool? I can put a see-through canvas over the top if necessary, just need to be able to convert the coordinate systems.

Apparently MapLibreGL has map.project(lngLat) and map.unproject(xy) to convert between coordinates.

And we have the option of a GeoJSON "layer" to add the lines. Probably best to go with that and only do the transparent canvas thing if GeoJSON proves unpleasant.

I'm trying to download a new version of Cursor but the internet here is too awful. Need to get Starlink. It has been over half an hour and still hasn't downloaded 180 MB.

Where do I get terrain data from?

Apparently https://cesium.com/platform/cesiumjs/ can give you elevation data. Seems more like a 3d globe viewer though, not necessarily what I want.

I'll just try and get a basic MapLibreGL map up and then figure out elevation after.

OK I have a basic map, with map and satellite view, and I can click to set the vantage point.

I had it draw lines to points on a 10px-spacing grid, but actually that is wrong, we just want radial lines at a consistent angle spacing.

Oh no, actually that's still not right. We only want to draw lines on the parts of the terrain that are invisible. There might be a valley that we can't see into but then we can see the mountains again the other side of it. So we may need several line segments per direction.

OK, great, it is getting terrain data from AWS. Now to do the ray casting.

This is really cool, this is actually working now. One issue is that to get a good map you need to sample a lot of points and it is actually quite slow.

I wonder if I can get it to iteratively add more points over the course of 10 seconds or so, so you get some straight away, and it remains interactive, but the density fills in over time.

Great, working: https://incoherency.co.uk/line-of-sight-map/

< 2025-05-21 2025-05-27 >