Clear Filters
Clear Filters

How to drag an fimplicit function

1 view (last 30 days)
I have a typical problem I want to solve the intersection point of two polynomial curves by moving the curves within specific limits of X and Y. My problem is let's say we have equation of two 2Dimensional circles say x^2 + y^2 + 5*x + 12*y +15 and x^2 + y^2 -18*x -22*y -24. Now I want to drag both the circles within specific limits of x and y and if the two circles intersect each other simultaneously solve the point of intersections and display them along with two circles I have one solution here https://in.mathworks.com/matlabcentral/fileexchange/4179-draggable which uses the plot function to drag the figures however the only problem is it does not solve and displays the point of intersection of two curves I tried the code on fimplicit but it gives error that X data and y data are read only. If anybody can help me
  8 Comments
Saikat Banerjee
Saikat Banerjee on 17 Jul 2020
can anyone provide an answer for anybody working on this problem
Walter Roberson
Walter Roberson on 17 Jul 2020
I am so backlogged on answering people, that I cannot even find some of the posts that are waiting for responses from me. I have active contributions to over 30 different Questions per day, plus material I read but do not contribute to, plus a heck-load of software upgrades for me this week. I have made it to bed before day once in the past two weeks.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 17 Jul 2020
Set a ButtonDownFcn callback for each of the graphic objects. The callback should just register which of the objects was selected.
Set a WindowButtonUpFcn callback for the figure. The callback should unregister the last last object, so that no objects would be marked as selected.
Set a WindowButtonMotionFcn callback for the figure. The callback should check to see if any object is marked as active, and if not it should return. If an object is marked as active, then get the Axes CurrentPoint . Now take the XData and YData for the selected graphics object and subtract off the mean x and mean y coordinates, and add the x and y of the CurrentPoint, and set those as being the new XData and YData of the graphics object. This will have the effect of moving the graphics object to be centered around the place the user is pointing to.
Under some circumstance, you will want to trigger detection of potential intersection and calculation of the exact intersection for your purposes. It might perhaps make sense to program that into the WindowButtonUpFcn callback under the circumstance that an object was indeed active.
  10 Comments
Saikat Banerjee
Saikat Banerjee on 19 Jul 2020
then please do not comment further on this post I will ask for help from someone else who would genuinely help me
Walter Roberson
Walter Roberson on 19 Jul 2020
We have different ideas about what is involved to "help" you. The volunteers here mostly believe that the best way to "help" people is to teach them how to do things, rather than for the volunteers to do the work on behalf of the people.

Sign in to comment.

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!