<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-NZ link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal>I have just spent some time to understand the positioning of point symbols, with regard to metapost definitions and the alignment offsets, and have written up my insights by adding to this wiki section <a href="https://therion.speleo.sk/wiki/metapost#symbol_sizing_and_positioning">https://therion.speleo.sk/wiki/metapost#symbol_sizing_and_positioning</a><o:p></o:p></p><p class=MsoNormal>Thanks to the two Martins for helping me along this path.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>In the process of achieving understanding, I unearthed a problem that has occasionally plagued me over the previous 10 years.  Before now I could never get the pattern or a hint of what the cause may be.  But now I have it!<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>An example with the air-draught symbol to demonstrate.  I have chosen it because it is long and skinny and also highlights a minor problem with ‘tight’ aligning of such symbols; with half width of 0.2u and half height of 1.0u.  The definition of the symbol includes matching alignment offsets of U: = 0.2u and 1.0u, and starts like this…<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>def p_airdraught_UIS (expr pos,theta,sc,al)=<o:p></o:p></p><p class=MsoNormal>  U:=(.2u,u);<o:p></o:p></p><p class=MsoNormal>  T:=identity <b><span style='background:yellow;mso-highlight:yellow'>aligned al</span> <span style='background:lime;mso-highlight:lime'>rotated theta</span></b> scaled 1 shifted pos;<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Like almost all built-in Therion metapost symbols, the T: function first aligns the symbol, then rotates it.<o:p></o:p></p><p class=MsoNormal>For orthogonal rotations at least, the alignments are very nicely matched to the insertion point, but not so much for non-orthogonal rotations. This is the relatively minor problem.<o:p></o:p></p><p class=MsoNormal>The bigger problem is that for -orientations much different to zero, then alignments are inappropriately rotated as well!  In the example SymbolAirdraughtAlignedTHENRotated.png attached, -align right manifests as -align left, and -align bottom-right manifests as -align top-left once the -orientation is much more than 45 degrees.  A situation that has resulted in uncomfortable drawing hacks on my part on more than one occasion.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>On both attached images the cross hair intersection is the insertion point of the symbol, and the layout used includes a rotation of 15 degrees, to highlight the differences between not specifying a symbol orientation, and specifying an -orientation of zero and 180 degrees.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>So I wondered what would happen if I changed the order of the transformation?<o:p></o:p></p><p class=MsoNormal>ie<o:p></o:p></p><p class=MsoNormal>def p_airdraught_UIS (expr pos,theta,sc,al)=<o:p></o:p></p><p class=MsoNormal>  U:=(.2u,u);<o:p></o:p></p><p class=MsoNormal>  T:=identity <b><span style='background:lime;mso-highlight:lime'>rotated theta</span></b> <b><span style='background:yellow;mso-highlight:yellow'>aligned al</span> </b>scaled 1 shifted pos;<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>And the answer is, the alignments entered by the user are properly honoured!<o:p></o:p></p><p class=MsoNormal>With both methods, there is a problem aligning long narrow symbols that are also rotated.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><img border=0 width=659 height=362 style='width:6.8645in;height:3.7708in' id="Picture_x0020_2" src="cid:image001.png@01D518B8.D83838F0"><o:p></o:p></p><p class=MsoNormal>I think this can be compensated for by stretching out the smaller U: component a little.  Say, instead of<o:p></o:p></p><p class=MsoNormal>  U:=(.2u,u);<o:p></o:p></p><p class=MsoNormal>Make it more like<o:p></o:p></p><p class=MsoNormal>  U:=(.4u,u);<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>So the question.  Is there an appetite for changing the order of transformation for almost all of Therion’s metapost point symbols?<o:p></o:p></p><p class=MsoNormal>It will affect a number of existing projects, but only materially where point symbols with an orientation greater than 45 degrees off 0 degrees (or 360) and a non-centred alignment are used.  These are probably limited to points entrance, air-draught, passage ends, gradients (maybe), water-flow, spring, sink, and possibly any point labels that have been aligned with these.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Unless anyone can come up with any more unpleasant side effects, I would vote for change.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Bruce<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>