patch polygons with new missing funcs for trace
This commit is contained in:
parent
76f9ce2c25
commit
1ad6749c68
2 changed files with 17 additions and 1 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue