vasturiano / three-conic-polygon-geometry

ThreeJS geometry for drawing polygons on a sphere

Home Page:https://vasturiano.github.io/three-conic-polygon-geometry/example/countries-gdp-per-capita/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

lslzl3000 opened this issue · comments

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!

@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/