Search code examples
multi-agentparticle-swarm

Draw circle from using points


I have a number of agents (for example 6 or 8) and I want to align them as a circle formation with boids algorithm. Global positions of agents are not known but each agent knows other agents positions relative to itself. Also agents can update positions. How can i align them as a circle? If you need additional information please leave a comment.


Solution

  • Each agent could proceed as follows:

    1) compute least squares fitting circle of the set of points comprising the current location of this agent and its 3 nearest neighbors (you need at least 4 points), using formulas in: http://www.had2know.com/academics/best-fit-circle-least-squares.html

    2) project current location of this agent onto the computed least squares fitting circle

    and so on and so forth...

    I have no formal proof that it converges. You may need to have some "damping" to avoid oscillations.