From martinsluka at mac.com Sat Apr 13 14:44:51 2024 From: martinsluka at mac.com (Martin Sluka) Date: Sat, 13 Apr 2024 14:44:51 +0200 Subject: [metapost] Bricks wall Message-ID: <202404132220.43DMKAtq023487@freefriends.org> Hi, May you send me a sample of Metapost macro which generate bricks wall? Thanks Martin From thurston at eml.cc Sun Apr 28 17:21:12 2024 From: thurston at eml.cc (Toby Thurston) Date: Sun, 28 Apr 2024 16:21:12 +0100 Subject: [metapost] New number systems compute cyclic path strangely Message-ID: <13623789-046E-4215-8192-1A0536068135@eml.cc> 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. https://tex.stackexchange.com/q/716630/15036 The poster supplied this example code beginfig(1); path p; p = (0,0){up}..{right}(200,100)..{up}(300,400)..cycle; len := arclength p; s := arctime (2500) of p; t := 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From j.hagen at xs4all.nl Sun Apr 28 19:16:19 2024 From: j.hagen at xs4all.nl (Hans Hagen) Date: Sun, 28 Apr 2024 19:16:19 +0200 Subject: [metapost] New number systems compute cyclic path strangely In-Reply-To: <13623789-046E-4215-8192-1A0536068135@eml.cc> References: <13623789-046E-4215-8192-1A0536068135@eml.cc> Message-ID: On 4/28/2024 5:21 PM, Toby Thurston wrote: > 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. > > https://tex.stackexchange.com/q/716630/15036 > > > > The poster supplied this example code > > beginfig(1); > path p; > p = (0,0){up}..{right}(200,100)..{up}(300,400)..cycle; > len := arclength p; > s := arctime (2500) of p; > t := 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..... fwiw: len (2800) + 2500 also exceeds 4096 which is scaled max so the fact that scaled works is kind of a miracle ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- From luigi.scarso at gmail.com Mon Apr 29 09:05:46 2024 From: luigi.scarso at gmail.com (luigi scarso) Date: Mon, 29 Apr 2024 09:05:46 +0200 Subject: [metapost] New number systems compute cyclic path strangely In-Reply-To: <13623789-046E-4215-8192-1A0536068135@eml.cc> References: <13623789-046E-4215-8192-1A0536068135@eml.cc> Message-ID: On Sun, 28 Apr 2024 at 17:21, Toby Thurston wrote: > 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. > > https://tex.stackexchange.com/q/716630/15036 > > > The poster supplied this example code > > beginfig(1); > path p; > p = (0,0){up}..{right}(200,100)..{up}(300,400)..cycle; > len := arclength p; > s := arctime (2500) of p; > t := 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 > -- > http://tug.org/metapost/ I will check asap. -- luigi -------------- next part -------------- An HTML attachment was scrubbed... URL: From luigi.scarso at gmail.com Mon Apr 29 20:11:38 2024 From: luigi.scarso at gmail.com (luigi scarso) Date: Mon, 29 Apr 2024 20:11:38 +0200 Subject: [metapost] New number systems compute cyclic path strangely In-Reply-To: <13623789-046E-4215-8192-1A0536068135@eml.cc> References: <13623789-046E-4215-8192-1A0536068135@eml.cc> Message-ID: On Sun, 28 Apr 2024 at 17:21, Toby Thurston wrote: > 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. > > https://tex.stackexchange.com/q/716630/15036 > > > The poster supplied this example code > > beginfig(1); > path p; > p = (0,0){up}..{right}(200,100)..{up}(300,400)..cycle; > len := arclength p; > s := arctime (2500) of p; > t := 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 > -- > http://tug.org/metapost/ Hm I fear that @; implicitly uses the fact that scaled is an integer type, i.e. set_number_from_div (n1, arc, d1); /* n1 = (arc / d1) */ and number_add (v1, epsilon_t); /* v1 = n1+1 */ look suspicious in double mode ( epsilon_t is not 1 but 2^-52, 1 is unity ) -- luigi -------------- next part -------------- An HTML attachment was scrubbed... URL: