Closed agrignard closed 3 years ago
You are right, It is because at_distance take into account the geometries of the agent and not only their location. In addition, with ask ViralPeople where ((each.location.x-self.location.x)^2+(each.location.y-self.location.y)^2<largeDropletRange^2, you consider the current agent as well (at_distance never returns the agent using this operator).
What I don't get is that if I comment geometry shape<-circle(1); in ViralPeople then the distance should be between the centroid no?
We don't have an operator in GAMA that is computing the distance between location?
What's wrong with this formula?
ask ViralPeople where ((each.location.x-self.location.x)^2+(each.location.y-self.location.y)^2<largeDropletRange^2
What I don't get is that if I comment geometry shape<-circle(1); in ViralPeople then the distance should be between the centroid no? yes.
We don't have an operator in GAMA that is computing the distance between location? You can always compute the distance between the centroid of the agent: agent1.location distance_to agent2.location. the at_distance operator always use the geometries of the agents and it is not possible to directly use the centroid.
What's wrong with this formula? Nothing. You can just write : ask ViralPeople where ((each.location distance_to location)<largeDropletRange) and you will get the same result. However, you should remove from the list the ViralPeople agent applying this statement to avoid autocontamination :p .
When I comment geometry shape<-circle(1); the distance_to is still giving a wrong distance (0.82 where as it should give 2m)
won't fix for now
Right now it seems that the at_distance operator behave weirdly.
If we use
ask (ViralPeople at_distance largeDropletRange)
we don't have results with thisask ViralPeople where ((each.location.x-self.location.x)^2+(each.location.y-self.location.y)^2<largeDropletRange^2
Is it because the ViralPeople has a shape<-circle(1).