ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Keith McKay <mckaymeister@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Units of xpart and ypart of a pair in MetaFun
Date: Fri, 27 Nov 2020 09:42:02 +0000	[thread overview]
Message-ID: <CABX+t6DgQxNOZb5CZa6FYvOy3iWVQ3ELSSLwv3toN5URVDBO-g@mail.gmail.com> (raw)
In-Reply-To: <69AA93C4-F737-46F2-9B7E-215AE67BEA46@elvenkind.com>


[-- Attachment #1.1: Type: text/plain, Size: 2242 bytes --]

Thanks Taco!
I understand much better now. I think it's best to leave the units out
until the drawing stage as you suggest.
Thanks again
Keith McKay

On Fri, 27 Nov 2020, 08:30 Taco Hoekwater, <taco@elvenkind.com> wrote:

>
>
> > On 26 Nov 2020, at 16:09, Keith McKay <mckaymeister@gmail.com> wrote:
> >
> > Hi,
> >
> > I have been using xpart and ypart to extract these values from pairs of
> points in a path but I wasn't getting the correct result. I was expecting:
> >
> > pair (2cm, 11cm) to give xpart 2 and ypart 11
>
> As explained by various people, Metapost does not have dimensions. All
> lengths are implicit Postscript big points
> (72/inch). Variables like “cm” just add a multiplication factor to your
> expressions, at no point is a dimension stored inside Metapost.
>
> Your equation:
>
>   a0 = (2cm,11cm)
>
> first expands into
>
>   a0 = (2*28.34645,11*28.34645)
>
> because “cm” is a variable with a value (Its definition in plain.mp is
> "cm = 28.34645”)
>
> Then, the two expressions in the a0 equation are resolved before the
> assignment, so what you actually wrote at the statement level is
>
>   a0 = (56.6929, 311.8096);
>
> At no point is there a “cm”-sized dimension.
>
> ===
>
> Perhaps another option would be for you to do all your work without units,
> e.g.
>
>   a0 = (2,11) % assume scaling will happen later
>
> and then in the end do the drawing on a scaled path:
>
>   draw (pp scaled cm) …
>
> as that may be less confusing? If the precision is an issue, you could
> counter the loss of precision you could use implied millimeters instead of
> centimeters.
>
> Best wishes,
> Taco
>
>
>
>
>
>
> ___________________________________________________________________________________
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
>
> ___________________________________________________________________________________
>

[-- Attachment #1.2: Type: text/html, Size: 3397 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

      reply	other threads:[~2020-11-27  9:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-26 15:09 Keith McKay
2020-11-26 15:19 ` Fabrice L
2020-11-26 17:12   ` Keith McKay
2020-11-26 17:20     ` Fabrice L
2020-11-26 20:29       ` Keith McKay
2020-11-26 17:25     ` Hans Hagen
2020-11-26 19:56       ` Keith McKay
2020-11-26 15:22 ` Hans Hagen
2020-11-27  8:30 ` Taco Hoekwater
2020-11-27  9:42   ` Keith McKay [this message]

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=CABX+t6DgQxNOZb5CZa6FYvOy3iWVQ3ELSSLwv3toN5URVDBO-g@mail.gmail.com \
    --to=mckaymeister@gmail.com \
    --cc=ntg-context@ntg.nl \
    /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).