n calculateDirection(p1, p2) {
            var dx, dy, da;
            var m_dDirection = 0;

            dx = p2[0] - p1[0];
            dy = p2[1] - p1[1];

            if (dx == 0) {
                if (dy > 0) m_dDirection = 0;
                else m_dDirection = 180;
            } else {
                if (dx > 0) {
                    if (dy == 0) {
                        m_dDirection = 90;
                    } else {
                        if (dy > 0) {
                            da = Math.abs(d