How to use many vertex to create a irregular sphere?

Hi guys, I want to do some visualization based on data accquired by matlab, in general I want to use these 3D position to create a irregular sphere(looks like a cell body), then combine them with dendrites(created already,demo at http://107.148.151.161/).
My question is, what geometry is suitable to do such thing?

The regular sphere has the 2 poles at top and bottom so the density distribution is kinda weird.

One kind of sphere that I like is the subdivided cube approach…

Instead of 2 poles, it has 8 poles, and less overall distortion…

Looks like this:

Made like this:


  let tmp = new THREE.Vector3()
  let geo = new THREE.BoxGeometry(1,1,1,10,10,10);

  for(let c=geo.attributes.position.count,i=0,p=geo.attributes.position,n=geo.attributes.normal;i<c;i++){
    tmp.set(p.getX(i),p.getY(i),p.getZ(i));
    tmp.normalize();
    p.setXYZ(i,tmp.x,tmp.y,tmp.z);
    n.setXYZ(i,tmp.x,tmp.y,tmp.z);
  }
  let m1=new THREE.Mesh(geo,new THREE.MeshStandardMaterial());
  scene.add(m1)

(glitch: Glitch :・゚✧ )

it may work, but based on my data I can’t use it. I find another way, PolyhedronGeometry, which need more information, verticesOfCube is what I have, I need an algorithm to find indicesOfFaces

Perhaps: ConvexGeometry three.js docs

you are right.
image

1 Like