Search code examples
schemeimagesicp

How frames are used in the picture language in SICP?


I can't seem to get my head around the implementation of frames in SICP.

The book states

We will use coordinates in the unit square (0< x,y< 1) to specify images

How are images expressed as coordinates? The only interpretation I can muster is that all images, being lines, can only be mapped to a frame whose boundary can not exceed that of a unit square. But I doubt that because the next line in the book, explaining a "frame coordinate map", says

The map transforms the unit square into the frame by mapping the vector v = (x,y) to the vector sum Origin(Frame) + x*Edge1(Frame) + y*Edge2(Frame)

The vector (0,0) being mapped to the origin of the frame and (1,1) to the vertex diagonally opposite the origin, only adds to my confusion. What are these vectors? The origin of the image or what?

I can't make sense of this and it's preventing me from moving further into the text as everything discussed after builds on this concept. I'd find it very helpful if I could get a detailed explanation of how any one who's read the book understood this idea.


Solution

  • As far as I remember, the frames are vector images defined with coordinates relative to the unit square, and from there they can be scaled, mapped and in general transformed into a coordinate system with a given origin and size. It's all in the book under the "frames" section.

    You can correctly assume that all images are contained in the unit square, that's how it is. However, this is not a limitation at all - there's an infinite number of coordinate points in the unit square, and any image you can dream of fits in there. Defining that the coordinates are in the range [0, 1] it's just a matter of convention; it'd be the same if they were in the range [1, 1000], you can map from one coordinate system to the other by moving the decimal point.