# Thread: How to progressively map a plane to a semisphere?

1. ## How to progressively map a plane to a semisphere?

this is somehow related to this question
http://www.gimptalk.com/forum/%22ben...re-t39911.html

Anyway my qustion may be a bit different:
suppose a plane, as a rectangular and a bit elastic grid,as a net

Now from below the grid ,in its very center a sphere, no larger then the plane, start to pop out,springing upward , pushing up the net

Beyond a certain point of push the elasticity of the net is no sufficient, starting where tension is higher )the net anchors to the plane broke

More the net is free more it wrap around the sphere

But here the difference with the original question, i would like this applied to the Semisphere not to the sphere

meaning that when half of the sphere pop out, the net should be totally wrapped around the surface of the semisphere:

all anchor points previously on the periphery of the rectangle transferred on the Equator, on the maximum circumference of the Sphere, where intersect the plane.

Now you may replace the word "grid" with "original image"
to understand better the point

well i would really like have a similar mapping script and what i found difficult is not map the plane to the semi-sphere but all the "in betweens", the progression

I believe a script for Mathmap will be the easier and more handy solution (as name said is a gimp plugin created for mapping, and ,bigger point support animation and customized script )

But anyway if that may solved by a gimp script or plugin would be the same till the output may be a animation.

I just think that MathMap, and soon GMIC offer a easier and more flexible solution,and what relevant a good preview of the results, but even as a gimp script will be handy

But i'm not good to write scripts, even less in this case because i can't figure out a formula for a similar mapping

I just hope cartographers may ,if not actually code (will be the best ) found the formula to be applied

2. PS about why i prefer map to a semisphere and not to the sphere

A flat projection of the semisphere will contain all the original image distorted how i wish while in case of a sphere only the half on the upper half of the sphere will be usable (and distortions too extreme )

UPDATE i may have part of the solution how map a square to a semi sphere and a rectangle to the correspondent semi ellipsoid

I failed to find the discussion on the formula to be applied but if may help i have as Mathmap code
filter rel2ellv3(image in)
xprime=x/sqrt(1-4*(y/H)*(y/H));
yprime=y/sqrt(1-4*(x/W)*(x/W));
in(xy:[xprime,yprime])
end
The remaing problem is the progression a smooth transition from the Original Image to the resulting semi sphere or ellipsoid

( And that if the rectangle is not a square result will be a semi ellipsoid and not a semisphere, but that do not worry me so much
...when and if needed may be corrected simply scaling down only the larger side ,to make image's H and W equal)

3. When doing any such transformations, the issue is (I believe) whether you are striving for an equal area transformation, or something else, such as equal lengths or maintaining angles.

I think you want something like this (made manually using warp):

The mapping you asked for only defines what happens at the outer edges, not in the center It could be stretched, shrunk or bent...

-Rob A>

4. Originally Posted by PhotoComix
Code:
```xprime=x/sqrt(1-4*(y/H)*(y/H));
yprime=y/sqrt(1-4*(x/W)*(x/W));```
Are you sure about that transformation? If I apply that to each pixel in your image, I get this:

5. Originally Posted by PhotoComix
I failed to find the discussion on the formula to be applied but if may help i have as Mathmap code
Code:
```filter rel2ellv3(image in)
xprime=x/sqrt(1-4*(y/H)*(y/H));
yprime=y/sqrt(1-4*(x/W)*(x/W));
in(xy:[xprime,yprime])
end```
I've just had a brief look at mathmap's documentation and examples, and it appears to be able to do animations; as far as I can tell, if you use a "t" parameter it will automatically generate an animated gif (see http://www.complang.tuwien.ac.at/sch...map/anims.html and http://www.complang.tuwien.ac.at/sch...tml#animations). So assuming your xprime, yprime transformations work correctly in mathmap to give your final image, then I'd guess you might be able to get your desired animation with this:

Code:
```filter rel2ellv3(image in)
xprime=x/sqrt(1-4*(y/H)*(y/H));
yprime=y/sqrt(1-4*(x/W)*(x/W));
in(xy:[x+t*(xprime-x),y+t*(yprime-y)])
end```
I haven't tried it, though.

6. Originally Posted by isomage
Code:
```filter rel2ellv3(image in)
xprime=x/sqrt(1-4*(y/H)*(y/H));
yprime=y/sqrt(1-4*(x/W)*(x/W));
in(xy:[x+t*(xprime-x),y+t*(yprime-y)])
end```
I haven't tried it, though.
I tried it. works brilliantly!

Good job.

-Rob A>

7. filter rel2ellv3(image in)
xprime=x/sqrt(1-4*(y/H)*(y/H));
yprime=y/sqrt(1-4*(x/W)*(x/W));
in(xy:[x+t*(xprime-x),y+t*(yprime-y)])
end

I haven't tried it, though.
@Isomage

I did try...perfect ! ...exactly what i was looking for, thank a lot (and thanks for all the other contribute )

PS the image you posted as example was strange but the code work well !

###############################

About animation gif has to low quality for my taste, but gimp (with a AVI plugin, or with GAP ) may save as uncompressed AVI, then is quite simple apply a codec to shrink the file size or convert to FLV

8. I exported it as an AVI using the AVI plugin (which uses some really funky codec... if anyone uses it, one tip is to make sure your image size is divisible by 2 in both directions).

virtualdub would read it, so I piped it through avisynth, then used virtual dub to convert it to a divx.

In you are interested, the result is here:
http://ffaat.pointclark.net/incoming/test-divx.avi

-Rob A>

9. Wouldn't it be easier to use the image as a texture on a sphere or hemisphere in blender or some other 3d app and just take a render of it?

I know it's not what you want, as you seem to be streets ahead of me on the maths, but perhaps the obvious solution was overlooked...

10. Had to admit that I was thinking much the same thing. Get a grid, texture it with UV coords, create a morph target of a hemisphere and then set the anim off.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•