Can Point[ <Object>, <Parameter> ] be released?

zoltan shared this question 2 years ago
Answered

I would like to implement linkages in GeoGebra by disallowing positions of the constrained mover point which make no sense. My attempt is at https://www.geogebra.org/m/ZrwBFhYr. Here I restricted D to be freely draggable first, but when E is undefined, then D will be put to the last useful point. This is done by creating ppD=PathParameter[D] and for the on-update script of D the following JavaScript is started:


  1. if (ggbApplet.getValue("x(E)")) {
  2. var ppD = ggbApplet.getValue("ppD");
  3. ggbApplet.evalCommand("ppDok="+ppD);
  4. } else {
  5. var ppDok = ggbApplet.getValue("ppDok");
  6. ggbApplet.evalCommand("D=Point[d,"+ppDok+"]");
  7. }

This fixes D when it is dragged to a disallowed position. Its position is OK now, but I want it to be draggable again. Is this possible somehow? Thanks for any hints in advance.

Comments (9)

photo
2

hello

I am not English and sometimes I do not understand some words

I suppose you want the attached

I have created some orange objects. see DM and O overall (DM instead D, O instead one intersection) I use two intersect points of circle ever

saludos

Files: foro.ggb
photo
1

That's very clever. Not a solution in general, but for this particular example it's perfect. Thank you!

photo
1

  1. Not a solution in general, but for this particular example it's perfect.

I think more general than others

https://www.geogebra.org/m/Drbxq9Y5

photo
1

Unfortunately I found a bug in GeoGebra in positioning a point to a union of two overlapping paths. In the attached example ppDM (the PathParameter for DM) is 0.05, but if I drag DM very carefully to a different position, it may be very suddenly 0.95. That is, by continuously dragging DM you cannot expect that the PathParameter will be continuously changed in the attached case. This results in jumping positions of O. This behavior does not occur very frequently, however.

photo
photo
2

hello again

try this code

  1. if (ggbApplet.getValue("x(E)")) {

    var ppD = ggbApplet.getValue("ppD");

    ggbApplet.evalCommand("ppDok="+ppD);

    } else {

    var ppDok = ggbApplet.getValue("ppDok");

    ggbApplet.evalCommand("SelectObjects[]");

    ggbApplet.evalCommand("SetValue[D,Point[d,"+ppDok+"]]");

    }

then you will want another point like D for the other half of curve

saludos

photo
1

This is exactly I was searching for! That's wonderful. Thank you so much! :-)

photo
1

I think you can do the script in GGscript

photo
1

Yes, maybe it's possible in simple GGscript also. Now I added an extra idea by computing the ordinal of the intersection. This one cannot be animated, just dragged.

photo
1

hello

select DM and walk slowly around arcs over the vectorial path

/OwAAAABJRU5ErkJgggA=

0<=pathparameter[]<=1 so 0.05 and 0.97 are near pathparameter values

© 2019 International GeoGebra Institute