Giter VIP home page Giter VIP logo

Comments (4)

michaelkirk avatar michaelkirk commented on June 11, 2024

I think I understand what you're saying, but I'm not able to reconcile it with the code base.

Could you provide an example input / output that aligns with your expectations like:

let point_1 = point(x: ???, y: ???);
let point_2 = point(x: ???, y: ???);
let bearing = point_1.bearing(point_2);
assert_eq!(bearing, ???);

from geo.

meesfrensel avatar meesfrensel commented on June 11, 2024

Sorry for not coming back to this sooner. After some more testing, I concluded that my hypothesis of N=90 and E=0 is wrong. Here is an example test:

#[test]
fn a_different_angle() {
    let p_1 = point!(x: 52.323434, y: 4.822623);
    let p_2 = point!(x: 52.327790, y: 4.851333);
    let b_1 = p_1.haversine_bearing(p_2);
    assert_relative_eq!(b_1, 76.0, epsilon = 1.0e-6);
}

with this output (geo 0.24.1):

left  = 8.5969044325273
right = 76.0

According to this online calculator, the bearing is 76 degrees (no more significant digits unfortunately). When looking at a map, it's at least clear to me that it shouldn't be 8.6 degrees. Not sure what's going on here, since the other tests pass.

from geo.

michaelkirk avatar michaelkirk commented on June 11, 2024

Assuming that you are operating in the Netherlands, it looks like you've swapped your latitude (y) and longitude (x).

Feel free to follow up if I'm mistaken.

from geo.

meesfrensel avatar meesfrensel commented on June 11, 2024

Thanks, that clears it up. It's confusing that lat/lon and x/y are not a one to one mapping. Maybe this is a useful addition to the documentation?

from 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.