[metapost] MetaFont: Unexpected behavior of intersections times

luigi scarso luigi.scarso at gmail.com
Tue Apr 5 06:52:51 CEST 2011


On Tue, Apr 5, 2011 at 12:45 AM, Dan Luecking <luecking at uark.edu> wrote:
> At 11:48 PM 4/2/2011, you wrote:
>>
>> > p1:=(33.09007380767,-33.8895224139) .. controls
>> > (33.370612519531,-33.905534970703) and (33.65115125,-33.9215475) ..
>> > (33.93169,-33.93756);
>> >
>> > p2:=(38.1058,-34.00049) .. controls (36.39993,-34.00049) and
>> > (34.44913,-34.0004125) .. (32.79190125,-33.86743875);
>
> [...]
>>
>> Hm p1 isn't  a sub path of p2
>>
>> With a subpath
>> p3 := subpath(0.4,0.8) of p2;
>> message "p3 := subpath(0.4,0.8) of p2;";
>> numeric t,u;
>> (t,u) = p3 intersectiontimes p2;
>> show t,u
>>
>> gives
>>
>> t = 0.2179 , u =  0.48718 (but why t is not 0 or 1 ?)
>
> [See my previous message to the metapost list, in reply to Nicola.]
[I've seen]
>
> Metapost keeps subdividing the two paths, testing which
> pairs of quadrilaterals overlap until the moment it finds a
> pair that overlap to the precision of its algorithm.
>
> Then it stops.
>
> Since every subdivision of the subpath theoretically intersects
> the larger path, it is pretty much random which one will hit
> the precision limit first. Also, at finite precision it is even
> likely that some of these subdivided paths of p3 are judged
> _not_ to intersect with p2.
Yes, the fact is that until now I 've never seen this case, and I'm
curious to see the source
to find where it fails.



-- 
luigi



More information about the metapost mailing list