ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Taco Hoekwater <taco@elvenkind.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Marco <netuse@lavabit.com>
Subject: Re: Metapost: union test of two paths
Date: Sun, 04 Jul 2010 08:47:21 +0200	[thread overview]
Message-ID: <4C302E79.3060708@elvenkind.com> (raw)
In-Reply-To: <20100704011127.277ee6ac@vorbis>

On 07/04/2010 01:11 AM, Marco wrote:
> Hi Taco!
>
>> That is hard. The main problem is the word 'arbitrary'.
> Sorry, I was too general. The paths are a outline of a relatively
> simple shape (so border cases should rarely occur) with area>0k, not
> selfintersecting.

That helps. First test whether the paths insersect, that is easy.
If they do insersect, they may still be touching each other only.
Still, perhaps that is good enough (depends on what you want to do).

But if they do not intersect, then you know for sure that either one
is inside the other, or they are totally disjunct. In the fully
overlapping case, the boundingboxes of the two paths will most
likely likewise overlap perfectly, and that could be good enough
for you.

Alternatively, if you are certain that both the paths are convex
hulls, then just testing for the boundingboxes could be good enough
in practice.

When the two paths P and Q touch at time A, you could test whether the
two  points that are time(A+epsilon) and time(A-epsilon) are both
inside() both paths.

But the hardest thing with doing all this in metapost is that you
cannot trust metaposts results in the mathematical sense: rounding
errors creep in easily in the internal routines, which is one the
problems I hope to solve with metapost 2.

Best wishes,
Taco
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


  reply	other threads:[~2010-07-04  6:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-02 17:01 Marco
2010-07-03  8:03 ` Taco Hoekwater
2010-07-03 10:19   ` Taco Hoekwater
2010-07-03 13:34     ` Taco Hoekwater
2010-07-03 14:54       ` Marco
2010-07-03 23:11       ` Marco
2010-07-04  6:47         ` Taco Hoekwater [this message]
2010-07-04  8:09           ` Marco
2010-07-04  8:21             ` Taco Hoekwater
2010-07-03 10:33   ` Alan BRASLAU
2010-07-03 13:36     ` Taco Hoekwater

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=4C302E79.3060708@elvenkind.com \
    --to=taco@elvenkind.com \
    --cc=netuse@lavabit.com \
    --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).