Length of a path and Polyline trace

[color=#0000ff][i][color=#0000ff][i][color=#999999]This activity belongs to the GeoGebra book [url=https://www.geogebra.org/m/mes4bgft]The Domain of the Time[/url].[/color][/i][/color][/i][/color][br][br]OPTION 2: WITHOUT A PREDETERMINED PATH (the option we will choose)[br][right][color=#0000ff][i]Walker[i], your footprints are the path, and nothing else.[/i][br][i][color=#0000ff][i]Walker[/i][/color], there is no path; the path is made by walking.[/i][/i][br][br]Antonio Machado[/color][/right]Calculating the length that a moving object will follow along a trajectory is not always straightforward. If we know the path that the trajectory will take, we can create a polygonal line that fits very well to that path.[br][br]If we do not know that path or are unaware of its algebraic expression, we can use the trace of the moving object to create that polygonal line. First, we create an empty list (which we will call [b]reg[/b]) that will record the data. As the first element of the list, we assign the initial position of the moving object M:[br][center]SetValue(reg, {M})[/center]On this list, we create the polygonal line that connects those positions:[br][center]pol = Polyline(reg)[/center]Finally, we write the script associated with the moving object M, which will execute each time M updates its position.
[b]SCRIPT ON UPDATING M[/b][br][br][color=#cc0000]# Use the polyline as a trace by recording the position of M in the list reg[/color][br][color=#0000ff]SetValue(reg, Append(reg, M))[br][br][br][br][br][color=#999999][color=#999999][color=#0000ff][color=#0000ff][color=#999999][color=#999999]Author of the activity and GeoGebra construction: [/color][/color][/color][color=#0000ff][color=#999999][color=#999999][url=https://www.geogebra.org/u/rafael]Rafael Losada[/url].[/color][/color][/color][/color][/color][/color][/color]

Information: Length of a path and Polyline trace