add face flatten tool

This commit is contained in:
Stewart Allen 2024-09-10 21:15:19 -04:00
commit 1a1a17a9bb
5 changed files with 79 additions and 2 deletions

View file

@ -367,6 +367,17 @@ let model = {
let { id, opt } = data;
let tool = analyze(id, opt);
log(`${id} | unrolling...`);
let zlist = tool.listZ();
let unrolled = tool.unrolled();
return { vertices: unrolled.toFloat32(), zlist };
},
flatten(data) {
let { id, faces } = data;
let tool = analyze(id, { });
log(`${id} | flatten...`);
let { unique, average } = tool.flattenZ(faces);
log(`${id} | average=${average.round(3)} uniques=${unique.length}`);
let unrolled = tool.unrolled();
return { vertices: unrolled.toFloat32() };
},