With THREE.ParametricGeometry, you can create a geometry based on an equation. Before we dive into our own example, a good thing to start with is to look at the examples already provided by Three.js. When you download the Three.js distribution, you get the examples/js/ParametricGeometries.js file. In this file, you can find a couple of examples of equations you can use together with THREE.ParametricGeometry. The most basic example is the function to create a plane:
plane: function ( width, height ) {
return function ( u, v, optionalTarget ) {
var result = optionalTarget || new THREE.Vector3();
var x = u * width;
var y = 0;
var z = v * height;
return result.set( x, y, z );
};
}
This function is called by THREE.ParametricGeometry. The u and v values will range from 0 to...