Magnetized Point for an Intersection

11 views
Skip to first unread message

Daniel Choi

unread,
Jul 28, 2021, 8:40:55 PM7/28/21
to JSXGraph
Hello,


The link above is an example of how to use attractors to magnetize points to an point,line,circle, etc.

Is there any way that a JSX.Intersection can have the same behavior as example in the link above. (For example, if a two lines intersected each other, and the intersection would magnetize to a point/line when one of the intersecting lines moved?)

This link is the docs for the Intersection element, but it does not have an attractor attribute. 

Is there way to have magnetizing behavior for the intersection element? Am I missing something? is there some kind of work around?

Thanks so much

Alfred Wassermann

unread,
Jul 29, 2021, 6:57:03 AM7/29/21
to JSXGraph
It is not possible to let intersection points react to attractors, because of the hierarchy of the construction.
But it may be poossible that you can fake this situation with a glider on one line which in turn is one of the defining points of the second line:

var li1 = board.create('line', [[-3, -3], [4,1]]);
var glide1 = board.create('glider', [-2, -2, li1], {fixed: true, color: 'blue', withLabel: false});
var glide2 = board.create('glider', [2, 0, li1], {
            withLabel: false,
      attractors: [glide1],
      attractorDistance: 0.8,
      snatchDistance: 0.3
      });
var p = board.create('point', [2, 3], {withLabel: false});
var li2 = board.create('line', [glide2, p], {fixed: false});
board.create('group', [p, glide2]);


Best wishes,
Alfred





Reply all
Reply to author
Forward
0 new messages