Graphics Reference
In-Depth Information
Rendering
3D
formulas
as
3D
geometries
Three.js offers many different ways to create geometries. You can use the standard
Three.js objects, such as THREE.BoxGeometry and THREE.SphereGeometry ,
create geometries completely from scratch, or just load models created by external
3D modeling programs. In this recipe, we will show you another way to create geo-
metries. This recipe shows you how to create geometries based on math formulas.
Getting ready
For this recipe, we'll be using the THREE.ParametricGeometry object. As this is
available from the standard Three.js distribution, there is no need to include additional
JavaScript files.
To see the end result of this recipe, you can look at 02.10-create-parametric-
geometries.html , you'll see something similar to the following screenshot:
This figure shows you a Gray's Kleinbottle , which is rendered based on a couple of
simple math formulas.
How to do it...
Generating geometries using math formulas with Three.js is very easy and only takes
two steps:
Search WWH ::




Custom Search