Re: [NTG-context] Metapost: directionpoint gives unexpected point(?)

2021-02-12 Thread Hans Hagen
Hi, Like this: metapost.registerscript("scrutenized", function() local p = mp.scan.path() local r = math.round local d = 10^mp.scan.numeric() for i=1,#p do local pi = p[i] pi[1] = r(pi[1] * d) / d pi[2] = r(pi[2] * d) / d end local x1 = r(p[1][1])

Re: [NTG-context] Metapost: directionpoint gives unexpected point(?)

2021-02-12 Thread Taco Hoekwater
> On 12 Feb 2021, at 10:31, Mikael Sundqvist wrote: > > Hi Taco, > > thanks, from your observation and the way I build the paths, I found > out that I can avoid the problem by shortening the paths I join just > slightly: > > cl := (fullcircle scaled 4u) shifted z0; > cl := cl cutbefore point

Re: [NTG-context] Metapost: directionpoint gives unexpected point(?)

2021-02-12 Thread Hans Hagen
On 2/12/2021 9:35 AM, Taco Hoekwater wrote: Hi, On 11 Feb 2021, at 17:41, Mikael Sundqvist wrote: Thanks for your investigation and extended example! So, if I understand it correctly, the problem occurs where the different circles are glued together with the .. construction. Took me a

Re: [NTG-context] Metapost: directionpoint gives unexpected point(?)

2021-02-12 Thread Mikael Sundqvist
Hi Taco, thanks, from your observation and the way I build the paths, I found out that I can avoid the problem by shortening the paths I join just slightly: cl := (fullcircle scaled 4u) shifted z0; cl := cl cutbefore point (1/6+epsilon) along cl cutafter point (2/6-epsilon) along cl; cs :=

Re: [NTG-context] Metapost: directionpoint gives unexpected point(?)

2021-02-12 Thread Taco Hoekwater
Hi, > On 11 Feb 2021, at 17:41, Mikael Sundqvist wrote: > > Thanks for your investigation and extended example! > > So, if I understand it correctly, the problem occurs where the > different circles are glued together with the .. construction. Took me a while to get it, but the problem is the

Re: [NTG-context] Metapost: directionpoint gives unexpected point(?)

2021-02-11 Thread Mikael Sundqvist
Thanks for your investigation and extended example! So, if I understand it correctly, the problem occurs where the different circles are glued together with the .. construction. I will wait to see if Alan or somebody else has an idea of a nice solution to the problem. /Mikael On Thu, Feb 11,

Re: [NTG-context] Metapost: directionpoint gives unexpected point(?)

2021-02-11 Thread Hans Hagen
On 2/11/2021 2:45 PM, Mikael Sundqvist wrote: Hi, since I already started this thread, I continue here. My metapost code is still not always working, and I do not understand what is going wrong. In the example below, I draw two curves of constant width (p1 and p2), one rotated 180 degrees

Re: [NTG-context] Metapost: directionpoint gives unexpected point(?)

2021-02-11 Thread Mikael Sundqvist
Hi, since I already started this thread, I continue here. My metapost code is still not always working, and I do not understand what is going wrong. In the example below, I draw two curves of constant width (p1 and p2), one rotated 180 degrees around the origin. Then I draw the curve (p3),

Re: [NTG-context] Metapost: directionpoint gives unexpected point(?)

2021-02-05 Thread Mikael Sundqvist
Hi, I was too quick to push send. This must be some rounding error. Changing the instance fixes the problem. Sorry for the noise. /Mikael On Fri, Feb 5, 2021 at 5:48 PM Mikael Sundqvist wrote: > > Hi, > > I get sometimes the wrong directionpoint. In the example below it > works for all values

[NTG-context] Metapost: directionpoint gives unexpected point(?)

2021-02-05 Thread Mikael Sundqvist
Hi, I get sometimes the wrong directionpoint. In the example below it works for all values of direx except between 0 and 90. If I put direx to something in this interval, it seems that the point between cs and cl are chosen. Is there a better way to construct the paths not to get this problem?