Any maths buffs?

Posted on
Page
of 18
First Prev
/ 18
Next
  • I agree, I just mean that if you just write p_1, ..., p_t then almost surely it will
    be interpreted "correctly"

  • Good points - thanks both.

    I may just make the point in the narrative text that the series need to be contiguous - particularly as I make a point in the code, that processes the data, to reindex against the series made contiguous.

  • If I have a point P on a map say 51.505788,-0.075198 (Tower Bridge), then, for a given radius of a circle, (say 6000 meters), if we assume that P sits at the bottom of this circle, in the 6 o'clock position, then, what co-ordinates would the other 11 hours of the clock be at?

  • Assuming that 6 and 12 are on the same longitude?

    3: +3000,+3000
    9: -3000,+3000
    12: +0,+6000

    From there, I’d calculate the arc length between the remaining points (you know all the properties of the circle that you need). That then gives you the chord length and therefore the dimensions of each triangle segment between each point.

    From there, trigonometry and simple geometry gives the +/- x, y from one point to its neighbour.

    I got good maths scores through hard work, I’m by no means the most natural practitioner, so someone will probably offer a neater solution!

  • Yes, 12, 3 and 9 are relatively easy to get, although I dont know how co-ordinates equate to distance on the ground. Getting the remaining ones are way beyond me

  • Coordinates relate to distance through Pythagaros’ theorem: a^2 + b^2 = c^2

    ^^^ where (c is the distance) a is x1-x2 and b is y1-y2

    In this example, you could use this proof as a check of your results. Find the centre of the circle and all the points should be at the same c from that point.

  • Something like:
    Find your co-ordinates for the centre of the circle - 6km north of Tower Bridge.
    Each hour mark is at 30 degree increments.
    Any point on a circle x,y is x=r*sin(angle), y=r*cos(angle) from vertical.
    So 1 o'clock is 6000*sin(30), 6000*cos(30)
    Then convert that to lat/long and add/subtract from your central starting point.
    etc and so on for the other angles.

    I think.

  • The Haversine formula will get you most of the way there. It provides the distance between two pairs of lat/long and takes into account the curvature of the earth.

    Depending on the distances involved (e.g. 6km) then the curvature of the earth isn't going to make much a difference from relatively simple trig.

  • Googling "lat lon bearing distance" will get you a bunch of things that should get you closer to your answer.

  • @moocher just realised I misread your question. Where I have used 3000; use 6000. And where I have used 6000; use 12000.

  • Coincidentally I am sitting here doing some maps programming with turf.js. It will solve this problem with its circle function, which actually returns a polygon defined by a number of points, because GeoJSON does not support an actual circle. I've put the code in a JSFiddle, if you run it you should get the coords in a block of GeoJSON:

    https://jsfiddle.net/j7oef1c5/3/

    You can copy that into https://geojson.io/ to check it looks ok, it should look something like the attached. Even tho it is approximating a circle presumably the vertices fall on what would be the circumference, so it should be right?

    Are you planning a festive bike ride?

    EDIT: just realised I made London Bridge the centre, not the 6 o'clock position. I guess the way to fix this is to start with the coord for London Bridge, move it north by the circle radius to get the center, then go from there

    EDIT2: edited the fiddle with the fix above and updated attached image


    1 Attachment

    • london-bridge2.jpg
  • Love this!

    And it absolutely doesn’t need to be a perfect circle if you can plot it in CAD or what you have used.

  • thanks everyone

    @sifriday

    Are you planning a festive bike ride?

    I thought it might be fun to see what a circular route, based on the length I can ride in a 12 hour period, visiting each of the hour points on the way would look like.

    More generally, to plot a circular route of distance D, starting from and returning to x,y. You might want your starting point to be at 12 if all of your good riding was to the south, or 3 if all the good stuff was to your west.

    I should be able to plug the output from your code into komoot or similar and get it to show me the route

  • Not sure if it's been taken into account by previous answers, but I don't think 6km around a point at 50 degrees north is a constant radius when expressed in degrees.

    Circles of latitude get smaller with increasing distance from the equator, so the latitude component will be larger than the longitude.

  • We decided that the error over 6km is negligible. :-)

  • nice! in which case here's a new version of the fiddle that will render a 'download' link and if you click it then it should download a basic GPX to make it easier to go into Komoot etc -

    https://jsfiddle.net/nu93ptog/1/

    to try different point, then turf.transformTranslate uses decimal degrees so it currently has 0 for north... if eg you wanted the start point to become the 3 o'clock point of the circle then you'd need to move it to the west by the amount radius to become the circle centre so use 270 instead of 0

    and when changing the start point, if you don't know GeoJSON already, then watch out, because it uses [x,y] coordinates, ie [Lng,Lat] rather than the more familiar [Lat,Lng]

  • Yeah, but he's planning on riding anything up to 300km (as a circumference). So that's radius of ~50km.

    But it'll be roughly impossible to plot a route that resembles anything near a perfect circle anyway so the resulting discrepancies will be swamped.

    There's shedloads of interesting research into the fractal geometry of the UK road network: e.g. https://www.nature.com/articles/s41598-017-04477-z

  • ...and bonus for the turfjs example is that it uses the haversine formula mentioned further up so should be accounting for this anyway...

  • If you're referring to the difference between the direct distance and distance across the sphere, I agree. That's not the same thing though.

    By my reckoning this 'circle' has a radius of 0.055 degrees latitude and 0.087 degrees longitude.

  • This is very excellent, thanks! I'll have a play

    he's planning on riding anything up to 300km

    @Greenbank - steady, I think my absolute max will be about a 3rd of this (in my defence its likely to be singlespeed and partially offroad)

  • oh I see, yes I think I agree, but that's what we're after isn't it? the circle to be circular in terms of surface distance around the center point, which as you say means it will be non-circular in terms of degrees of lat/lng? whereas if you made it a circle based on degrees then when you came to cycle it then E-W would be a lot shorter than N-S at our latitudes.

  • Like I said, the majority of my maths “success” is down to hard work. XD

    You’re on the brink of losing me in the fine details!

  • Precisely. Drawing a circle on a map and getting the coordinates that way obviously works fine. However actually calculating them means having to convert between km and degrees, which is definitely not straightforward.

    My maths isn't great, but I can visualise geometric problems pretty well.

  • Ellipsoids tho. And which ellispsoid.

    I was using them earlier this year, and quickly came to the conclusion that it's just not worth the headache.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Any maths buffs?

Posted by Avatar for deleted @deleted

Actions