scheme - How transform-painter works in the picture language in SICP -
I'm having trouble understanding how Specifically why the logic frame by the new root Vector subtraction of slogan mapping is necessary I have thought that the mapping of the new corners, i.e I have done some calculations and I want to know where I am mixed. For example Let origin = (0, 0 ), Edge 1 = (4, 0), edge 2 = (0, 4) Thus the mapping formula will become Then after placing them in the mapping form, one after the other, we get the result new root = (0,0) + 0 * (4, 0) + 1 * (0,4) = (0,4) map-corner1 = (0,0) + 1 * (4,0) + 1 * (0,4) = (4,4) map-corner2 = (0,0) Now the Genesis = (0,4), new-corner1 = (4,0), new-corner2 = (0, -4) Please refer to the attached picture (sorry for my drawing skills :)). I have marked the vector marked as m corner 1 which you say that it will be sufficient as a new corner for the new frame on which the painter is going to work ( M corner1 is Convert the mapped conversion to <1 point but keep in mind that it is a vector that just "ends" at the right point You must also translate the original to get the right frame. See that the new original is at the new original point and the new corner you search for (red one) is actually the difference between the vector difference of the last two. (pic change-painter process works:
(define - painter painter original corner 1 corner 2) (lambda (frame) (let's (frame-conform-map frame) (Give ((new-origin (M original))) () The composer (make-frame New-Oral (sub-works (m-corner 1) new-root (sub-vector (m-corner 2) new-root)))))))
(m corner 1) and
(m corner 2) , forms of new edges of the transformed frame Can work in
flip-vert is taking,
(define - flip-bizarre painter) (conversion-painter painter (make-wacker 0.0.0); new Original (Make) -act 1.0 1.0); New end of edge 1 (Make-Vect 0.0 0.0));
flip-veer form a frame with the following dimensions as the argument,
(0,0) + x (4,0) ) In the case of
original ,
corner1
. . . Code> as argument for
(0,1) ,
(1,1) , and
corner 2 arguments The form has been passed as
and
(0,0) respectively.
change-painter takes the last two results and Reduces them from
new original for the construction of new frames, resulting in a frame with the following dimension.
Comments
Post a Comment