For example, around the lantern), or some other object, I think many of you have seen all kinds of insects fly around, lamps glowing in the night. In general, you need to somehow mathematically describe the flight path of these "fireflies", and add randomness, because just to fly in a circle is not very interesting) to take the firefly, he definitely wants to touch, and even burn the lamp, or burn completely without a trace, this is as lucky) that is, the vivacity of this algorithm is needed ) although, at first, I will not refuse from the usual flight in circles. Can anyone have links to the right literature or blog post, an idea ready for implementation, or just a hint? All will be glad)

  • 2
    the fireflies themselves shine, they don't really fly to the light. - zb '
  • four
    moths, yes. split the algorithm into several parts. moth - saw the light, flew to him (on the broken line - from the flapping of wings, moreover, a parabola - the force of gravity and all that); knocked on a light bulb, fell on a parabola too - bounced off; circled in a spiral, sat on a light bulb burned out; smoke, ash falling to the floor; a new moth flies out of the ashes, or even two. :) - Yura Ivanov
  • Honestly, I haven’t been watching for a long time, but according to my recollections, their melting is not very similar to Brownian movement. Can you try to understand the incentives that drive the fireflies? Those. essentially simulate their nervous system and external signals. Then it will be clear in what actions the forces must make random perturbations. - avp
  • Probably, this is not what you need, but still ... Fireflies - Helisia
  • Add: this project has open source, so you can easily modify it to your taste or download the finished modification from other users. - Helisia

1 answer 1

I read somewhere that the navigation system of fireflies is designed like this: they fly at a certain angle to the light source (ideally, to the Moon). In the case of an infinite distant object, this gives a certain straight line, and if the light source is close (lantern, bonfire), then the fireflies move in a spiral and finally burn and fall.

It seems to me quite an algorithm: you need to specify the navigation angle of the firefly + its flight speed. In the degenerate case, if the navigation angle is 90 degrees, the firefly will fly in a circle, if the angle is 0 degrees, it will fly straight to the light. You can easily add randomness: a little random change of the navigation angle depending on the flight speed or something like that.

  • 3
    @Barmaley, your version of the description of the algorithm is very good) in my head immediately came up with ideas on implementation (before that I even had no idea what and how), a picture emerges, how moths appear at different ends of the canvas, I reach for the lamp (not directly to it, and to an arbitrary point of the invisible ball, inside which the lamp is located, the ball will measure 2x, x3 from the lamp size), after approaching the "moth" will start spiraling (+ any disturbances) after which it will die (or mercy in the form of turning off the lamp ), thanks) I will begin to implement the technical Oops ) - Pifagorych
  • one
    You can add “temporary blindness” - approaching closer x to the lamp, the light can “go blind” and deviate in a random direction and fly for some time until the “vision” returns. - Sergiks
  • one
    And yet, the lamp is not the point. Its angular size with tz. firefly increases as it approaches, giving it extra. freedom in choosing a direction. Oh, necropost , just now noticed a year. - Sergiks

Protected by spirit community member ♦ Jun 8 '16 at 14:55 .

Thank you for your interest in this issue. Since he collected a large number of low-quality and spam responses, which had to be deleted, now it’s necessary to have 10 reputation points on the site (the bonus for account association is not counted ).

Maybe you want to answer one of the unanswered questions ?