vasturiano / three-conic-polygon-geometry

ThreeJS geometry for drawing polygons on a sphere
https://vasturiano.github.io/three-conic-polygon-geometry/example/countries-gdp-per-capita/
MIT License
40 stars 14 forks source link

[Feature request] change of spheric resolution or bend polygon around sphere #2

Closed lslzl3000 closed 4 years ago

lslzl3000 commented 4 years ago

The conic-polygon-geometry only uses border coords, it works fine for small regions. But for big regions, it makes large flat areas which will be blocked by the sphere surface:

with 0 altitude, only borders are visible for most regions Screen Shot 2020-07-15 at 20 18 06 with 0.1 altitude, more visible regions, but still holes for big countries Screen Shot 2020-07-15 at 20 18 48

The idea would be adding vertices in the middle of regions, especially for big regions, then bend around the globe, finally something like:

It will be very nice if the vertices/triangulated map can be done automatically!

vasturiano commented 4 years ago

@lslzl3000 thanks for filing this issue.

It made me dig deeper into how to make the surfaces more curved by fragmenting the surface faces into smaller ones so that it increasingly approximates a sphere. I ended up triangulating these cases using delaunator instead of earcut which only uses the polygons contour.

The spheric angular resolution (in degrees) can be configured using the curvatureResolution parameter.

Result: https://vasturiano.github.io/three-conic-polygon-geometry/example/countries/