mousebird-consulting-inc / WhirlyGlobe

WhirlyGlobe Development
Other
830 stars 255 forks source link

Polygon Drawing Issue #1618

Open mattguthmiller opened 2 weeks ago

mattguthmiller commented 2 weeks ago

When rendering with a kMaplySubdivEpsilon, this polygon (as one of several examples, though I can't quite pin down what's unique about these few out of hundreds of similar ones that work fine), looks fine at nadir, but off-center begins to draw through the globe and becomes visible from the other side. The CW winding seems correct, etc. It also works fine without kMaplySubdivEpsilon.

It is added like

let polygonStyle: [String: Any] = [ kMaplyColor: sigmet.color.withAlphaComponent(0.14), kMaplyEnable: isValid, kMaplyFilled: true, kMaplySelectable: true, kMaplyDrawPriority: kMaplyMaxDrawPriorityDefault - 20_000, kMaplyRepresentation: sigmet.id as Any, kMaplySubdivType: kMaplySubdivGreatCirclePrecise, kMaplySubdivEpsilon: 0.001, ]

let polygon = MaplyVectorObject( areal: bufferPointer.baseAddress!, numCoords: Int32(half.count), attributes: polygonStyle )

addVectors([polygon], desc: polygonStyle)

[0] MaplyCoordinate x Float 0.20333086 y Float -0.564910769 [1] MaplyCoordinate x Float 0.152419597 y Float -0.746424973 [2] MaplyCoordinate x Float 0.335399926 y Float -0.852017402 [3] MaplyCoordinate x Float 0.266162723 y Float -1.31161499 [4] MaplyCoordinate x Float -0.174532935 y Float -1.28922236 [5] MaplyCoordinate x Float -0.174532935 y Float -0.875579357 [6] MaplyCoordinate x Float -0.00668461109 y Float -0.87732464 [7] MaplyCoordinate x Float -0.0453785583 y Float -0.586430609 [8] MaplyCoordinate x Float 0.20333086 y Float -0.564910769

Screenshot 2024-11-03 at 15 43 52 Screenshot 2024-11-03 at 15 44 32 Screenshot 2024-11-03 at 15 44 01