Solved Vector.angle() confusion.

Discussion in 'Plugin Development' started by spuddy, Oct 8, 2020.

  1. Offline

    spuddy

    Hi all, new to this and this is my first question so please be gentle.

    I'm having problems understanding a particular method in
    org.bukkit.util.Vector
    The method is
    float angle(Vector).
    The docs state this:
    "Gets the angle between this vector and another in radians."

    Exactly what is this returning? I understand it returns an angle in radians, but what angle? The relationship between two three dimensional points needs at least two angles to describe it, you can't fully relate the two points with a single value.
     
  2. Offline

    timtower Moderator Moderator

    @spuddy Vector is direction, not location.
    So you get the angle betwee two directions.
     
  3. Offline

    spuddy

    A single angle between two directions makes sense for 2D direction vectors, but I still don't see how a single angle can describe a relationship between two 3D directions.
     
  4. Offline

    timtower Moderator Moderator

    @spuddy They get transformed to function on a single plane, then the angle is calculated.
     
  5. Offline

    spuddy

    Ah, got it. Thank you. Two straight lines emerging from a single point can define a plane, then a single angle between the lines would make sense on that plane.
     

Share This Page