Google Classroom
GeoGebraGeoGebra Classroom

2. Constrain Movement by Scripting

The horizontal red segment is defined by the hidden free points G and H. To constrain it to move vertically between D and E, the following GeoGebra scripts are applied on Scripting | On Update tab of the following points. Point G SetValue(G, If(y(G)y(E), E, (x(E), y(G))))) Point H SetValue(H, If(y(H)y(E), (x(C), y(E)), (x(C), y(H))))) Similarly, to constrain the movement of the vertical red segment defined by the hidden free points I and J, the following scripts are applied. Point I SetValue(I, If(x(I)x(C), (x(C), y(E)), (x(I), y(E))))) Point J SetValue(J, If(x(J)x(C), C, (x(J), y(D)))))