Retired

Calculate the bearing angle angle between two points (retired)

Description
Loading description...
Fundamentals
  • Please sign in or sign up to leave a comment.
  • cliffstamp Avatar

    Decent kata :

    • not a duplicate (possible?)
    • actual random tests

    But

    • author totally not responsive
    • unclear description
    • mass piles of issues all requiring a simple fix (update the description)

    As always, might generate issues with rounding in rare cases.

  • TheLilDev Avatar

    There are issues in the answers for rounding. For eg: -126.86989764584402 Expected: -126, instead got: -127

  • PaulCalvelage Avatar

    There is a major issue with the kata, because the description is vague about what angle is desired.

    You need to define exactly what you mean by 'angle between 2 position vectors'. Traditionally, angles are measured between rays that share a vertex, so I thought that you wanted the angle between the rays from [0,0] projected through the two points. This is also the normal meaning of the angle between two position vectors; there is even a nifty formula based on the dot product. Google "dot product angle between two vectors". But nope, that's not what's being tested here.

    By trial and error, I discovered that rather than the usual angle between two position vectors, you wanted the angle between the ray from [x1,y1] projected through [x2,y2] and the ray pointing from [x1,y1] to the right in the direction of the positive x-axis. In other words the direction (or heading) when moving from point 1 to point 2, relative to the positive x-axis.

    This is by no means clear from the description of the kata. Adding a picture would be helpful to clear up the confusion.

  • lepatissiere Avatar

    The answers in the tests are wrong!

  • donaldsebleung Avatar

    The mathematics in this Kata seems wrong to me, unless I have remembered the equation for finding the angle between two vectors wrong. Please double check your maths.

    If you believe the maths to be correct, please cite the source you are using.

  • acraileanu Avatar

    Rounding should be better explained.

  • chessmonger2112 Avatar

    Either the test cases are wrong or the problem needs to be rewritten.

    Consider the second test case: (-1,0) and (5,-2) the angle between these is show here. https://imgur.com/ZrdkR0q. As you can see it's much more than -18.

    First test case: (-1,0) and (5,0). These position vectors are in direct opposite positions. Should be 180 degrees, not zero.

  • Unnamed Avatar

    The description says nothing about rounding.

    • daymos Avatar

      I added that to the description, and a better explanation of what angle to calculate.

    • Unnamed Avatar

      Round the result to an integer.

      Up / down / to zero / to infinity?

    • daymos Avatar

      down

      Issue marked resolved by daymos 9 years ago
    • jungerstein Avatar

      daymos(3 kyu)8 months ago down

      That is not really down, as inferred from test cases. By the word down one rounds 4.5 as 4, but -4.5 as -5. That is not the behaviour of your test cases:

      TheLilDev(5 kyu)5 months ago There are issues in the answers for rounding. For eg: -126.86989764584402 Expected: -126, instead got: -127

      This kata has only one caveat: it does not follow the good old definitions when people do math, but the very same words are used. For a math kata, with due respect, this caveat is fatal.

  • Unnamed Avatar

    I don't think there's such a thing as an angle between points, is there?

  • ZozoFouchtra Avatar

    Description says :

    • function should return an angle in radians.

    ... but degrees are expected