SVGElement.prototype.getTransformToElement = SVGElement.prototype.getTransformToElement || function(toElement) { return toElement.getScreenCTM().inverse().multiply(this.getScreenCTM()); }; function ns_elem () { if (typeof arguments[0] === "undefined") { console.log('There was an error in the element assist function. Called with no valid tag name!');} var elem; if (typeof arguments[1] === "string") { elem = document.createElementNS(arguments[1], arguments[0]); for (var i=2; i -1) { // only splice array when item is found list.splice(index, 1); // 2nd parameter means remove one item only } } function appropriate_angle(point) { return -Math.atan2(point.x, point.y); } function newsvg(element) { document.createElementNS(svg_ns, element); } function set_loc(elem, point) { return $(elem).attr("cx", point.x).attr("cy",point.y)} function get_global_point_at_length(svg, path, distance) { return path.getPointAtLength(distance).matrixTransform(path.getTransformToElement(svg)); }