# Why doesn't the transformation work with label inside a picture?

Transforms can be applied to pairs, guides, paths, pens, strings, transforms, frames, and pictures by multiplication (via the binary operator *) on the left.

However,

``````unitsize(1cm);
picture pic1;
// unitsize(pic1,1cm);
path p1=(1,1.5)--(1.5,.5)--(2,1.5)--(2.5,.5)--(3,1.5)--(3.5,.5)--(4,1.5)--(4.5,.5)--(5,1.5);
label(pic1,Label("Hello World! I am"),(0,2));
draw(pic1, p1, 2bp+red);
fill(pic1,box((2.5,.1),(3.5,1.9)),green);
fill(pic1,shift(2.25,.3)*unitsquare,yellow);

shipout(bbox(1mm,invisible));
``````

doesn't work.

Question: Why?

If I understand the documentation `Label` has an option `embed` :

• Shift : only shift with embedding picture;
• Rotate : only shift and rotate with embedding picture (default);
• Rotate(pair z) : rotate with (picture-transformed) vector z.
• Slant : only shift, rotate, slant, and reflect with embedding picture;
• Scale : shift, rotate, slant, reflect, and scale with embedding picture.

So that in the following example, with `Shift` the Label is not rotated:

``````unitsize(1cm);
picture pic1;
size(pic1,10cm);
path p1=(1,1.5)--(1.5,.5)--(2,1.5)--(2.5,.5)--(3,1.5)--(3.5,.5)--(4,1.5)--(4.5,.5)--(5,1.5);
label(pic1,Label("Hello World! I am",embed=Shift),(0,2));
draw(pic1, p1, 2bp+red);
fill(pic1,box((2.5,.1),(3.5,1.9)),green);
fill(pic1,shift(2.25,.3)*unitsquare,yellow);

shipout(bbox(1mm,invisible));
``````

With `Rotate` (the default value) the Label is rotated.

``````
unitsize(1cm);
picture pic1;
size(pic1,10cm);
path p1=(1,1.5)--(1.5,.5)--(2,1.5)--(2.5,.5)--(3,1.5)--(3.5,.5)--(4,1.5)--(4.5,.5)--(5,1.5);
label(pic1,Label("Hello World! I am",embed=Rotate),(0,2));
draw(pic1, p1, 2bp+red);
fill(pic1,box((2.5,.1),(3.5,1.9)),green);
fill(pic1,shift(2.25,.3)*unitsquare,yellow);

shipout(bbox(1mm,invisible));
``````

So in the example of Chishimotoji the result is correct, since `reflect` is not considered by the default behavior `Rotate`. Adding `embed=Slant` should work but it is not the case.

``````unitsize(1cm);
picture pic1;
size(pic1,10cm);
path p1=(1,1.5)--(1.5,.5)--(2,1.5)--(2.5,.5)--(3,1.5)--(3.5,.5)--(4,1.5)--(4.5,.5)--(5,1.5);
label(pic1,Label("Hello World! I am",embed=Slant),(0,2));
draw(pic1, p1, 2bp+red);
fill(pic1,box((2.5,.1),(3.5,1.9)),green);
fill(pic1,shift(2.25,.3)*unitsquare,yellow);

shipout(bbox(1mm,invisible));
``````

produces

Another reflections give strange result while `reflect((0,0),(5,5))` is ok:

``````unitsize(1cm);
picture pic1;
size(pic1,10cm);
path p1=(1,1.5)--(1.5,.5)--(2,1.5)--(2.5,.5)--(3,1.5)--(3.5,.5)--(4,1.5)--(4.5,.5)--(5,1.5);
label(pic1,Label("Hello World! I am",embed=Slant),(0,2));
draw(pic1, p1, 2bp+red);
fill(pic1,box((2.5,.1),(3.5,1.9)),green);
fill(pic1,shift(2.25,.3)*unitsquare,yellow);

shipout(bbox(1mm,invisible));
``````

I do not understand why it does not work.

By using `frame` instead of `picture` it is ok.