From: Peter Rolf <indiego@gmx.net>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Paul Menzel <paulepanter@users.sourceforge.net>
Subject: Re: MetaPost: Confusion with `function()` and `xyscaled`
Date: Sun, 23 Oct 2011 17:17:01 +0200 [thread overview]
Message-ID: <4EA42FED.7040700@gmx.net> (raw)
In-Reply-To: <1319379123.4815.24.camel@mattotaupa>
Am 23.10.2011 16:12, schrieb Paul Menzel:
> Am Freitag, den 21.10.2011, 18:08 +0200 schrieb Peter Rolf:
>> Am 21.10.2011 17:26, schrieb Paul Menzel:
>
>>> Am Freitag, den 21.10.2011, 17:02 +0200 schrieb Peter Rolf:
>>>
>>>> I agree, this is confusing on the first sight. But scaling is not meant
>>>> as 'scaling to' a dimension. In fact is is just a simple multiplication.
>>>> The reason why it seems to work this way with
>>>> 'fullsquare' and such predefined paths is, that they have a 'neutral'
>>>> size/scale (bounding box size of filled path is (1pt,1pt)).
>>>
>>> So how can I find out what the dimension of the path of a function is?
>>> Not scaling it, it also looked pretty small, so I am guessing (1pt,1pt).
>>
>> I guess in this case its size is (10,log(10)) + pen size when drawn.
>
> That was it kind of. Probably the most of my confusion resulting from
> the use of the inverse function.
>
> So all in all the width is 1 – the x-coordinates seem to be scaled to
> the width of 1 – and the height is 10, as ten is the highest value.
> Therefore the width has to be multiplied with 10cm to get it to 10cm and
> since the height it 10 already multiplying it with 2cm gets it to 20cm.
>
I see. I must admit that I haven't looked deeper into function (never
used it).
If I want to test the bounding box of a graphic, I normally use a small
debugging macro (last code line of nearly all of my graphics). It simply
draws a small red frame at the bounding box borders. You can use the
'Measuring Tool' in Acrobat (also Reader?) or even better the 'Object
Inspector' to get the exact size.
minlinewidth:= .143pt;
def wirepen= pencircle scaled minlinewidth enddef ;
def drawbb =
drawoptions() ;
interim linejoin:= mitered;
draw (llcorner currentpicture) shifted ( .5minlinewidth,
.5minlinewidth)
-- (lrcorner currentpicture) shifted (-.5minlinewidth,
.5minlinewidth)
-- (urcorner currentpicture) shifted
(-.5minlinewidth,-.5minlinewidth)
-- (ulcorner currentpicture) shifted (
.5minlinewidth,-.5minlinewidth)
-- cycle
withpen wirepen withcolor red;
% draw boundingbox currentpicture withpen wirepen withcolor red ; % was
not neutral!
enddef ;
>>>> Multiplying such a path with (x,y) gives an object with size (1*x,1*y).
>>>> In general: if the bounding box of an object has the size (a,b) and you
>>>> scale it with (x,y), the resulting object has a size of (ax,by). That's
>>>> all the magic.
>>>
>>> but if you use numbers with a unit than it should not be multiplied but
>>> expanded to that value, should not it? Otherwise I am unsure how
>>> multiplication works with a unit.
>>
>> 1pt is the base unit in MP (used if no dimension is given; probably
>> stored as 65536sp (scaled point) units).
>
> In the manual I only found bp for »big point«, which equal PostScript
> points equaling 1/72 of an inch.
It can't be helped, I always mix this up. :-D
It's 'bp' for MP and for Adobe products, and 'pt' for TeX. Ask me in a
few weeks and I can't give the correct answer.
>
>> Now if you use pure numerics for scale, such as 'xscaled 2', this is
>> interpreted as '2pt' (or 2*65536sp). If you use any dimension, it is
>> also converted into scaled points. All the same for MP.
>>
>> If I'm right this should all be the same (untested)
>>
>> xscaled 2
>> xscaled 2pt
>
> This gives the same result.
>
>> xscaled (2*65536sp)
>
> I could not test the above because the numbers got too big and MetaPost
> complained.
>
My fault. In the meantime I have checked it and 'sp' is not a predefined
constant in MP (couldn't find it in the manual). Also never used it in MP.
>> 1 = 1pt = 65536sp
>
> […]
>
>
> Thanks,
>
> Paul
>
>
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive : http://foundry.supelec.fr/projects/contextrev/
> wiki : http://contextgarden.net
> ___________________________________________________________________________________
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
next prev parent reply other threads:[~2011-10-23 15:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-20 23:14 MetaFun: " Paul Menzel
2011-10-21 11:38 ` Paul Menzel
2011-10-21 15:02 ` Peter Rolf
2011-10-21 15:26 ` MetaPost: " Paul Menzel
2011-10-21 16:08 ` Peter Rolf
2011-10-23 14:12 ` Paul Menzel
2011-10-23 15:17 ` Peter Rolf [this message]
2011-10-23 21:39 ` Hans Hagen
2011-10-21 20:53 ` MetaFun: " Aditya Mahajan
2011-10-22 7:24 ` Hans Hagen
2011-10-23 13:17 ` MetaFun manual: Incorrect label of ordinate axis on page 382, section 9.3 drawing functions (was: Confusion with `function()` and `xyscaled`) Paul Menzel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4EA42FED.7040700@gmx.net \
--to=indiego@gmx.net \
--cc=ntg-context@ntg.nl \
--cc=paulepanter@users.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).