[comp.graphics] Mapping algorithm question - NOT cartograpy

rickc@agora.UUCP (Rick Coates) (04/08/88)

A new question:  I am interested in mapping one 2d area into another.
The first area may be rectangular, the second a collection of vectors
with four points defined as corresponding to the original rectangle's.

This is a 'rubber sheet' analogy, where you draw a picture on a stretchable
sheet, then deform it.

Any references?  The closest I have found is some references in older
ray tracing papers on texture mapping, but the articles just discuss
this as a concept, not how to do it.

I have seen this done - at SIGGRAPH 85 a French company had some
presentation graphics (? I think) running on a Tektronix 4115 that
seemed to do this, but I didn't have a chance to play with it.

I realize that this problem is not completely defined - behavior in
in extreme cases may be odd.  I am interested in any and all input.

Some other comments: it isn't necessary to transform lines or other
complex shapes, just points will do - long vectors can be broken into
short enough ones. Holes might be interesting (what happens if your
hole goes outside the outer boundary? Do you invert?).

Many thanks in advance,

Rick Coates

...!tektronix!sequent!islabs!ateq!rick
OR
...!tektronix!reed!percival!agora!rickc

trainor@lanai.cs.ucla.edu (Vulture of Light) (04/10/88)

In article <844@agora.UUCP> rickc@agora.UUCP (Rick Coates) writes:
>A new question:  I am interested in mapping one 2d area into another.
>The first area may be rectangular, the second a collection of vectors
>with four points defined as corresponding to the original rectangle's.
>[...]
>I realize that this problem is not completely defined - behavior in
>in extreme cases may be odd.  I am interested in any and all input.

It sounds ill-posed, but maybe this will help:  It is straightforward
to transform any triangle to any other triangle*.  In 2-d this can be
done by a 3x3 matrix tranformation.  By triangulating your regions in
some standard way you may be able to achieve something like you want.

--------
* For beginners, if you don't understand this, think of it as two
  concatenated transformations.  The first transform takes the firsti
  triangle to a lanonical triangle (say with vertices (0,0) (1,0) (0,1) ), 
  and then transform that to your your second triangle.

jbm@eos.UUCP (Jeffrey Mulligan) (04/12/88)

From article <844@agora.UUCP>, by rickc@agora.UUCP (Rick Coates):
> A new question:  I am interested in mapping one 2d area into another.
> The first area may be rectangular, the second a collection of vectors
> with four points defined as corresponding to the original rectangle's.
> 

This sounds like a projective transformation (determined by four points).

> This is a 'rubber sheet' analogy, where you draw a picture on a stretchable
> sheet, then deform it.
> 

A projective transformation might be better characterized as taking
the original picture, moving it around in 3-D, and then taking
a perspective view of it:

        x        x                     x
                                             x
                         --->
                                             x
        x        x                     x

Unlike arbitrary rubber sheet deformations, projective transformations
take straight lines into straight lines, while not preserving
metric relationships such as distance and angles.

> Any references?  The closest I have found is some references in older
> ray tracing papers on texture mapping, but the articles just discuss
> this as a concept, not how to do it.
> 

I read a 1910 textbook on projective geometry and then started hacking
(although I'm pretty sure there must be some references out there).

The general form of the projective tranformation is as follows

	x' = (ax+by+c)/(gx+hy+i)

	y' = (dx+ey+f)/(gx+hy+i)

You can set i=1 and solve for the 8 remaining parameters.  The way I
did this invovled setting up a system of 8 linear equations (two
from each of your four specified points) and solving by inverting
an 8 by 8 matrix.

The denominator in the above equations is like the z coordinate you
divide by in the perspective transformation.  Bad things happen when it
is zero.

> I have seen this done - at SIGGRAPH 85 a French company had some
> presentation graphics (? I think) running on a Tektronix 4115 that
> seemed to do this, but I didn't have a chance to play with it.
> 

I have seen an image representing some familiar image processing
pictures (mandrill, girl with feather) stuck onto the faces of
a perspective cube.  Someone on the net must know who did that.

> I realize that this problem is not completely defined - behavior in
> in extreme cases may be odd.  I am interested in any and all input.

I think it is well defined.

> 
> Some other comments: it isn't necessary to transform lines or other
> complex shapes, just points will do - long vectors can be broken into
> short enough ones. Holes might be interesting (what happens if your
> hole goes outside the outer boundary? Do you invert?).
> 

I'm not sure what you mean by holes, but a projective transformation
can take an ellipse into a pair of hyperbolae (two points at infinity).


-- 

	Jeff Mulligan (jbm@ames-aurora.arpa)
	NASA/Ames Research Ctr., Mail Stop 239-3, Moffet Field CA, 94035
	(415) 694-5150

jim@helios.cs.odu.edu (Jim Duncan) (04/12/88)

In article <522@eos.UUCP> jbm@eos.UUCP (Jeffrey Mulligan) writes:
>From article <844@agora.UUCP>, by rickc@agora.UUCP (Rick Coates):
>> A new question:  I am interested in mapping one 2d area into another.
>> The first area may be rectangular, the second a collection of vectors
>> with four points defined as corresponding to the original rectangle's.
>
>This sounds like a projective transformation (determined by four points).
>A projective transformation might be better characterized as taking
>the original picture, moving it around in 3-D, and then taking
>a perspective view of it: .....interesting discussion excised....
>
>> I have seen this done - at SIGGRAPH 85 a French company had some
>> presentation graphics (? I think) running on a Tektronix 4115 that
>> seemed to do this, but I didn't have a chance to play with it.
>
>I have seen an image representing some familiar image processing
>pictures (mandrill, girl with feather) stuck onto the faces of
>a perspective cube.  Someone on the net must know who did that.
>

I can't find the girl with the feather, but the mandrill can be found in the
inside back cover, Color Plates E-J, of Foley and Van Dam, Fundamentals of
Interactive Computer Graphics (the Bible :-).  The pictures are attributed to
Michael Potmesil, Image Processing Laboratory, Rensselaer Polytechnic
Institute.  There is also several views of the mandrill in a demo available
from Sun Microsystems, I believe as part of their NeWS windowing system.

 Jim Duncan, Computer Science Dept, Old Dominion Univ, Norfolk VA 23529-0162
       (804)440-3915     INET: jim@cs.odu.edu    UUCP: ...!sun!xanth!jim
	    "This could be good or bad."  Who said it?  Which RFC?

eugene@pioneer.arpa (Eugene N. Miya) (04/12/88)

Actually, this does have lots to do with cartography.
In addition to the obvious papers on TEXTURE MAPPING, you should also
look up the subject of GEOMETRIC RECTIFICATION in image processing.
Two books are Digital Image Processing by Ralph Bernstein published by
the IEEE and Ken Castleman's book of IP.

From the Rock of Ages Home for Retired Hackers:

--eugene miya, NASA Ames Research Center, eugene@ames-aurora.ARPA
  "You trust the `reply' command with all those different mailers out there?"
  "Send mail, avoid follow-ups.  If enough, I'll summarize."
  {uunet,hplabs,hao,ihnp4,decwrl,allegra,tektronix}!ames!aurora!eugene

elf@dgp.toronto.edu (Eugene Fiume) (04/16/88)

A few of us here considered this problem a while back and came up with
a way to texture map an arbitrary simple polygon (as well as circles and
half-planes).  The map is conformal and bijective (and continuous, of course).
See the paper entitled "Conformal Texture Mapping" by Fiume, Fournier, and
Canale, in Proc. of Eurographics '87, pp53-64.  I'll summarise the technique
if there is interest expressed in my doing so.
-- 
Eugene Fiume
Dynamic Graphics Project
University of Toronto
elf@dgp.utoronto (BITNET); elf@dgp.toronto.edu (CSNET/UUCP)