简体   繁体   中英

How to extrude height segments from a cylinder in three.js?

I have a cylinder that is split into many height segments (the amount depends on the data). For each height segment I have a value for which I want the entire circle at that height to be extruded.

So essentially I end up with a cylinder that has very spiky edges.

I was intending to do this by manually moving the vertices or faces but I cannot seem to access the vertices/faces for a given segment.

So basically I need to scale the segment at N height.

Any suggestions on which direction I take? Have had a few failed attempts now and am running out of ideas.

Have a look at the source code for CylinderGeometry.js on GitHub.

You could copy this entire method and call it something different, eg

 THREE.CylinderGeometry2 = function (...

Then change the generation of the vertices based on the number of height segments you have.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM