{
let hopf = function(eta, psi1, psi2) {
let v = new THREE.Vector4();
v.x = Math.cos(psi1 + psi2) * Math.sin(eta);
v.y = Math.sin(psi1 + psi2) * Math.sin(eta);
v.z = Math.cos(psi1 - psi2) * Math.cos(eta);
v.w = Math.sin(psi1 - psi2) * Math.cos(eta);
return v;
};
let stereo = function(v4) {
let div = Math.max(0.01, 1 - v4.w);
return new THREE.Vector3(v4.x / div, v4.y / div, v4.z / div);
};
let w;
let paramFunc = function(u, v, vector) {
let parts = 50;
u = Math.round(u * parts) / parts;
u *= 2 * Math.PI;
v = Math.round(v * parts) / parts;
v *= 4 * Math.PI;
vector.copy(stereo(hopf(w, u, v)));
};
for (let i = 0; i < 11; i++) {
let eta = (i * Math.PI) / 10;
for (let j = 0; j < 11; j++) {
let psi1 = (j * 2 * Math.PI) / 10;
let points = [];
for (let k = 0; k < 200; k++) {
let psi2 = (k * 4 * Math.PI) / 200;
points.push(stereo(hopf(eta, psi1, psi2)));
}
meshes[i + 10 * j].geometry = new THREE.BufferGeometry().setFromPoints(
points
);
}
}
}