I’m not good at the maths part and hoping for ideas of how to approach this. I use the word cloud example which is great. But typical smart phone screens are rectangular so there is often either wasted space or if scaled in, parts are cut off.
The example uses Three.Spherical(), positions words on the sphere, and uses trackball controls.
My idea for a solution is to create an ellipsoid or ovaloid(?) to replace the Spherical. And scale to the aspect ratio of the phone screen.
I found this example of how to draw an ellipsoid.
const ellipsoidGeometry = new THREE.SphereGeometry(0.5, 32, 16);
ellipsoidGeometry.rotateZ(Math.PI/2);
ellipsoidGeometry.scale(2, 1, 1);
const ellipsoidMesh = new THREE.Mesh(ellipsoidGeometry, yourMaterial);
It seems worst case I can position words on the sphere before transforming it, then scale and rotate the location of the words in the same manner as the sphere is transformed.
The control is the issue I can’t get my head around. The example trackball control is very user friendly and easy, and rotation over the poles works as expected. I have no idea of how to adapt that for an ellipsoid. Especially rotation over the poles.
Maybe fork the source (I am using r3f) and modify the camera movement using a similar scale and rotation? Or?
Just thought I would pass this by and see if there is a better approach or if I have missed somethings.Thanks!