Shane Hudson
Shane Hudson

Reputation: 719

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.

Upvotes: 0

Views: 361

Answers (1)

Quantumplate
Quantumplate

Reputation: 1104

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

You could copy this entire method and call it something different, e.g.

 THREE.CylinderGeometry2 = function (...

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

Upvotes: 1

Related Questions