Properties
Category
English
Similar Topics
Statistics
Comments
22
Participants
4
Subscribers
0
Votes
1
Views
2704
Share
Can you have relative points?
Answered
Hi,
Is it possible to have a point B that stays a fixed distance from point A when point A is moved, but can itself be moved independently?
(ie like a vector)
If I define point B as (x(A) + 3, y(A) + 2) it almost works, however dragging point B also moves point A.
thanks!
 GeoGebra
 Help
 Partners

Contact us
 Feedback & Questions
 This email address is being protected from spambots. You need JavaScript enabled to view it.
 +43 677 6137 2693
© 2023 International GeoGebra Institute
Hi murkle
Have a look at the examples here:
http://www.zenbikermaniac.f...
I hope one of them is what you are looking for.
Zen Biker Maniac
No, none of them are quite right :(
thanks anyway!
Hi murkle
The answer may be in your question  try a vector.
Referring again to: http://www.zenbikermaniac.f...
specifically to the Vector example at the bottom of the page.
Points A4 and O4 can be moved independently of each other.
It is also possible to move u (click and drag anywhere on the vector line).
To create a vector, select mode Vector between two points
then click at two positions (tail and head).
The mode Vector from point makes use of an existing vector and point.
Select the mode, click on the point (tail) then click on the line of the vector.
(The order doesn't matter  Click on vector then point gives the same result.)
If this is still does not do what you want then you are up against the basic mathematics of GeoGebra.
I suspect it can be done in GeoGebra with some added Javascript.
Please feel free to give more detail of what you are wanting to do.
Zen Biker Maniac
I was trying to make a circle where dragging the centre point moves the circle without changing the radius, and also with a draggable point on the circumference.
Hi murkle
The closest you can get with GeoGebra (without Javascript) is
 New Point :arrow_right: A
 Circle with centre A and radius 3 say :arrow_right: c
 New Point on c :arrow_right: B
Move A moves everything (A, B, c).
Move B moves A on c without moving A or c.
Optionally, c can be hidden without affecting the behaviour of A an d B.
Zen
Hi again
The addition of Javascript will give you a solution:
http://www.zenbikermaniac.freesurf.fr/geogebra/pre_release/index.html
Click the button labelled SemiFree on the right.
The particular Javascript calls used here are quite resource hungry
so be patient while it loads and don't move the points too quickly.
Also in this example the points have been set to snap to grid.
You can also read the discussion that went on during development:
http://www.geogebra.org/for...
including a link to the French forum.
All the Best
Zen Biker Maniac
Perfect, thanks!
There seems to be a bug somewhere (in the JavaScript?) here:
http://www.zenbikermaniac.f...
To see it, drag the point A to (3,2) and the point B jumps to (5.000000000000028, 8.881784197001252e16)
More generally if point B is "p" units above A and you move A so that it has a Ycoordinate of "p" then B jumps off.
It looks like it might be a "divide by zero" bug but I can't see any division.
[Windows XP, Firefox 2.04/IE6]
Hi Murkle
That's interesting. I hadn't noticed that (or chose to ignore it?).
Even more generally, for any A(x, y) and B(x+p, y+q)i) one form of the bug shows when A is on the line x = p
ii) another form shows when A is on the line y = q
iii) there is a combined form when A is at the intersection point (p, q).
These movements of A should respectively place the point B
i) on the yaxis ... (0, any)
ii) on the xaxis ... (any, 0)
iii) at the origin ... (0, 0)
Instead, the point B is not shown and the gradient of the line is wrong.
The B coordinate could be the source of 0 for a dividebyzero bug.
But, as you observe, there is no division in the Javascript code.
I originally posted this example as a demonstration of how to use the new calls.
My own experience was that the performance was too slow on classroom computers.
So I didn't develop any more in this direction.
I'll think about it some more and post any further thoughts here.
All the Best
Zen Biker Maniac
I think I've found a workaround. I stripped the code down first but the problem was still there. However when I changed the logic slightly it disappeared. I've introduced offX and offY.
Does it now work for you?
:)
<script type="text/javascript">
var xA;
var yA;
var xB;
var yB;
var offX;
var offY;
function startup() {
document.Animated.registerObjectUpdateListener("A", "updateListenerA");
xA = document.Animated.getXcoord("A");
yA = document.Animated.getYcoord("A");
document.Animated.registerObjectUpdateListener("B", "updateListenerB");
xB = document.Animated.getXcoord("B");
yB = document.Animated.getYcoord("B");
offX=document.Animated.getXcoord("B")document.Animated.getXcoord("A");
offY=document.Animated.getYcoord("B")document.Animated.getYcoord("A");
} //end startup
function updateListenerA(objName) {
var tmp;
xA = document.Animated.getXcoord("A");
yA = document.Animated.getYcoord("A");
xB = xA + offX;
yB = yA + offY;
// Unregister and Register to avoid a cascade of calls
document.Animated.unregisterObjectUpdateListener("B");
document.Animated.evalCommand("B= ("+xB+", "+yB+")");
document.Animated.registerObjectUpdateListener("B", "updateListenerB");
} //end updateListenerA
function updateListenerB(objName) {
offX=document.Animated.getXcoord("B")document.Animated.getXcoord("A");
offY=document.Animated.getYcoord("B")document.Animated.getYcoord("A");
} //end updateListenerB
</script>
Hi murkle
I've tried your code and there is no sign of any bug.
Unfortunately, the essential functionality is lost. :?
That is, Point A can be moved without moving Point B.
I was a bit short of time to check it any further.
I also tried turning off the 'Snap to Grid' but no effect on bug.
Zen
Definitely works here :)
you wrote the answer
the order is very important
A=(0,0) by click in origin
B free
C free
D=A+C
hide C
E=D+BA
you can move D and E keep distance but you can move E freely
saludos
That's very neat, thanks. I knew it was possible somehow :)
I think you've made a small mistake, this works for me:
Now to make a Tool...
Hi murkle, mathmagic
:exclamation: Something fundamental has changed between GeoGebra 2.7 and 3.0
:question: I think a bug may have been introduced.
:arrow_right: http://www.geogebra.org/for...
:bulb: If I am correct, it is this new bug which provides the functionality in this example.
:cry: Unfortunately, I think this example will not work when the bug is removed.
:D ... or I could be wrong.
Zen
if you like GG 2.7 you can do this:
A,B,C free points
D=A+B/2+C/2A
then A move freely and D move A
hidding B,C break the object of construction so redefine B=(20000,?) C=(20000,?) and get them out of the window
saludos
Sadly I think you're right. Looks like Markus fixed that bug at some point :(
You can eliminate A from the above since its coordinates are zero.
E.g., if A equals zero, then B  A = B.
I invented the previous method, but now C is the one who moves to E
best
A free
B free
segment[A,B]
C=B+0*A
hide B
it seems that C move A and really A is moved by segment
saludos
Brilliant!!! (again).
thanks.
i have seen you have used the trick in protractor page with the obvious addition (to use white colour and thin style)
in some case (moving the segment over a polygon) you can see a ghost white line over poly
here is another method without this problem
A free
B free
C free
CircularArc[A,B,C]
move B over A
hide A
hide B
D=B+(0,0)
to move D will move C but C is free
indeed: have you try the trick with conic through five point? four free and one guiding
it can be useful for desing traslations of fickle triangles
saludos
This doesn't seem to work when you save and reload.
I don't understand  have you got an example?
thanks!
Comments have been locked on this page!