mousebird-consulting-inc / WhirlyGlobe

WhirlyGlobe Development
Other
827 stars 253 forks source link

Areal VectorObjects not displayed #1568

Closed PeterQi1117 closed 1 year ago

PeterQi1117 commented 1 year ago

Using VectorObject::addAreal, certain polygons are missing while others display.

Example list of Point2d which does not display: points.txt

Using commit 36118a27fcdff20261c8653a79d680f303161bb5

sjg-wdw commented 1 year ago

Try turning Filled off to make sure the outline is coming through. If it is, then it might be an ordering problem.

PeterQi1117 commented 1 year ago

The outline does come through. All the polygons used to appear on an older version (possibly 3.1).

sjg-wdw commented 1 year ago

You can try tessellating the outline before passing it in. If you set Filled to off there, then you should see the outlines of the triangles. If you do, then it's probably an ordering issue and the polygon is wound the wrong way.

PeterQi1117 commented 1 year ago

Ok I see the tessellated triangles. Reversing the order of the points causes the polygons that previously did not display to display, and vice versa. What determines if a list of points is wound the right way or needs to be reversed?

sjg-wdw commented 1 year ago

Winding order. The ones that work are pointing one way, up ideally. The ones that don't are pointing the other way. If you on a flat map you can safely turn off backface culling, so that might be a workaround. On the globe we need the backface culling to avoid seeing things through the earth.