WHS.Parametric
generates a geometry representing Parametric surface
It is usually used to develop different kinds of highfields or visualize a math function.
Example will create heightfield-like geometry. u
and v
are like x
and y
in shape, but their values are always from 0
to 1
.
We use them in THREE.Vector3
like x
and z
and Math.random() * 5
for y
.
const createParametric = (u, v) => {
return new THREE.Vector3(u * 30, Math.random() * 5, v * 30);
}
const parametric = new WHS.Parametric({
geometry: {
func: createParametric
},
material: new THREE.MeshLambertMaterial({
color: 0xffffff,
side: THREE.DoubleSide
}),
position: [0, 100, -100]
});
parametric.addTo(world);
Updated almost 8 years ago