How to create a table of values from an animation

Aarnout Brombacher shared this question 3 years ago
Answered

Greetings!

Could anybody help me how to create a table of values based on position of a point that is animating.

My sense is that I would like to do something along the lines of:

* Create a line segment AB that is 10 units

* Animate a point P (increasing once) from A to B

* For point P, in Scripting (On update), use a command of the form (below) for each distance from 1 to 10:

If(Distance(P,B)=5,<<insert instruction to record the value of a variable that is linked to P in the next line of a table>> )

Any suggestions?

Stay safe and healthy!

Best Answer
photo

See the annex for one of the possible solutions.

I used a fundamentally different approach:

The table and the graphic are completely independent regarding the values (exception: constants in l1 or T_{Area}. The animation is done with the point P_n in the graphic and in the table with the PosP_n derived from P_n.

The graphic follows (with P_n and P_1) a list (l1) of points (along the diagonal through the rectangles). These correspond to the root of normalized area (maxArea =1) on the Segment(A,B). The calculation of list l1 is the central approach of this solution.

The values in the graphic (not in the table) are calculated from the ratio of the two rectangles (q_1, q_n). The lengths in Sx, Cx and the area in Aq_n

Comments (7)

photo
1

open spreadsheet

right click in the point

trace to spreadsheet

photo
1

Dear Mathmagic,

Thank you -- a great feature that I did not know about. Much appreciated.

That said, I was hoping to do something a little more nuanced ... I want to create a mechanism where on certain triggers (created through a PathParameter type command), the current value of two numbers "a" and "b" are recorded in the next row of the table.

Any suggestions?

photo
1

Please post your .ggb file

photo
1

Dear Michael,

Please see my file attached. what I would like to achieve is to have the table appear one row at a time in time with the details below the animation.

While I am asking, any suggestions on how to center align both columns on the decimal and to make the second column a % column.

Thanks in anticipation

photo
photo
2

See the annex for one of the possible solutions.

I used a fundamentally different approach:

The table and the graphic are completely independent regarding the values (exception: constants in l1 or T_{Area}. The animation is done with the point P_n in the graphic and in the table with the PosP_n derived from P_n.

The graphic follows (with P_n and P_1) a list (l1) of points (along the diagonal through the rectangles). These correspond to the root of normalized area (maxArea =1) on the Segment(A,B). The calculation of list l1 is the central approach of this solution.

The values in the graphic (not in the table) are calculated from the ratio of the two rectangles (q_1, q_n). The lengths in Sx, Cx and the area in Aq_n

photo
1

Dear Rami,

Again, a splendid and beautiful solution! Thank you!

Thank you also for the simplicity of the solution ... it will take me some time to come to terms with it all, but I will!

Thank you for the generosity that the response represents!

photo
1

Thanks for feedback.

I forgot to mention:

Script onUpdate in Aq_n and Cx (for calculated captions)

photo
© 2023 International GeoGebra Institute