Giter VIP home page Giter VIP logo

Comments (10)

asinghvi17 avatar asinghvi17 commented on June 1, 2024 1

Will take a look! I suspect this is a result of CairoMakie drawing the polygons incorrectly when they are outside the bounds of the projection.

Do you get the same issue with GLMakie?

from makie.jl.

asinghvi17 avatar asinghvi17 commented on June 1, 2024 1

This is a CairoMakie issue, so I'll see about transferring the issue to the Makie repo.

My first thought is that this is caused by the clamp in CairoMakie's project method - it should instead set coordinates to NaN.

from makie.jl.

asinghvi17 avatar asinghvi17 commented on June 1, 2024 1

I want to refactor the way all transforms work at some stage, so this would definitely be a target for that refactor!

The primary issue is that there's no completely reliable way to get the bounding polygon for an arbitrary projection (as far as I understand it, at least) without defining it yourself (as, for example, Cartopy has done).

from makie.jl.

milankl avatar milankl commented on June 1, 2024

Plotting lines on top is not a problem, neither is the problem resolved with a different perspective

image

from makie.jl.

milankl avatar milankl commented on June 1, 2024

Haven't checked will report back

from makie.jl.

milankl avatar milankl commented on June 1, 2024

Not a problem with GLMakie

image

So should this issue go over to Makie/CairoMakie? Or is that something that needs fixing here?

from makie.jl.

asinghvi17 avatar asinghvi17 commented on June 1, 2024

Here's a more minimal MWE:

fig = Figure()
ga = GeoAxis(fig[1, 1]; dest = "+proj=ortho +lon_0=0 +lat_0=30")
lines!(ga, GeoMakie.coastlines())
poly_in_bounds = GI.Polygon([GI.LinearRing(Point2f[(72, 19), (100, 19), (100, 39), (72, 39), (72, 19)])])
poly_out_bounds = GI.Polygon([GI.LinearRing(Point2f[(72, 19), (120, 19), (100, 39), (72, 39), (72, 19)])])
poly!(ga, poly_in_bounds; color = (:red, 0.5))
poly!(ga, poly_out_bounds; color = (:yellow, 0.5))
fig

download-5

from makie.jl.

asinghvi17 avatar asinghvi17 commented on June 1, 2024

Even more minimal:

fig = Figure()
ax, p1 = poly(fig[1, 1], GI.Polygon([GI.LinearRing(Point2f[(72, 19), (100, 19), (100, 39), (72, 39), (72, 19)])]))
p2 = poly!(ax, GI.Polygon([GI.LinearRing(Point2f[(72, 19), (Inf, 19), (100, 39), (72, 39), (72, 19)])]))
fig

download-6

from makie.jl.

asinghvi17 avatar asinghvi17 commented on June 1, 2024

With a patch to not draw any polygon segment which is not finite, I get:
download-5
This is suboptimal, since some areas which should be shaded are not shaded, but better this than nothing I think.

From the GeoMakie perspective, the only way to do this is correctly is by intersecting the boundary line of the polygon with the boundary line of the visible Earth. Cartopy does this by manually defining the boundary of the projection, and I suspect that at some point we will have to do the same.

From a Makie perspective, this is also not great. Note that, ideally, this should have drawn the yellow box leading towards infinity to the bottom right, but here is drawing to the top left of the screen (not the plot) since the infinity is apparently getting translated to 0.

From my testing, GLMakie either segfaults or refuses to draw such invalid polygons, so perhaps CairoMakie not drawing this polygon is more in line with expected behaviour.

from makie.jl.

milankl avatar milankl commented on June 1, 2024

I don't know how this works under the hood but could you clamp vertices of polygons that are partially outside? In the end an orthographic projections always maps onto a disc so a check like x^2 + y^2 > radius could be the basis of this?

from makie.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.