Scripts and Vectors
This activity belongs to the GeoGebra book GeoGebra Principia.
.
FLEXIBILITY: Elastic Geometry
Normally, a point either is or isn't in a specific position. However, through scripts and vectors, we can introduce flexibility, granting points the ability to move freely while attempting to maintain a certain relationship with other points.Instead of fixing a specific position for each point, we will establish a relationship with the rest of the points.Our goal is to achieve an equilateral polygon with all its vertices free. How can we close the polyline while keeping its vertices free (like a carpenter's ruler)? Or, starting from a polygon: How can we construct a rhombus while keeping the fourth vertex free? The solution lies in using scripts. For instance, a free point Q will always remain 5 units away from the free point P if this script is executed upon updating the position of P: SetValue(Q, P + 5 UnitVector(Q−P)) and updating the position of Q executes the script: SetValue(P, Q + 5 UnitVector(P−Q)) This way, in a rhombus, we can maintain the distance between vertices A and B while both points remain free. We can also represent types of triangles (right-angled, isosceles, equilateral...) that retain their characteristics while any of their three vertices can be moved. This method also applies to preserving angles rather than distances. Simply modify the vector applied to the point, using the appropriate rotation to readjust the angle. As an example, we can observe an equiangular pentagon with all its vertices free. Here, a result is included (published in 2015) that serves as a beautiful example of the close relationship between geometry and algebra: "a polygon with n sides is equiangular if and only if e2i/n is a complex root of the polynomial of degree n–1 whose coefficients are the lengths of the consecutive sides of the polygon"

Author of the construction of GeoGebra: Rafael Losada.