From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/109704 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Keith McKay Newsgroups: gmane.comp.tex.context Subject: Re: Units of xpart and ypart of a pair in MetaFun Date: Fri, 27 Nov 2020 09:42:02 +0000 Message-ID: References: <68dba0aa-8cc8-0a93-29bf-81afc7bf9079@gmail.com> <69AA93C4-F737-46F2-9B7E-215AE67BEA46@elvenkind.com> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5368510023081052856==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24005"; mail-complaints-to="usenet@ciao.gmane.io" To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Fri Nov 27 10:42:48 2020 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane-mx.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kiaH9-00068l-SI for gctc-ntg-context-518@m.gmane-mx.org; Fri, 27 Nov 2020 10:42:47 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 3A2BB1AA761; Fri, 27 Nov 2020 10:42:21 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mHAjmbQkRxFE; Fri, 27 Nov 2020 10:42:19 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 4E0581AA2BF; Fri, 27 Nov 2020 10:42:19 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id BECD61AA75D for ; Fri, 27 Nov 2020 10:42:18 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qDlEjFSkqjRJ for ; Fri, 27 Nov 2020 10:42:17 +0100 (CET) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.166.47; helo=mail-io1-f47.google.com; envelope-from=mckaymeister@gmail.com; receiver= Original-Received: from mail-io1-f47.google.com (mail-io1-f47.google.com [209.85.166.47]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 5F6AE1AA754 for ; Fri, 27 Nov 2020 10:42:17 +0100 (CET) Original-Received: by mail-io1-f47.google.com with SMTP id z5so4198967iob.11 for ; Fri, 27 Nov 2020 01:42:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=YPpnOjYtML0VcnmAtIeQrmD3P/fib90RRwD+S0uvpic=; b=oJ/LwBDSeurtKgT+q2bOg7krwgsnnxK6widQi5NKd1jeBzE4WHrtCqOOV2TX6tY8tZ AhzBvk6hmdSWPxqUC1ehUtryNhSYACOgOl7m9yW+BDPyUBFBqra9x2K+8tvluU6OEA9D JljrJTBTAvIyEvDY3IP2D1uhTEEAVYiSuZAFRWrM8izQF8c5IXx0+HIapxJoopvCmq6F u892wQJQ48fraX2tFzyms6K8si+NA7VOjEDksW270FBkXO5bWpH08Yt7qNVjIiOhyydy lf+3Hwc8LEWyWniN2TWXGLpIKjngiarK2Wndy2uNny78lMggFh/i9S2lQxj4bMRgcZW+ 6O5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=YPpnOjYtML0VcnmAtIeQrmD3P/fib90RRwD+S0uvpic=; b=bOJhQ6POpHTxYxbCtpDzSKNItLL5IQTKmaHkmapmdadqUKnBGmsoGk52+eLvnl9UdR hSk6O6l6uvIm2Q9UM7e8rSIxQWp5wqZsPv2u5XUIwnRa8yEEvln0kZvMp7CDbn5T6gr4 qaG7QecycP5K+CCW8z8hnvfoIsiZf0yisrGxm8f8jxG8+qcmeQoyEzFapykcUWea1a2m ymAtZSKPP4R7JkL0H63XzAPzdEAEg4iY/mYvGdDSXXVLuxijiIwl1n3TdTUPGf6d1ZFI Qo4esHZBhkeZADGNUZ8GQ/f3FtXA/72mIq33/YelxmZcZmLbesaBTNQuEUe4JHae6+U5 DmbQ== X-Gm-Message-State: AOAM530ETot1EgVJF96PaTSqEMpgFoqvfj5Kx6/K3/iAjbchvWMRqneO MeFtpsh83GdT129pQ/HRCnLHvEs1HCmB2D6Ksoec1DHXm1M= X-Google-Smtp-Source: ABdhPJyDwBYZh0ZFY48nLNaStEGj1uia+SzXznEU4T0D0C4nlKz+xpsbyAbLAwO2BN/58dRF3yz/9EWISnvcyrRTo2Q= X-Received: by 2002:a02:b919:: with SMTP id v25mr5073018jan.100.1606470135575; Fri, 27 Nov 2020 01:42:15 -0800 (PST) In-Reply-To: <69AA93C4-F737-46F2-9B7E-215AE67BEA46@elvenkind.com> X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.io gmane.comp.tex.context:109704 Archived-At: --===============5368510023081052856== Content-Type: multipart/alternative; boundary="000000000000c5fa7305b513793b" --000000000000c5fa7305b513793b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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, wrote: > > > > On 26 Nov 2020, at 16:09, Keith McKay 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 =E2=80=9Ccm=E2=80=9D just add a multiplication = factor to your > expressions, at no point is a dimension stored inside Metapost. > > Your equation: > > a0 =3D (2cm,11cm) > > first expands into > > a0 =3D (2*28.34645,11*28.34645) > > because =E2=80=9Ccm=E2=80=9D is a variable with a value (Its definition i= n plain.mp is > "cm =3D 28.34645=E2=80=9D) > > Then, the two expressions in the a0 equation are resolved before the > assignment, so what you actually wrote at the statement level is > > a0 =3D (56.6929, 311.8096); > > At no point is there a =E2=80=9Ccm=E2=80=9D-sized dimension. > > =3D=3D=3D > > Perhaps another option would be for you to do all your work without units= , > e.g. > > a0 =3D (2,11) % assume scaling will happen later > > and then in the end do the drawing on a scaled path: > > draw (pp scaled cm) =E2=80=A6 > > 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 o= f > 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 > > _________________________________________________________________________= __________ > --000000000000c5fa7305b513793b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks Taco!
I understand much better no= w. I think it's best to leave the units out until the drawing stage as = you suggest.
Thanks again
Kei= th 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 o= f points in a path but I wasn't getting the correct result. I was expec= ting:
>
> pair (2cm, 11cm) to give xpart 2 and ypart 11

As explained by various people, Metapost does not have dimensions. All leng= ths are implicit Postscript big points
(72/inch). Variables like =E2=80=9Ccm=E2=80=9D just add a multiplication fa= ctor to your expressions, at no point is a dimension stored inside Metapost= .

Your equation:

=C2=A0 a0 =3D (2cm,11cm)

first expands into

=C2=A0 a0 =3D (2*28.34645,11*28.34645)

because =E2=80=9Ccm=E2=80=9D is a variable with a value (Its definition in =
plain.mp is "cm =3D 28.34645=E2=80=9D)

Then, the two expressions in the a0 equation are resolved before the assign= ment, so what you actually wrote at the statement level is

=C2=A0 a0 =3D (56.6929, 311.8096);

At no point is there a =E2=80=9Ccm=E2=80=9D-sized dimension.

=3D=3D=3D

Perhaps another option would be for you to do all your work without units, = e.g.

=C2=A0 a0 =3D (2,11) % assume scaling will happen later

and then in the end do the drawing on a scaled path:

=C2=A0 draw (pp scaled cm) =E2=80=A6

as that may be less confusing? If the precision is an issue, you could coun= ter the loss of precision you could use implied millimeters instead of cent= imeters.

Best wishes,
Taco





___________________________________________________________________________= ________
If your question is of interest to others as well, please add an entry to t= he Wiki!

maillist : ntg-context@ntg.nl / http://= www.ntg.nl/mailman/listinfo/ntg-context
webpage=C2=A0 : http://www.pragma-ade.nl / http://= context.aanhet.net
archive=C2=A0 : https://bitbucket.org/ph= g/context-mirror/commits/
wiki=C2=A0 =C2=A0 =C2=A0: http://contextgarden.net
___________________________________________________________________________= ________
--000000000000c5fa7305b513793b-- --===============5368510023081052856== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============5368510023081052856==--