Using binary operations to combine meshes
In this section, we'll look at a different way of creating geometries. In this chapter, so far, and in the previous chapter, we used the default geometries provided by Three.js to create interesting-looking geometries. With the default set of properties, you can create beautiful models, but you are limited to what Three.js provides. In this section, we'll show you how you can combine these standard geometries to create new ones—a technique known as Constructive Solid Geometry (CSG) To do this, we use the Three.js extension ThreeBSP, which you can find online at https://github.com/skalnik/ThreeBSP. This additional library provides the following three functions:
Name |
Description |
---|---|
|
This function allows you to create a new geometry based on the intersection of two existing geometries. The area where both geometries overlap will define the shape of this new geometry. |
|
The union function can be used to combine two geometries and create... |