GithubHelp home page GithubHelp logo

circle.radius() is confusing about d3-geo HOT 7 CLOSED

d3 avatar d3 commented on April 25, 2024
circle.radius() is confusing

from d3-geo.

Comments (7)

Fil avatar Fil commented on April 25, 2024 4

Your drawing is correct, but North Pole is [0,90]. You can play with the following block if you want to see what happens when you change parameters and values.
http://blockbuilder.org/Fil/cafad70aea7ec49d787e123b1026db06

It defines a red and a blue "centers", with a set of circles drawn from these centers and with a radius going from 5° to 90°.

As you can see on this equirectangular projection, the circles centered on the North Pole (the red ones) are drawn as straight lines, whereas the circles centered on WashingtonDC are drawn as, well, geographic circles :))

geocircle

Now change the projection to d3.geoOrthographic():

geoorthographic

from d3-geo.

Fil avatar Fil commented on April 25, 2024

https://github.com/d3/d3-geo#geoCircle

geoCircle is a polygon generator that approximates a circle on the sphere. Think "Arctic circle", not "a circle drawn on flat paper with a compass".

If you set its center on the pole, and its radius at 90°, you get a line on the Equator. With a radius of 23.43° you get the Arctic circle (23.43 = 90° for North Pole - 66° 34′ 0″ N).

So indeed the radius is defined as an angle; but remember, this circle is a polygon generator, not a "circle". In many projections it is going to be shown as a straight line. It's only in 3D (x,y,z - space) that this circle is drawn as a "circle made with a compass" (though I doubt you can use a compass in empty space… ah). And it's true that, in that case, the drawing has a radius, that would be r * sin(radius).

HTH

from d3-geo.

Spaxe avatar Spaxe commented on April 25, 2024

This has gotta be the greatest confusing terminology invented in Mathematics. Thanks, @Fil.

OK, so are you saying that the 'radius' is actually the longitude, and the circle on the sphere is always parallel to the equator line?

I'm reading https://en.wikipedia.org/wiki/Great-circle_distance and the diagram has a rotated circle, which confused me further. One radius (read: angle) can't be enough to define this circle, unless it's always going to be parallel to the equator line.

from d3-geo.

Fil avatar Fil commented on April 25, 2024

The circle is a parallel if (and only if) it is centered on one of the poles.
See https://github.com/d3/d3-geo#circle_center

from d3-geo.

Spaxe avatar Spaxe commented on April 25, 2024

Set the centre to [-90, 0] (North pole, right?) and radius to 90, you get the 'equator' on the sphere ... I think?

I drew this picture to make sure my understanding is 100%.

20160627_174243_hdr-2

from d3-geo.

Spaxe avatar Spaxe commented on April 25, 2024

Thanks, that makes perfect sense now!

from d3-geo.

phocks avatar phocks commented on April 25, 2024

Hi there I am looking for way to draw these circles with a stroke, but not have it draw the stroke on the outside edge of the map. I thought I found an article about how to convert the geoCircle to a GeoJSON and then pass it to the path projection but I can't seem to find it anywhere. Any help would be useful. Thanks.

from d3-geo.

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.