필터 지우기
필터 지우기

use imline() to draw a draggable line with fixed length

조회 수: 4 (최근 30일)
Yinan Xuan
Yinan Xuan 2018년 8월 24일
댓글: Yinan Xuan 2018년 8월 28일
I have been thinking about using a position constraint function which is in circle shape with its center at one end of the line. In that case, I can drag the other end so that every drag will result in a line of length equal to radius of the circle. However, I only found makeConstrainToRectFcn which makes the constraint rectangle but not circle.
Or is there other way to achieve the same goals? Thank you very much!

채택된 답변

Naman Chaturvedi
Naman Chaturvedi 2018년 8월 28일
Hello Yinan,
You can use the addNewPositionCallback function to acieve your constraint goal. The constraint function may calculate the slope of the line segment and accord to the radius and slope, find the position of second point.
Hope this helps.
  댓글 수: 1
Yinan Xuan
Yinan Xuan 2018년 8월 28일
Thank you for your reply! I managed to work around this using basically the same logic. I created another new line based on the slope and radius and deleted the old one right after.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by