# 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.

-

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.

-
Can it also be done by manipulating the cos and sines of the spherical coordinate formula of sphere? What I meant is not transformations, but constructing that kind of a shape from the scratch? – Mert Toka Nov 16 '12 at 4:39
Yes, you could plot such a shape in spherical coordinates by setting r = a sin or cos function of the polar angle. – Nathan Reed Nov 16 '12 at 4:59
I guess that also work as true according to my professor. Is the default sphere formula like this: r = cos(theta)*sin(phi)? – Mert Toka Nov 16 '12 at 9:47
The formula for a sphere in spherical coordinates is just r = a constant. (You might be thinking of the conversion from spherical to Cartesian, which has factors like cos(theta)*sin(phi) and others.) – Nathan Reed Nov 16 '12 at 18:26
This question turned out to be one of the questions of my midterm that is prepared by our indulgent professor, and my answer was multiplying x and z coordinates of sphere by (cos(phi)+r1) where r1 is the new radius of middle circle when intersected with xz. I dont know if it is correct, but it seemed very plausible during the exam. – Mert Toka Nov 17 '12 at 13:24