12-15-2019, 10:24 AM
Something like that could work
volume = function () {
let faces =[[1,12,3],[3,12,7],[5,14,1],[7,14,5],[12,1,13], ... ],
vertices = [[0.11063329,-0.83372273,-2.1072196],[0.11063329,-0.83372273,-0.1072196], ... ],
groups = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4],
faceCsg = faces.map(m => CSG.Polygon.createFromPoints(m.map(n => vertices[n]))),
csg = CSG.fromPolygons(faceCsg);
return {faces:faces, vertices:vertices, groups:groups, faceCsg:faceCsg, csg:csg};
};
function main () {
return volume().csg;
}
volume = function () {
let faces =[[1,12,3],[3,12,7],[5,14,1],[7,14,5],[12,1,13], ... ],
vertices = [[0.11063329,-0.83372273,-2.1072196],[0.11063329,-0.83372273,-0.1072196], ... ],
groups = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4],
faceCsg = faces.map(m => CSG.Polygon.createFromPoints(m.map(n => vertices[n]))),
csg = CSG.fromPolygons(faceCsg);
return {faces:faces, vertices:vertices, groups:groups, faceCsg:faceCsg, csg:csg};
};
function main () {
return volume().csg;
}