dist/joint.nowrap.js
function(p) {

            var refPointDelta = 30;
            var x0 = p.x;
            var y0 = p.y;
            var a = this.a;
            var b = this.b;
            var center = this.bbox().center();
            var m = center.x;
            var n = center.y;

            var q1 = x0 > center.x + a / 2;
            var q3 = x0 < center.x - a / 2;

            var y, x;
            if (q1 || q3) {
                y = x0 > center.x ? y0 - refPointDelta : y0 + refPointDelta;
                x = (a * a / (x0 - m)) - (a * a * (y0 - n) * (y - n)) / (b * b * (x0 - m)) + m;

            } else {
                x = y0 > center.y ? x0 + refPointDelta : x0 - refPointDelta;
                y = ( b * b / (y0 - n)) - (b * b * (x0 - m) * (x - m)) / (a * a * (y0 - n)) + n;
            }

            return (new Point(x, y)).theta(p);

        }
function(p) {

            var refPointDelta = 30;
            var x0 = p.x;
            var y0 = p.y;
            var a = this.a;
            var b = this.b;
            var center = this.bbox().center();
            var m = center.x;
            var n = center.y;

            var q1 = x0 > center.x + a / 2;
            var q3 = x0 < center.x - a / 2;

            var y, x;
            if (q1 || q3) {
                y = x0 > center.x ? y0 - refPointDelta : y0 + refPointDelta;
                x = (a * a / (x0 - m)) - (a * a * (y0 - n) * (y - n)) / (b * b * (x0 - m)) + m;

            } else {
                x = y0 > center.y ? x0 + refPointDelta : x0 - refPointDelta;
                y = ( b * b / (y0 - n)) - (b * b * (x0 - m) * (x - m)) / (a * a * (y0 - n)) + n;
            }

            return (new Point(x, y)).theta(p);

        }
function ( p ) { var refPointDelta = 30 ; var x0 = p . x ; var y0 = p . y ; var a = this . a ; var b = this . b ; var center = this . bbox ( ) . center ( ) ; var m = center . x ; var n = center . y ; var q1 = x0 > center . x + a / 2 ; var q3 = x0 < center . x - a / 2 ; var y , x ; if ( q1 || q3 ) { y = x0 > center . x ? y0 - refPointDelta : y0 + refPointDelta ; x = ( a * a / ( x0 - m ) ) - ( a * a * ( y0 - n ) * ( y - n ) ) / ( b * b * ( x0 - m ) ) + m ; } else { x = y0 > center . y ? x0 + refPointDelta : x0 - refPointDelta ; y = ( b * b / ( y0 - n ) ) - ( b * b * ( x0 - m ) * ( x - m ) ) / ( a * a * ( y0 - n ) ) + n ; } return ( new Point ( x , y ) ) . theta ( p ) ; }
Compute angle between tangent and x axis
@param {g.Point} p Point of tangency, it has to be on ellipse boundaries.
@returns {number} angle between tangent and x axis
Compute angle between tangent and x axis