Affine Transform was [RE: Graphics Guru Challenge]

Jim Benson jb at speed.net
Fri Oct 19 16:11:16 UTC 2001


I seem to remember several months ago [June 7] that affine transforms for
use with WarpBlt were being discussed. The basic problem is to take a
rectangle from one form and map it onto an arbitrary quadrangle. I wanted to
use it for some perspective tricks.

Dan Ingalls wrote:

[
First, the transformation from a quadrangle to a rectangle is an affine
transformation.  Once you know this, you can compute the affine
transformation you desire, apply its inverse to the destination rectangle
that WarpBlt requires, and you will then have the quadrilateral that you
need to use on the source.
]

Searching through his disk, he found some code that Ted Kaehler wrote
several years ago [which I've attached so you don't have to hunt it down].
The attached code uses a method called #asQuad, which I assume maps to the
modern day #corners [this could very well be the source of my problem].

Being lazy, I filed in the code, and started fiddling with it.

I thought this was a typical type of example that I would like to do:

form := Form fromDisplay: ( 0 at 0 corner: 300 at 300 ).

 warp := (WarpBlt current toForm: Display)
   sourceForm: form ;
   cellSize: 2;  "installs a new colormap if cellSize > 1"
   combinationRule: Form over.
 warp copyRect: ( 0 at 0 corner: 300 at 300 ) toQuad: { 128 at 455. 128 at 655. 280 at 620.
280 at 443  }.


However, when I tried this I received divide by zero errors. I'm not sure
about the cellSize: statement, but it seemed important at the time.

Rather than start digging through this, I wanted to check to see if anyone
had any working code along this direction. The thread on the list seemed to
die right before the good bit of a working example.

Thanks,

Jim

-------------- next part --------------
A non-text attachment was scrubbed...
Name: AffineStuff-tk.cs.gz
Type: application/octet-stream
Size: 1241 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20011019/7b834915/AffineStuff-tk.cs.obj


More information about the Squeak-dev mailing list