diff --git a/src2/geo/polygon.js b/src2/geo/polygon.js index b6e49f07..6e665522 100644 --- a/src2/geo/polygon.js +++ b/src2/geo/polygon.js @@ -997,6 +997,23 @@ export class Polygon { return this.z !== undefined ? this.z : this.points[i || 0]?.z || 0; } + minZ() { + return Math.min(...this.points.map(p => p.z)); + } + + avgZ() { + return [...this.points.map(p => p.z)].reduce((a,v) => a+v) / this.points.length; + } + + /** + * @param {*} z value target + * @param {*} epsilon allowed Z variance + * @returns {boolean} true if all points Z within epsilon of value + */ + onZ(z, epsilon = 10e-4) { + return Math.max(...this.points.map(p => Math.abs(z - p.z))) < epsilon; + } + /** */ render(layer, color, recursive, open) { diff --git a/src2/kiri-mode/cam/driver-fe.js b/src2/kiri-mode/cam/driver-fe.js index e5cf20c7..d78f0ac1 100644 --- a/src2/kiri-mode/cam/driver-fe.js +++ b/src2/kiri-mode/cam/driver-fe.js @@ -45,7 +45,6 @@ function traces(ondone, single) { const settings = api.conf.get(); const widgets = api.widgets.map(); api.client.send("cam_traces", { settings, single }, output => { - console.log({ output }); const ids = []; codec.decode(output).forEach(rec => { ids.push(rec.id);