fix only one end of imline object
1 次查看(过去 30 天)
显示 更早的评论
I have checked the setConstrainedPosition feature, but it seems to only constrain both ends. What I want to achieve is to fix one end of imline object while leave the other end freely movable. Thanks in advance!
0 个评论
回答(1 个)
Image Analyst
2018-8-24
I don't think you can do that with imline(). What you'd have to do is to use the mouse move callback to erase the prior line and draw a new line, with line() not imline(), from the fixed point to the current point where the cursor is.
2 个评论
Image Analyst
2018-8-24
You have the current point. Then you can look up "point line distance" on the web for a formula. I'd move which ever line is closest to your current point.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Object Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!