move speed calc and compensation into pre vs gcode post processing

This commit is contained in:
Stewart Allen 2017-12-13 16:04:56 -05:00
commit f3c4f647f3
5 changed files with 140 additions and 102 deletions

View file

@ -227,9 +227,8 @@ var gs_base_point = exports;
};
/**
* return a point along the line this from point to p2
* but offset by a distance. positive distances are
* closer to this point.
* return a point along the line this from point to p2 offset
* by a distance. positive distances are closer to this point.
*
* @param p2
* @param dist
@ -244,6 +243,23 @@ var gs_base_point = exports;
return newPoint(p2.x - ox, p2.y - oy, p2.z, KEYS.NONE);
};
/**
* return a point along the line this from point to p2 offset
* by a distance. positive distances are farther from this point.
*
* @param p2
* @param dist
*/
PRO.offsetPointTo = function(p2, dist) {
var p1 = this,
dx = p2.x - p1.x,
dy = p2.y - p1.y,
ls = dist / Math.sqrt(dx * dx + dy * dy),
ox = dx * ls,
oy = dy * ls;
return newPoint(p1.x + ox, p1.y + oy, p2.z, KEYS.NONE);
};
/**
* @param {Point} p2
* @param {number} offset
@ -263,7 +279,6 @@ var gs_base_point = exports;
return BASE.newLine(np1, np2, KEYS.NONE);
};
/**
* checks if a point is inside of a polygon
* does not check children/holes