On Tue, May 5, 2009 at 11:04 PM, Taco Hoekwater <t...@elvenkind.com> wrote:
> Zhichu Chen wrote:
>>
>> What I want exactly is how to determine if there's anything on
>> some region of the picture. I need this to test if the random
>> point I picked is useful.
>
> That is easy to answer: you can't (well, not unless you invest a *lot*
> of effort into creating a bitmap edge structure).
Well, quick and pain.
>
> However what you can do is ask metapost to calculate intersectionpoints
> with (the most likely ones of) the already existing objects. This may
> be the easiest solution (even though it will be so slow that for large
> numbers of items you may be forced to start a division tree).
>
> The core trick is that you randomly place a circle with random radius
> inside an x-y field, and you keep those paths/pictures in an array. For
> each newlyt generated circle, you look for an intersection with all the
> already existing ones (and the rectangle borders) and keep trying
> to re-place it until there are no more collisions.

Seems that I don't have too many choices. Maybe using lua to do the
math and throwing the result to metapost is faster? I think I can do
this, but I don't know how. The documents are a little limited.

>
> I can't come up with a solution that is both elegant and fast at the
> moment, sorry.
>
> 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  : https://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
>



-- 
Best Regards
Chen
----------------------------------------------------------------

          Zhi-chu Chen | Shanghai Synchrotron Radiation Facility
         No. 2019 | Jialuo Rd. | Jiading | Shanghai | P.R. China
             tel: 086 21 5955 3405 | zhichu.chen.googlepages.com
                                               | www.sinap.ac.cn
----------------------------------------------------------------
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to