# Unflattening a surface

1. Nov 28, 2007

### Starbug

"unflattening" a surface

Hi,

I have a strange problem to solve. Imagine having a surface defined in 3D, say for example a cone, pointing up in the Z direction and sliced in half through the Y-Z plane.

The half cone is then sliced further into a number of sections with horizontal cuts through the XY plane. The different sections are then flattened to 2D panels. (I'm not sure exactly what name would be given to the process for doing this, and I think there are possibly quite few ways it could be done, but the goal in general when flattening is to preserve some properties of the surface, i.e as if you were modeling a piece of cloth and wanted to flatten it without stretching it.)

Given these 2d panels (i.e given the poly-lines that define the four edge curves) produced from such a process I need to find a way to get back to the original 3D surface, in the above example I need to recover the cone. At first I wasn't sue this could be done as it seemed like there were too few constraints, apart form the need to preserve the geodesic distances between edge points. However the important point I think is that the top and bottom edge points of each panel are not straight and do not match up with the corresponding edge of the adjacent panel. The surface therefore needs to be deformed into 3D in such a way as to match these points up.

My first thought is to make a mesh from the 2d panels and then some sort of Metropolis style search to deform the mesh with the "energy" term favoring the edges being lined up while preventing the mesh from stretching. These sorts of methods must be fairly standard in modeling cloth and so on, although I'm not very knowledgeable of them myself. I don't know if anyone can see a more obvious way to do this.

2. Nov 28, 2007

### wysard

What you are doing is a variation on calculating backwards from a portion of a conic frustum to the cone itself.

If you take a cone, slice it up it's slant height from bottom to tip and lay it open on a 2D surface you get a circle with a slice missing. The angle of the slice is exactly twice the angle of the cone. Ie: a 358 degree slice would yeild a 189 degree cone. (exceedingly flat...) a 180 degree slice would yield a 90 degree cone and so on.

What you have done is cut the cone in half and then project it into 2 dimensions. So the answer is to take the angles of the flat ends of the 1/2 of a cone frustum you have made to each other and that is the angle of the cone you must make to restore it to it's original 3D shape.

Note that the solution has both a positive and a negative sign. In other words it will tell you the angle of the cone, but not the orientation. A problem easily solved by storing the XYZ co-ordinates of the four corners of the frustum piece. ( I presume that for the tip of the cone you would simply store the frustum piece with the two "top" corners being identical )

3. Dec 2, 2007

### Starbug

Thanks for your post. However I should have been a bit clearer in my original post, the surface I'm trying to find my back to is not a cone as such, it's actually a set of bezier patches which are just cone like. (So I don't think the angle of the edges can be that informative.)

I doubt there's a neat geometrical solution to this, and in fact I'm not sure there's a unnique solution at all.

4. Dec 3, 2007

### wysard

Gotcha.

I got it. I grasp the concept. (James Woods as Hades)

But it begs the question why? If you are using a series of Bezier patches, presumably bi-cubic patches to model some 3D surface I'm 100 percent certain it is not possible to project or flatten all of the potential surfaces without stretching or overlap. (Most certainly, but some just can't be done that way) I am also dead certain you can't do it more economically than storing the actual 16 control points and the values for theta, phi and rotation.

Are you trying to come up with a fast texturizing process? Perhaps if you can give me an idea why you are "flattening" the patch in the first place we could be more forthcoming.