[Therion] Problem with aligning point symbols that have an orientation set - due to definition transformation order
Bruce Mutton
bruce at tomo.co.nz
Sat Jun 1 11:03:12 CEST 2019
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
https://therion.speleo.sk/wiki/metapost#symbol_sizing_and_positioning
Thanks to the two Martins for helping me along this path.
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!
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.
def p_airdraught_UIS (expr pos,theta,sc,al)=
U:=(.2u,u);
T:=identity aligned al rotated theta scaled 1 shifted pos;
Like almost all built-in Therion metapost symbols, the T: function first
aligns the symbol, then rotates it.
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.
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.
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.
So I wondered what would happen if I changed the order of the
transformation?
ie
def p_airdraught_UIS (expr pos,theta,sc,al)=
U:=(.2u,u);
T:=identity rotated theta aligned al scaled 1 shifted pos;
And the answer is, the alignments entered by the user are properly honoured!
With both methods, there is a problem aligning long narrow symbols that are
also rotated.
I think this can be compensated for by stretching out the smaller U:
component a little. Say, instead of
U:=(.2u,u);
Make it more like
U:=(.4u,u);
So the question. Is there an appetite for changing the order of
transformation for almost all of Therion's metapost point symbols?
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.
Unless anyone can come up with any more unpleasant side effects, I would
vote for change.
Bruce
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.speleo.sk/pipermail/therion/attachments/20190601/4b59f67d/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 43986 bytes
Desc: not available
URL: <http://mailman.speleo.sk/pipermail/therion/attachments/20190601/4b59f67d/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SymbolAirdraughtAlignedTHENRotated.png
Type: image/png
Size: 136682 bytes
Desc: not available
URL: <http://mailman.speleo.sk/pipermail/therion/attachments/20190601/4b59f67d/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SymbolAirdraughtRotatedTHENAligned.png
Type: image/png
Size: 131676 bytes
Desc: not available
URL: <http://mailman.speleo.sk/pipermail/therion/attachments/20190601/4b59f67d/attachment-0002.png>
More information about the Therion
mailing list