ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Emil Hedevang Lohse <emil@imf.au.dk>
Subject: Re: Re[2]: MetaPost/Fun question
Date: 23 Mar 2003 00:35:28 +0100	[thread overview]
Message-ID: <vg065qbm0u7.fsf@localhost.localdomain> (raw)
In-Reply-To: <12815828760.20030322223256@iol.it>

Giuseppe Bilotta <gip.bilotta@iol.it> writes:

> Saturday, March 22, 2003 Hans Hagen wrote:
> 
> >>I would like to know if it is possible in MetaPost (in particular
> >>MetaFun) to get all the possible intersection points of the paths,
> 
> [snip]
> 
> >>Anything like this?
> 
> HH> not that i know, but assuming that those path have some distance, i can
> HH> imagine dividing a path in parts and determining the intersectionpoints iof
> HH> the pieces;
> 
> HH> delta := .25 ;
> 
> HH> for i=0 step delta upto length(p)-delta :
> HH>    if intersection_found(1,subpath(i,i+.1) of p) :
> HH>      store point
> HH>    fi ;
> HH> endfor ;
> 
> I'll see if I can make something of this ... (wow, looks like I'm
> gonna need to learn MetaPost too ...)

I implemented it by finding some intersectiontime and the recursively
finding the intersectionstimes of the two subpaths (each with some
neighbourhood of the first intersection point cut off). For the time
being I cannot find my code, but here it is in pseude code.

  let p and q be paths;
  let (s,t) be a pair of intersection times of p and q;
  recursively find the intersection times of the 
    subpath (0, s - small number) of p and q;
  store (s,t);
  recursively find the intersection times of the 
    subpath (s + small number, infinity) of p and q;
  feel happy;

When done this way, the intersection times will be sorted according to
the first path.
 

-- 
Emil Hedevang Lohse <http://home.imf.au.dk/emil/> 

Alle spørgsmål er lige dumme. 
Og spørgsmålet "Kan ænder flyve?" er ikke dumt.

  reply	other threads:[~2003-03-22 23:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-22 20:59 Giuseppe Bilotta
2003-03-22 21:23 ` Hans Hagen
2003-03-22 21:32   ` Re[2]: " Giuseppe Bilotta
2003-03-22 23:35     ` Emil Hedevang Lohse [this message]
2003-03-23 13:34       ` Re[4]: " Giuseppe Bilotta
2003-03-24 12:53         ` Guy Worthington
2003-03-24 13:49           ` Giuseppe Bilotta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=vg065qbm0u7.fsf@localhost.localdomain \
    --to=emil@imf.au.dk \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).