-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
Closed
Description
Im trying to retrieve the index of the face from the octree.search function. Any ideas on how to find it.
I have a bufferGeometry that i convert to geometry, Create an octree from and search. I then want to toss the octree and geometry mesh away and go back to using my buffer geometry. But can not find a way to correlate the octree face results to the indexed bufferGeometry.
I do notice that faces are the same as indexes in bufferGoemetry and geometry( geometry.faces[i].a = bufferGeometry.index.array[i*3+0] )
Current Dumb Loop
octreeFaces: for (var octreeFaceIndex = 0; octreeFaceIndex < octreeResult.length; octreeFaceIndex++)
for (
var indexIndex = parseInt(surface.geometry.index.array.indexOf(octreeResult[octreeFaceIndex].faces.a) / 3) * 3,
lastIndexIndex = parseInt(surface.geometry.index.array.lastIndexOf(octreeResult[octreeFaceIndex].faces.a) / 3) * 3;
indexIndex <= lastIndexIndex;
indexIndex += 3
) {
if (
surface.geometry.index.array[indexIndex + 0] == octreeResult[octreeFaceIndex].faces.a &&
surface.geometry.index.array[indexIndex + 1] == octreeResult[octreeFaceIndex].faces.b &&
surface.geometry.index.array[indexIndex + 2] == octreeResult[octreeFaceIndex].faces.c
) {
indexes2check.push(indexIndex);
console.log(surface.geometry.index.array[indexIndex + 0], surface.geometry.index.array[indexIndex + 1], surface.geometry.index.array[indexIndex + 2])
console.log(indexIndex, octreeResult[octreeFaceIndex])
console.log('FOUND')
continue octreeFaces;
}
}