mercredi 19 août 2015

Repartition of points in an ellipsoid PointCloud with Three.js

I have recently started to experiment with Three.js. I tried to create an ellipsoid cloud of particles using the PointCloud object.

I generate random points using the parametric equation of an ellipsoid like so:

    var vertex = new THREE.Vector3();
    u = Math.random() * 2 * Math.PI;
    v = Math.random() * Math.PI;
    vertex.x = Math.random() * a * Math.cos(u) * Math.sin(v);
    vertex.y = Math.random() * b * Math.sin(u) * Math.sin(v);
    vertex.z = Math.random() * c * Math.cos(v);

But when I render the cloud, I notice that an unusual amount of particles agglomerate around the ellipsoid's axes.

I am wondering if this is linked with the distribution of the Math.random() function or am I missing something ? Please help me understand this.

You can have a look at it here




Aucun commentaire:

Enregistrer un commentaire