Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I think you're looking for a different kind of 'extrusion' called a <a href="https://github.com/mrdoob/three.js/blob/master/src/extras/geometries/LatheGeometry.js" rel="nofollow noreferrer">Lathe</a>. You'd need to create a path with points describing an offset rectangle which you'd then pass to LatheGeometry and plug into your Mesh instance:</p> <p><img src="https://i.stack.imgur.com/mAWLk.png" alt="lathe view 1"></p> <p><img src="https://i.stack.imgur.com/B0ovO.png" alt="lathe view 2"></p> <p>e.g.</p> <pre><code>var pts = [ new THREE.Vector3(150,0,50),//top left new THREE.Vector3(200,0,50),//top right new THREE.Vector3(200,0,-50),//bottom right new THREE.Vector3(150,0,-50),//bottom left new THREE.Vector3(150,0,50)//back to top left - close square path ]; var mesh = new THREE.Mesh( new THREE.LatheGeometry( pts, 12 ), new THREE.MeshLambertMaterial( { color: 0x2D303D, wireframe: true, shading: THREE.FlatShading } )); mesh.position.y = 150; mesh.overdraw = true; mesh.doubleSided = true; scene.add( mesh ); </code></pre> <p>In the LatheGeometry constructor, the first parameter is the path you want to lathe as an array of points, the second is the number of steps (the more steps, the more detail/radial iterations) and the third (which I'm not using in the example) is the angle - by default it goes 360, but you can also control that. </p> <p>Regarding the points, notice they are offset a bit on the x axis. Positioning your points will affect not only the size of the square being lathed but also the lathe offset (an offset of 0 should get you a full cylinder). Also, the points will affect the lathe axis (notice I've used XZ).</p> <p>If you're not familiar with the concept of lathes you should probably have a play in a 3D editor as most of them support the feature. (A bit off topic, but this operation is kind of supported in Illustrator under Effects > 3D > Revolve )</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload