Identifying Agents by Position


I can find the position of an agent and store as an array, (using pos = cell->GetPosition()) but wondered if it is possible to identify an agent given a position? For example, if given a position as an array, how can I find the corresponding agent at that position?

Thanks :slight_smile:

Hi @whemsley,
just to be clear, do we speak of exact positions or near by? E.g. can we say seach_pos = agent_pos or rather min(distance(search_pos,agent_pos)) over all agents?

Hi @Tobias,

In order to try to create a bond between two neighbouring agents of different types, I had adapted the validation_criterion.h soma clustering demo code to be able to identify the position of cells that were within a spatial distance apart. I then wanted to make changes to the cells in those positions (i.e find the cells at the exact coordinates and then make behavioural changes).

After speaking with @robauer I think there is already a function to search the area around a cell that is used in the epidemiology demo (BioDynaMo: bdm::Environment Class Reference) so I will try and use this instead of going down the previous route.

Thank you for your quick response, apologies if the question was unclear.

Alright great, it sounds to me like this problem has been solved. Thatโ€™s good news. Two small remarks that may or may not be helpful. First of all the ForEachNeighbour sounds like the right choice, be aware though that if you influence the neighbors with this call, you might change their attributes more often than once because itโ€™s likely that they are the neighbor of multiple other cells. Second, while Iโ€™m not sure about the precise nature of your bonds, you may find the concept of the AgentPtr helpful to model a permanent relationship between two agents.

Good luck and keep us posted :slight_smile:

1 Like