To draw a shape like that you need to collect the points in the correct order in counterclockwise direction. The problem in your case is that you also are drawing a hole in your mesh. This makes it much more difficult and I don't know exactly how to do this correctly using THREE.Geometry
only.
But I would suggest to take a look at the THREE.Shape
class.
It allows you to draw a shape with holes and then the shape can be converted to a geometry (THREE.ShapeGeometry
) using the makeGeometry()
method.
var shape = new THREE.Shape();
shape.moveTo( 10,10 )
shape.lineTo( 20, 10 );
shape.lineTo( 20, 20 );
shape.lineTo( 10, 20 );
shape.lineTo( 10, 10 );
geometry = shape.makeGeometry();
mesh = new THREE.Mesh( geometry, material );
scene.add( mesh );
The THREE.Shape
api allows also for holes and other more complicated curves. I think it will be useful in your case.