Page 1 of 3 123 LastLast
Results 1 to 10 of 23

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

Hybrid View

  1. #1

    Post 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
    Last edited by PhotoComix; 05-01-2009 at 01:15 PM.

  2. #2

    Post

    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)
    Last edited by PhotoComix; 05-01-2009 at 03:36 PM.

  3. #3
    Administrator RobA's Avatar
    Join Date
    Apr 2007
    Location
    Niagara, Canada
    Posts
    5,567

    Post

    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):
    Click image for larger version. 

Name:	warp.jpg 
Views:	208 
Size:	31.1 KB 
ID:	12869

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

    Post

    Quote Originally Posted by PhotoComix View Post
    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:
    Attached Images Attached Images  
    Last edited by isomage; 05-02-2009 at 08:58 PM.
    My random map generators and GIMP scripts: http://axiscity.hexamon.net/users/isomage/

  5. #5

    Post

    Quote Originally Posted by PhotoComix View Post
    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.
    Last edited by isomage; 05-02-2009 at 11:00 PM.
    My random map generators and GIMP scripts: http://axiscity.hexamon.net/users/isomage/

  6. #6
    Administrator RobA's Avatar
    Join Date
    Apr 2007
    Location
    Niagara, Canada
    Posts
    5,567

    Post

    Quote Originally Posted by isomage View Post
    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. #7

    Post

    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
    Last edited by PhotoComix; 05-04-2009 at 05:06 AM.

  8. #8
    Administrator RobA's Avatar
    Join Date
    Apr 2007
    Location
    Niagara, Canada
    Posts
    5,567

    Post

    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. #9
    Community Leader Gracious Donor ravells's Avatar
    Join Date
    Jun 2006
    Location
    London, UK
    Posts
    10,934

    Default

    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. #10
    Software Dev/Rep Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    4,807
    Blog Entries
    4

    Post

    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
  •