Here's what I came up with, it seems to parallel Jimmy's approach,
though with some differences:

turtle=:3 :0
   coords=. y-<.-:(>./+<./),y
   max=. >./(,-),coords
   dist=. coords +/@:|@:-"1/ ,"0/~i:max+1
   min=. <./dist
   good=. 1=+/dist="2 min
   board=.good*1+dist i."_2&.|: min
   bad=. ~.0,(({.,{:)board),({.,{:)|:board
   >./ #/.~(,board)-.bad
)

I should probably give it a different name, but my first version was
named snail (because it was much slower, but ... very robust for the
small sets of coordinates which it could handle), and I wasn't sure
how fast this one would be (about a second for an example data6a, on
my current laptop).

It might be entertaining to work through issues where I was overly
conservative here (and proofs that those bits of code are never
needed).

FYI,

-- 
Raul

On Tue, Dec 11, 2018 at 1:08 PM Jimmy Gauvin <[email protected]> wrote:
>
> Hi,
>
> Raul is right, I seem to have to have left out the part about infinite
> areas and mangled other parts.
> Let me have a second try :
>
> NB. d6c : input coordinates
> d6c =: data6a
> NB. d6t : transpose coordinates to start at 1,1
> d6t =: d6c-"1 (<./d6c)-1
> NB. region size
> (<./,>./)d6t
>
> NB. edge points coordinates
> d6eg=:(1,.1+i.316),(315,.1+i.316),(1,.~2+i.313),314,.~2+i.313
> NB. d6ed : Distances between input points and edge points
> d6ed =: +/"1|d6t-"1"1 2 d6eg
> NB. d6em : points equal to minimum distance
> d6em =: (<./d6ed) =("1) d6ed
> NB. d6ex : points equal to minimum distance excluding equidistant points
> d6ex=:(1=+/d6em)#"1 d6em
> NB. d6if : input points with infinite area
> d6if =: I.  +./"1 (1=+/d6ex)#"1 d6ex
> NB. d6ni : input points with bounded area
> d6ni =: I. -.  +./"1 (1=+/d6ex)#"1 d6ex
>
> NB. coordinates of all points in region
> coor =: 1+(315 316)#:i.315*316
> NB. d6d : Distances between input points and all points in region
> d6d =: +/"1|d6t-"1"1 2 coor
> NB. d6dm : points equal to minimum distance
> d6dm =: (<./d6d) =("1) d6d
> NB. d6mx : points equal to minimum distance excluding equidistant points
> d6mx=:(1=+/d6dm)#"1 d6dm
> NB. d6a : size of areas for each input coordinate excluding equidistant
> points
> d6a =: +/"1 d6mx
> NB. size of bounded areas
> d6ni { d6a
>
>
> On Mon, Dec 10, 2018 at 11:20 PM Brian Schott <[email protected]>
> wrote:
>
> > Jimmy,
> >
> > I copied and pasted your solution into my jcon and get an empty value of
> > d6ni for some reason. My version of d6a looks very promising, and I can't
> > see how d6ni could be empty. Otoh, the expression for d6ni now looks
> > slightly different from the expression in your earlier email; it includes
> > an extra -. now. But leaving out the -. does not seem to work any better.
> >
> > I posted my data6a earlier in this thread and from you code it looks like
> > you used my data6a in your calculations, also.
> >
> > Can you or anyone see why my answer is empty?
> >
> > Thanks,
> >
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to