is there a way to get an output to a file that gets the point at length of a path and converts it to polyline.
var numPoints = 900;
var mypath = document.getElementById("mypath");
var pathLength = mypath.getTotalLength();
var polygonPoints = [];
for (var i = 0; i <= numPoints; i++) {
var p = mypath.getPointAtLength(i * pathLength / numPoints);
polygonPoints.push(p.x);
polygonPoints.push(p.y);
}
var mypolygon = document.getElementById("mypolygon");
mypolygon.setAttribute("points", polygonPoints.join(","));
via simeone
No comments:
Post a Comment