Volume of THREE.BufferGeometry()

@kubinho1032
Hi!
Use THREE.TextBufferGeometry() instead.
Or you can adapt this code to work with usual geometry.

In general, you need to get vertices of each face, something like that:

geometry.faces.forEach( face => {
    p1.copy(geometry.vertices[face.a]);
    p2.copy(geometry.vertices[face.b]);
    p3.copy(geometry.vertices[face.c]);
    sum += signedVolumeOfTriangle(p1, p2, p3);
})
2 Likes