remove mapFaces and promote indexFaces as a replacement
This commit is contained in:
parent
0d58db27ed
commit
abf20eb11b
3 changed files with 45 additions and 102 deletions
|
|
@ -77,31 +77,18 @@ function analyze(id, opt = {}) {
|
|||
}
|
||||
|
||||
function isolateBodies(id) {
|
||||
let tool = mapFaces(id);
|
||||
let tool = indexFaces(id);
|
||||
log(`${id} | isolating bodies`);
|
||||
return tool.isolateBodies();
|
||||
}
|
||||
|
||||
function mapFaces(id) {
|
||||
let rec = cache[id];
|
||||
let { geo, tool } = rec;
|
||||
if (!tool) {
|
||||
tool = rec.tool = new mesh.tool();
|
||||
}
|
||||
if (!tool.normals) {
|
||||
log(`${id} | generating face map`);
|
||||
tool.generateFaceMap(geo.attributes.position.array);
|
||||
}
|
||||
return tool;
|
||||
}
|
||||
|
||||
function indexFaces(id) {
|
||||
let rec = cache[id];
|
||||
let { geo, tool } = rec;
|
||||
if (!tool) {
|
||||
tool = rec.tool = new mesh.tool();
|
||||
}
|
||||
if (!tool.normals) {
|
||||
if (!tool.indexed) {
|
||||
log(`${id} | indexing mesh`);
|
||||
tool.index(geo.attributes.position.array);
|
||||
}
|
||||
|
|
@ -292,9 +279,9 @@ let model = {
|
|||
};
|
||||
},
|
||||
|
||||
mapFaces(data) {
|
||||
indexFaces(data) {
|
||||
let { id, opt } = data;
|
||||
let tool = opt.index ? indexFaces(id) : mapFaces(id);
|
||||
let tool = indexFaces(id);
|
||||
return { mapped: true };
|
||||
},
|
||||
|
||||
|
|
@ -350,7 +337,7 @@ let model = {
|
|||
}
|
||||
// if the geometry has indexed faces and radians are set, find surface
|
||||
const tool = rec.tool;
|
||||
if (tool && tool.sides && radians) {
|
||||
if (tool && tool.indexed && radians) {
|
||||
const match = tool.findConnectedSurface(faces, radians, filterZ);
|
||||
return { faces: match, edges, verts, point };
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue