add more selection info. merge groups and models stats
This commit is contained in:
parent
3d1e111801
commit
5e9aed2c9a
3 changed files with 45 additions and 13 deletions
|
|
@ -96,7 +96,7 @@ let selection = {
|
|||
},
|
||||
|
||||
clear() {
|
||||
for (let s of selected) {
|
||||
for (let s of selection.list()) {
|
||||
selection.remove(s);
|
||||
}
|
||||
},
|
||||
|
|
@ -362,6 +362,20 @@ let util = mesh.util = {
|
|||
array.push(v);
|
||||
}
|
||||
return array;
|
||||
},
|
||||
|
||||
average(array, opt = {}) {
|
||||
let fields = opt.fields || ['x', 'y', 'z'];
|
||||
let avg = {};
|
||||
for (let e of array) {
|
||||
for (let f of fields) {
|
||||
avg[f] = (avg[f] || 0) + e[f];
|
||||
}
|
||||
}
|
||||
for (let f of fields) {
|
||||
avg[f] = (avg[f] || 0) / array.length;
|
||||
}
|
||||
return avg;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -127,6 +127,18 @@ mesh.model = class MeshModel extends mesh.object {
|
|||
this._group = gv;
|
||||
}
|
||||
|
||||
get attributes() {
|
||||
return this.mesh.geometry.attributes;
|
||||
}
|
||||
|
||||
get vertices() {
|
||||
return this.attributes.vertices.count;
|
||||
}
|
||||
|
||||
get faces() {
|
||||
return this.vertices / 3;
|
||||
}
|
||||
|
||||
opacity(ov) {
|
||||
let mat = this.mesh.material;
|
||||
if (ov === undefined) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue