nl_tokens: Find point on my boundary where line starting from my center ending in point p intersects me .
pl_tokens: function ( p , angle ) { p = point ( p ) ; var center = point ( this . x + this . width / 2 , this . y + this . height / 2 ) ; var result ; if ( <mask> ) p . rotate ( center , angle ) ; // (clockwise, starting from the top side) var sides = [ line ( this . origin ( ) , this . topRight ( ) ) , line ( this . topRight ( ) , this . corner ( ) ) , line ( this . corner ( ) , this . bottomLeft ( ) ) , line ( this . bottomLeft ( ) , this . origin ( ) ) ] ; var connector = line ( center , p ) ; for ( var i = sides . length - 1 ; i >= 0 ; -- i ) { var intersection = sides [ i ] . intersection ( connector ) ; if ( intersection !== null ) { result = intersection ; break ; } } if ( result && angle ) result . rotate ( center , - angle ) ; return result ; }