[color=#999999][color=#999999]This activity belongs to the [i]GeoGebra book[/i] [url=https://www.geogebra.org/m/dm9prd7h]Attractive projects.[/url][/color][/color][b][br][br]2D project[/b]: [i]create dynamic systems by playing with attraction and repulsion.[/i][br][br]Now the robot (red dot P) [b]knows the end position[/b] you want to reach (green dot O) but you must dodge a series of enemies (blue dots).[br][br]Once the points are placed, we call the unit vector from P to O the [b]attractor[/b].[br][br]As before, we create the unit vectors that go from each blue point to P and divide them by the square of the distance that separates them. These vectors will be the repulsions that will move P away when it is too close to them. Now we add all these vectors to obtain the [b]advance [/b]vector.[br][br]We create a slider [b]t[/b] that will serve to animate the point P (to which we have activated the trace), so that it varies quite frequently, for example, between 0 and 1 with step 0.01.[br][br]Finally, we create the constant [b]inc[/b] = 0.2, which will help us to establish the progress in each step.[br][br]Now we write the program of our robot. Each time the value of t is updated, the following script will be executed with a single instruction:[br][list][*]SetValue (P, P + inc advance)[br][/*][/list]We only have to animate the slider t.[br][br]Note: If we want to repeat the experiment again, it is enough to erase the trace (Ctrl-F) and reposition the points to our whim.
[color=#999999]Author of the construction of GeoGebra: [color=#999999][url=https://www.geogebra.org/u/rafael]Rafael Losada[/url][/color][/color]