Q:

Deformation of Sphere using Transformations

I have a graphic related question. I need to have a transformation matrix that I have no idea about what it is. The problem is to create right image from the right sphere. I created those images in Maya, but I need some matrices for the graphics course. Here is the image:

Our professor told us to use some sine and cosine in our transformations, but I have no idea what he meant. I thought of intersecting a plane from the grid(that is xz plane) and sphere, and then scaling down the resulting circle. Would that work?
I also checked this paper, however it looks like a bit advanced for me. Another thing is I guess that paper is not about the same type of information I was looking for.
It would be great if you could help me.

A:

This type of transformation cannot be done with a (single) matrix; those can only handle linear transformations, and the image you posted plainly shows a non-linear transformation.  (A linear transformation could deform the sphere into an ellipsoid, but it couldn't produce a waist in the middle like that.)
I'm going to assume that what your professor meant here was to apply a different matrix to each vertex of the sphere, where the matrix depends on the vertex's position.  So to apply it, you'd iterate over the vertices, calculate the matrix for each vertex according to some formula that you can make up, and then transform that vertex by the resulting matrix.
For example, to suck in the middle of the sphere like that shown, you might want to use a scaling in the xz plane, where the amount of scaling depends on the vertex's y-coordinate.  You'd make up a function that would give you a scale factor less than 1.0 when y = 0, but increases toward 1.0 as y goes up to +1 or down to -1.  You could make such a function by taking a sin or cos function and scaling/translating it appropriately.  Actually, just a quadratic function like (y^2 + 1) / 2 would do as well.

