@z3dev You're right, the problem was about winding and by correcting it for MeasureArea() < 0 and triangulating was enough to make it work. I updated my source here : https://github.com/gilboonet/gilboonet.github.io/blob/master/demos/gigi.js It contains a volume exported from Wings3d, with Cube1_default() that contains data with quads and table() with this :
function table() {
var a = Cube1_default();
var tmp = [];
for(var i = 0; i < a.polygons.length; i++){
if (measureArea(a.polygons[i]) < 0){
a.polygons[i] = a.polygons[i].reverse();
}
for(var j = 1; j< a.polygons[i].length-1; j++){
tmp.push([a.polygons[i][0], a.polygons[i][j], a.polygons[i][j+1]]);
}
}
return scale([8,8,8], polyhedron({points:a.points, faces:tmp}));
}
There is certainly a way to write this code a more modern way with map() to speed it up.