Re: [NTG-context] How can I compare picture variables in metapost?

2009-05-06 Thread Peter Rolf
Aditya Mahajan schrieb: On Tue, 5 May 2009, Peter Rolf wrote: Taco Hoekwater schrieb: Taco Hoekwater wrote: Zhichu Chen wrote: 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

Re: [NTG-context] How can I compare picture variables in metapost?

2009-05-05 Thread Taco Hoekwater
Zhichu Chen wrote: Hi all, I want to draw some paths that won't intersect with each other in metapost. Those paths are generated randomly, e.g., draw 100 circles without any intersections. I use a very stupid way like: I am probably missing something, because the fastest way to draw 100

Re: [NTG-context] How can I compare picture variables in metapost?

2009-05-05 Thread Zhichu Chen
Hi Taco, On Tue, May 5, 2009 at 8:51 PM, Taco Hoekwater t...@elvenkind.com wrote: Zhichu Chen wrote: Hi all, I want to draw some paths that won't intersect with each other in metapost. Those paths are generated randomly, e.g., draw 100 circles without any intersections. I use a very stupid

Re: [NTG-context] How can I compare picture variables in metapost?

2009-05-05 Thread Taco Hoekwater
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).

Re: [NTG-context] How can I compare picture variables in metapost?

2009-05-05 Thread Zhichu Chen
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

Re: [NTG-context] How can I compare picture variables in metapost?

2009-05-05 Thread Taco Hoekwater
Zhichu Chen wrote: 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. For circles, probably lua calculations will be faster because the data

Re: [NTG-context] How can I compare picture variables in metapost?

2009-05-05 Thread Taco Hoekwater
Taco Hoekwater wrote: Zhichu Chen wrote: 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. For circles, probably lua calculations will be

Re: [NTG-context] How can I compare picture variables in metapost?

2009-05-05 Thread Peter Rolf
Taco Hoekwater schrieb: Taco Hoekwater wrote: Zhichu Chen wrote: 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. For circles, probably lua

Re: [NTG-context] How can I compare picture variables in metapost?

2009-05-05 Thread Aditya Mahajan
On Tue, 5 May 2009, Zhichu Chen wrote: 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

Re: [NTG-context] How can I compare picture variables in metapost?

2009-05-05 Thread Aditya Mahajan
On Tue, 5 May 2009, Peter Rolf wrote: Taco Hoekwater schrieb: Taco Hoekwater wrote: Zhichu Chen wrote: 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

Re: [NTG-context] How can I compare picture variables in metapost?

2009-05-05 Thread Zhichu Chen
Thank you all guys, To Aditya: Clearly I over-emphasized the randomness. Actually, what I meant is a little more complex: identical objects on random coordinates and they don't intersect with each other. We can rotate them but we can't re-size them and scale them. Your code is very interesting.

Re: [NTG-context] How can I compare picture variables in metapost?

2009-05-05 Thread Aditya Mahajan
On Wed, 6 May 2009, Zhichu Chen wrote: To Aditya: Clearly I over-emphasized the randomness. Actually, what I meant is a little more complex: identical objects on random coordinates and they don't intersect with each other. We can rotate them but we can't re-size them and scale them. The

Re: [NTG-context] How can I compare picture variables in metapost?

2009-05-05 Thread Aditya Mahajan
On Tue, 5 May 2009, Aditya Mahajan wrote: Both Taco's and my solutions can be adapted so that you do not randomize the radius. (Taco's solution will also work for arbitrary object that can then be rotated by a random amount). Here is another idea. Ask metapost to test for intersection, but