Polygon Fill stopping at intersections

So if I make an hourglass shape with my polygon, only part of the polygon is filled with the fill color. Is there any way to get around this(other than don't draw shapes that intersect)?

Perhaps as the fill algorithm follows the series of segments each time it crosses itself it bisects that line segment at the point of intersection, performs a fill, then continuous on until the next intersection and repeats. The bisection point would be referenced twice as it is crossed twice. Performing a fill would be back tracking to that point of intersection and filling in that closed space. Until something like this is implemented you’d probably have to draw as separate polygons.

This is a known issue. Triangulating a self-intersecting polygon for 3D is infinitely harder than drawing a polygon on a 2D canvas. Keep your eye on https://github.com/AnalyticalGraphicsInc/cesium/issues/1209

Unfortunately, the only solution in the near term is to avoid drawing intersecting polygons.

By 3D I assume you mean conforming to the ellipsoid where the line segments are actually geodesic segments? I could imagine creating ‘curved triangles’ that conform to an ellipsoid would be difficult to make as well, let alone conforming to odd shaped terrain.

No, by 3D I mean Polygon triangulation. Drawing/filling a polygon with the 2D canvas API is trivial, but as soon as you want to use WebGL you need to triangulate. This is true for even 2D maps that use WebGL.

Instead of saying fill I should say determine a closed-in section, then fill in the closed-in using some method, such as triangulation. I thought I read somewhere that Cesium uses http://en.wikipedia.org/wiki/Polygon_triangulation#Ear_clipping_method , is this how Cesium triangle fills by chance? I wonder if it’s possible to enable wire frames for polygons to see the resulting triangulation done onto them.

I was thinking there could be polygons where backtracking from an intersection may not lead to the same intersection, rather to yet another intersection, so my initial idea wouldn’t cover all cases. Perhaps on the first pass just do bisections at intersections, followed by other procedures once that is complete.