add step angle option for lathe (perhaps determine heuristically in the future)

This commit is contained in:
Stewart Allen 2023-02-13 14:46:15 -05:00
commit 47bd68ca0b
6 changed files with 36 additions and 32 deletions

View file

@ -15,6 +15,7 @@ const { base } = root;
const { config, util, polygons, newBounds, newPoint } = base;
const POLY = polygons,
XAXIS = new THREE.Vector3(1,0,0),
DEG2RAD = Math.PI / 180,
clib = self.ClipperLib,
clip = clib.Clipper,
@ -967,6 +968,19 @@ class Polygon {
return [this.first().key, this.last().key, this.length].join('~~');
}
applyRotations() {
for (let point of this.points) {
if (point.a) {
let p2 = new THREE.Vector3(point.x, point.y, point.z)
.applyAxisAngle(XAXIS, point.a * DEG2RAD);
point.x = p2.x;
point.y = p2.y;
point.z = p2.z;
}
}
return this;
}
/**
* set this polygon's winding in alignment with the supplied polygon
*/