[metapost] glyph operator and contours order

luigi scarso luigi.scarso at gmail.com
Sun Feb 6 12:26:55 CET 2011


On Sun, Feb 6, 2011 at 9:22 AM, Taco Hoekwater <taco at elvenkind.com> wrote:

> On 02/05/2011 04:02 PM, Laurent Méhats wrote:
>
>>
>> I believe that glyph contours don't intersect each-other, nor
>> self-intersect (is that always true ?),
>>
>
> That should be true, otherwise it is not a proper Type 1 font.
> But that is not quite the same as 'always': fonts that break this
> rule can exist and even though they are not valid, they would
> probably still work in everything except drawing programs.
> It should be extremely rare, though.
>
>
>  so my question would be: given two
>> non intersecting nor self-intersecting cycles, is there a proper way to
>> decide whether one lies inside the other ?
>>
>
> An idea:

Let c1 is a set of bezier curves that make a cycle, so it can be
parametrized with t in [0,N];
let c2 another cycle.
Let c1 & c2 not intersecting , c1 not self intersecting, c2 not self
intersecting

for tn = 1 to N:
 r(tn) = straight line from c1(t=0) to c1(t=tn);
  if r(tn) intersect c2 then c2_is_inside_c1=true; break

if not(c2_is_inside_c1) then
 for tn = 1 to N:
  r(tn) = straight line from c2(t=0) to c2(t=tn);
    if r(tn) intersect c2 then c1_is_inside_c2=true; break



-- 
luigi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/metapost/attachments/20110206/e6e3c13e/attachment.html>


More information about the metapost mailing list