mrdoob/three.js — Issue #907: Extrude geometry, path holes bug
Author: nosy-b
Created: 2011-12-14 14:10:17+00:00
State: open

Hi,

I'm working on a simple modeler and I used ExtrudeGeometry on a shape containing some holes.
It ususally works fine with one or two holes but it seems not very stable after. I tried to keep anti-clockwise order for hole vertices but still it doesn't work fine.
Here is a very simple example that doesn't work, the triangulation is wrong:

var path = new THREE.Path();

path.moveTo( 0, 0 );
path.lineTo(80, 0);
path.lineTo( 80, -100);
path.lineTo( 0, -100);
path.lineTo( 0, 0);

path.moveTo( 30, -40 );
path.lineTo( 40, -40 );
path.lineTo( 40, -30 );
path.lineTo( 30, -30 );
path.lineTo( 30, -40 );

path.moveTo( 10, -20 );
path.lineTo( 20, -20 );
path.lineTo( 20, -10 );
path.lineTo( 10, -10 );
path.lineTo( 10, -20 );

path.moveTo( 25, -15 );
path.lineTo( 35, -15 );
path.lineTo( 35, -5 );
path.lineTo( 25, -5 );
path.lineTo( 25, -15 );

var shapes = path.toShapes();
var solid = new THREE.ExtrudeGeometry(shapes, { amount: height, bevelEnabled: false });
var mesh = new THREE.SceneUtils.createMultiMaterialObject(solid, [ new THREE.MeshBasicMaterial( { color: 0xff00ff } ));

scene.add(mesh);

If you have any idea it would save me because I really don't get it and I don't know any other way to do some simple building façade :)