Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to cut parts of the shape Geometry away in three.js?

Tags:

three.js

Is it possible to remove or cut away sections of shapes in Three.js?

For example, if I made a CylinderGeometry and wanted to "shave" the front of it away, so that the front was flat and the back was curved, like a half cylinder. Is this possible?

I need to be able to do it to the front and back of a cylinder, so just the sides are curved.

like image 325
mcclennon19 Avatar asked Mar 21 '12 23:03

mcclennon19


1 Answers

It is possible. You can deal with triangles yourself, or use Boolean operations with a library like Constructive Solid Geometry to do mesh subtraction.

CSG three.js

Have a look here and here for some suggestions related to manipulating geometry.

There are other algorithms to slice a mesh that could be ported over, but it depends how simple or complex you need this thing to be.

like image 79
George Profenza Avatar answered Oct 14 '22 14:10

George Profenza