フィルターのクリア

Is it possible to constrain an impoly within in impoly?

2 ビュー (過去 30 日間)
Right Grievous
Right Grievous 2014 年 6 月 29 日
コメント済み: Right Grievous 2014 年 7 月 7 日
Hi everybody,
I have a graph on which the user places a rectangle, I then want the user to be able to draw or modify another rectangle within the first, however, this second inner rectangle cannot exit the first at any point.
I'm using impoly as I'm familiar with it, however, these shapes may or may not be parallel to the axes (although they will be parallel to each other) so I don't think I can use makeConstrainToRectFcn as it only sets an x limit and a y limit.
Is there another way to constrain impoly? or is there a way I can have the inner polygon's vertices snapped to the first polygon's edges if they fall outside of it?
Thank you for any help,
Rod.

採用された回答

Image Analyst
Image Analyst 2014 年 6 月 30 日
Use imrect() instead of impoly(). And if you can't do it with constraintorect then don't worry about it and just AND the two rectangles together to get the new coordinates.
  1 件のコメント
Right Grievous
Right Grievous 2014 年 7 月 7 日
Hi and thank you for your response, in the end it made sense to rotate my data (which were coordinates) using the excellent rotateData function on the file exchange. Once rotated to be parallel with the Y axis I could just use imrect as you suggested. Many thanks, Rod.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by