New number systems compute cyclic path strangely
Toby Thurston <[email protected]> Sun, 28 Apr 2024 16:21:12 +0100
| Newsgroups | gmane.comp.tex.metapost |
|---|---|
| Message-ID | <[email protected]> |
--===============0149670224592910701==
Content-Type: multipart/alternative;
boundary="Apple-Mail=_4C457C7A-0C48-45E3-ACD7-98572DFEC7E9"
--Apple-Mail=_4C457C7A-0C48-45E3-ACD7-98572DFEC7E9
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=us-ascii
This recent question on TexSE seems to have uncovered an anomaly in the =
way that MP computes the `arclength` of cyclic paths when using any of =
the new number systems. =20
https://tex.stackexchange.com/q/716630/15036
The poster supplied this example code
beginfig(1);
path p;
p =3D (0,0){up}..{right}(200,100)..{up}(300,400)..cycle;
len :=3D arclength p;
s :=3D arctime (2500) of p;
t :=3D arctime (len+2500) of p;
draw p;
show len;% 2799
show s;% 2.92...
show t;% 2.67...
show arctime arclength p of p;
show numbersystem;
endfig;
end
With the default number system the value of t is 5.92... as you might =
expect, but with any of the new number systems the value is 2.67.....
The original poster as TeX.SE was using MP 2.02 but I I see this =
behaviour with MetaPost, version 2.10 (TeX Live 2024).
Toby=
--Apple-Mail=_4C457C7A-0C48-45E3-ACD7-98572DFEC7E9
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
charset=us-ascii
<html><head><meta http-equiv=3D"content-type" content=3D"text/html; =
charset=3Dus-ascii"></head><body style=3D"overflow-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: after-white-space;">This recent =
question on TexSE seems to have uncovered an anomaly in the way that MP =
computes the `arclength` of cyclic paths when using any of the new =
number systems. <div><br></div><div><a =
href=3D"https://tex.stackexchange.com/q/716630/15036">https://tex.stackexc=
hange.com/q/716630/15036</a></div><div><br></div><div><br>The poster =
supplied this example code</div><div><br></div><div><div><font =
face=3D"Courier New">beginfig(1);</font></div><div><font face=3D"Courier =
New">path p;</font></div><div><font face=3D"Courier New">p =3D =
(0,0){up}..{right}(200,100)..{up}(300,400)..cycle;</font></div><div><font =
face=3D"Courier New">len :=3D arclength p;</font></div><div><font =
face=3D"Courier New">s :=3D arctime (2500) of p;</font></div><div><font =
face=3D"Courier New">t :=3D arctime (len+2500) of =
p;</font></div><div><font face=3D"Courier New">draw =
p;</font></div><div><font face=3D"Courier New">show len;% =
2799</font></div><div><font face=3D"Courier New">show s;% =
2.92...</font></div><div><font face=3D"Courier New">show t;% =
2.67...</font></div><div><font face=3D"Courier New">show arctime =
arclength p of p;</font></div><div><font face=3D"Courier New">show =
numbersystem;</font></div><div><font face=3D"Courier =
New"><br></font></div><div><font face=3D"Courier =
New">endfig;</font></div><div><font face=3D"Courier =
New">end</font></div></div><div><br></div><div><div>With the default =
number system the value of t is 5.92... as you might expect, but with =
any of the new number systems the value is =
2.67.....</div></div><div><br></div><div>The original poster as TeX.SE =
was using MP 2.02 but I I see this behaviour with <span =
style=3D"font-family: inherit; font-size: var(--_pr-code-fs); =
font-style: inherit; font-variant-caps: inherit; white-space: inherit; =
color: rgb(12, 13, 14); orphans: 2; widows: 2;"> MetaPost, version 2.10 =
(TeX Live 2024).</span></div><div><span style=3D"font-family: inherit; =
font-size: var(--_pr-code-fs); font-style: inherit; font-variant-caps: =
inherit; white-space: inherit; color: rgb(12, 13, 14); orphans: 2; =
widows: 2;"><br></span></div><div><span style=3D"font-family: inherit; =
font-size: var(--_pr-code-fs); font-style: inherit; font-variant-caps: =
inherit; white-space: inherit; color: rgb(12, 13, 14); orphans: 2; =
widows: 2;">Toby</span></div></body></html>=
--Apple-Mail=_4C457C7A-0C48-45E3-ACD7-98572DFEC7E9--
--===============0149670224592910701==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
--
http://tug.org/metapost/
--===============0149670224592910701==--