Getting direct neighbors of a irregular shaped agent

17 views
Skip to first unread message

Benjamin Mewes

unread,
Mar 2, 2017, 7:14:54 AM3/2/17
to GAMA
Dear all,

image I have several agents that are dissolved into small polygons and I want to create a "merged" agent with a union. I want to figure out how to create a list of those agents whose shapes are in the neighborhood of my merging agent.

Pseudocode:

reflex merge {

list
<Agents> Neighbours <- find neighbbours that are directly next to me

loop n over
: Neighbours {

geometry new_shape
<- (myself.shape + n.shape)

create
new agent {
shape
<- new_shape
}  

}


Any idea how to get this?

Patrick Taillandier

unread,
Mar 2, 2017, 8:04:30 AM3/2/17
to gama-p...@googlegroups.com

Hi,

You can try something like:
reflex merge
{
    list
<Agents> Neighbours <-
(Agents overlapping self) + self;
   
create Agents {
         shape
<- union(
Neighbours);  
    }
}

Cheers,

Patrick


--
You received this message because you are subscribed to the Google Groups "GAMA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gama-platform+unsubscribe@googlegroups.com.
To post to this group, send email to gama-p...@googlegroups.com.
Visit this group at https://groups.google.com/group/gama-platform.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages