How to drag an fimplicit function
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
Walter Roberson
2020-7-17
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.
采纳的回答
Walter Roberson
2020-7-17
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 个评论
Walter Roberson
2020-7-19
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!