redblobgames/1843-planet-generation

Info - Keep latlong with triangle data

Closed this issue · 2 comments

I see the latlong is generated, converted to cartesian and then to stereographic.

How should I link and retain the triangle vertex latlong data?

I want to pair this with topojson for interaction.

Sorry, my code is messy :-(

The link is the indices in the array. The data is kept in the same order in all the different representations (a_latlong, r_xyz, r_XY).

When you read the data from Delaunator, it tells you the point id i, so you can use that to look up lat, long in a_latlong.

The generateFibonacciSphere function constructs a_latlong as an array. Point i is at {lat: a_latlong[2*i], long: a_latlong[2*i+1]}. It is stored as a flat array for efficiency and also for Delaunator. In stereographicProjection, point i is at {x: r_XY[2*i], y: r_XY[2*i+1]}.

Thank you for your help!