3
votes

The picture language example in the SICP book discusses the notion of a frame:

A frame can be described by three vectors—an origin vector and two edge vectors. The origin vector specifies the offset of the frame’s origin from some absolute origin in the plane, and the edge vectors specify the offsets of the frame’s corners from its origin.

The book then goes on to say that if we have an image described in terms of points in the unit square, we can map a given point, (x, y), to a point within a new frame, f, using the following formula:

origin(f) + x * edge1(f) + y * edge2(f)

where + and * are defined as vector arithmetic operators:

(x1, y1) + (x2, y2) = (x1 + x2, y1 + y2) and

k * (x, y) = (kx, ky).

Using this formula, if I define a frame as

origin = (1, 1); edge1 = (3, 1); edge2 = (1, 3)

the point (1, 1) from the unit square maps to (5, 5); whereas it seems like it ought to be `(3, 3).

What am I not getting?

1

1 Answers

1
votes

First, let's review the definition of frame:

A frame can be described by three vectors -- an origin vector and two edge vectors. The origin vector specifies the offset of the frame's origin from some absolute origin in the plane, and the edge vectors specify the offsets of the frame's corners from its origin.

And the point of above definition is :

edge vectors are measured based on origin vector of the frame, not the absolute origin in the plane.

So, when you choose three vectors (1, 1); (3, 1); (1, 3), the coordinate of the frame is actually

origin = (1, 1);

edge1 = (3, 1) - (1, 1) = (2, 0)

edge2 = (1, 3) - (1, 1) = (0, 2)

Back to your question, if you define the frame as origin = (1, 1); edge1 = (3, 1); edge2 = (1, 3), then the absolute coordinates are (1, 1); (4, 2); (2, 4).

The point (1, 1) of a painter specified in the unit square maps to (5, 5), not (3, 3) for the frame isn't a rectangular, just a more general parallelogram.