# Inverse Kinematics

Rogério shared this question 2 years ago

I wanted to improve it, especially when it appears "undefined" in the formulas.

How can I handle the behavior of execution when Geogebra returns "undefined"?

1

It's possible to make a determined construction (no scripts)

See in the attachment: minBone, maxBone, handRange, hand

1

Perfect!

Thank you very much!

1

For my own pleasure, but perhaps also for you of interest.

With script in hand and with RecordToSpreadSheet for hand (Right-Click on hand for see)

Not always perfect because delay in calculation and scripts.

When a bone has touched the hurdle, then you must release the mouse key and then move the hand again.

1

That's very nice! Every time I'm learning more with you! Thanks you!

I made a new version of the project, now letting the movements possible on both sides (points A and C):

I also created a script by updating the angle a2 to invert the angle as soon as it reaches 0. So you can flip the tips both left and right.

However I noticed two problems and wanted to know if you can help me:

1) Within the script, I change a flag to invert the angle position whenever it reaches 0. But since the script can run several times then during the movement of points A or C, I had to create a control for the inversion only occurs the first time the angle reaches 0. But for some reason I do not know, the script is randomly executing this change, as if the angle changes from zero to any value during the move, which does not actually occur.

2) When dragging point A, all other points follow correctly. But if you do this experiment, you will see that the segments' lines disappear eventually.

Can you tell what can be corrected?

1

The most important point: 0 must be a range, not a point (e.g. from 0.01 to 0). If this limit is exceeded in direction 0, then the direction is reversed. If this area is left, nothing happens.

Instead of an angular range, I solved this with a very small range at maxBone. If "hand" crosses the border, then "FlipFlop" and the dependent "dir" changes.

When " hand " moves within the narrow range, then OnUpdate for CisOutside is continuously fulfilled (this may be a bug). With CisOutside_{old} it is ensured that CisOutside only executes an OnUpdate when the border is exceeded.

New/changed objects:

CisOutside, CisOutside_{old}, FlipFlop, dir, flipArea

Script in CisOutside

---------------------------------------------------------

Point 2:

If the maxBone radius is reduced by 0.0005, the problem is solved

1

Improved: FlipFlop is not needed.

In the script OnUpdate in CisOutside, div is updated direct.

1

Again a perfect solution! And one more learning from you.

I am really impressed with the facilities that Geogebra provides us to create interactive prototypes.

And I really appreciate all the experience you and all the participants of this forum.

1

demasiado Ingles para mí; me pierdo en la traducción. solo un vistazo al primer ggb.

Files: foro.ggb
1

Gracias, su versión es similar a la primera entrada de Rami. Si usted descarga el último archivo adjunto que usted envió, usted verá que hay varios avances, como la posibilidad de mover los dos puntos externos, no sólo el primero, además de poder cambiar el ángulo automáticamente de izquierda a derecha cuando llega cerca de cero .