Hi, I checked my copy of my e-mail and this script was attached. Here it is
again. Maybe you don't get attachments. Also here is a copy of the script.
p=: 13 :'?(x,2)$y'
N=:26
P=:N p N
lat=: 13 :'(y,+:y)$''. '''
lat 5
dots=: 13 :'<"1 (0{"1 y),.2*1{"1 y'
dots 4 p 8
spots=: 13 :'((i.x){(65+i.26){a.)(dots x p y)}lat y'
5 spots 11
12 spots 4
N spots N
load 'viewmat'
NB. (number of points) voronoi (shape)
NB. Generates an array of indices of the nearest point
b=: 13 :'(i.y),."0 1 i.y'
p=: 13 :'?(y,2)$ y'
m=: 13 :'(i.<./)"1 +/"1 *:x-"1/~y'
NB. Palettes of colors used in the examples below
viewmat {"2 m b 2
viewmat {"2 m b 3
viewmat {"2 m b 4
viewmat {"2 m b 5
viewmat {"2 m b 6
viewmat {"2 m b 7
viewmat {"2 m b 8
viewmat {"2 m b 9
NB. Regions
viewmat (p 2) m b 2
viewmat (p 3) m b 3
viewmat (p 4) m b 4
viewmat (p 5) m b 5
viewmat (p 6) m b 6
viewmat (p 7) m b 7
viewmat (p 8) m b 8
viewmat Q=:(P=:p 9) m b 9
P
Q
Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Mike Day
Sent: Tuesday, July 03, 2012 8:38 AM
To: Programming forum
Subject: Re: [Jprogramming] Challenge 13 Plot Alot
Attachment, Linda?
Mike
On 03/07/2012 2:41 AM, Linda Alvord wrote:
> A new strategy for this challenge: As you make any progress on this
> challenge, please send it along right away. Working together we may
> make any solution become better and better.
>
>
>
> I've been trying to understand some code for Voronoi regions. The
> script is attached develops the code. What I really want to do is
> make a similar progression of plots in conventional X and Y
> coordinates with polygon regions separated by line segments. Dots in
> each regions should show the random points that determine the regions.
>
>
>
> When you try my code in jhs and gtk you will find the results very
> different in style. I think the 8 plots will probably be more
> similar in the two different environments.
>
>
>
> There are many examples of this problem available on the web, but
> what I'm interested in is getting a sequence of steps that will help a
> reader to understand how those results have been achieved.
>
>
>
> Feel free to ask questions along the way. I will be working on the
> same problem along with you.
>
>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm