nl_tokens: Compute the angle between me and p and the x axis . ( cartesian - to - polar coordinates conversion ) Return theta angle in degrees .
pl_tokens: function ( p ) { p = <mask> ( p ) ; // Invert the y-axis. var y = - ( p . y - this . y ) ; var x = p . x - this . x ; // Makes sure that the comparison with zero takes rounding errors into account. var PRECISION = 10 ; // Note that `atan2` is not defined for `x`, `y` both equal zero. var rad = ( y . toFixed ( PRECISION ) == 0 && x . toFixed ( PRECISION ) == 0 ) ? 0 : atan2 ( y , x ) ; // Correction for III. and IV. quadrant. if ( rad < 0 ) { rad = 2 * PI + rad ; } return 180 * rad / PI ; }