Merge branch 'rel-4.2' of https://github.com/GridSpace/grid-apps into rel-4.2

This commit is contained in:
bakedpotatolord 2025-06-24 12:23:31 -06:00
commit 4695406d8d
85 changed files with 987 additions and 298 deletions

View file

@ -1002,6 +1002,23 @@ 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) {