How do I use rectint to find the area of two intersecting rectangles?
古いコメントを表示
I am trying to find the area of two intersecting rectangles. The rectint function in the help file does not help demonstrate proper usage of the command.
I don't know the correct way to define the rectangles or use the command. I am also rotating one rectangle relative to the other, and the area is going to change. Both rectangles have the same center. I know the area should be at a max when the rectangles overlap and be at a min when the rectangles are at a right angles to each other. I can rotate the rectangles, but the area is not what I expect. What are the sins I have commited,and how to I atone for them? Some examples would be helpful.
A second challenge is to plot the the rectangles and the resulting area, but one problem at a time.
3 件のコメント
John D'Errico
2011 年 2 月 9 日
How can we possibly know what you have done wrong, if we cannot see what you have done? Yes, we could do your homework completely for you, but how will that really help you?
Brian
2011 年 2 月 11 日
Brian
2011 年 2 月 11 日
回答 (4 件)
Rafael
2011 年 2 月 9 日
0 投票
maybe you get a first idea by looking at this:
http://csc.fsksm.utm.my/syed/projects/image-processing.html
Walter Roberson
2011 年 2 月 9 日
0 投票
The documentation you referred to does say clearly that a position vector is [x y w h] where x and y are the starting coordinates and w and h are the width and height.
Therefore for the purpose of this command, the rectangles must align with the x/y axes.
Bruno Luong
2011 年 2 月 10 日
0 投票
There is a set of polygon boolean operators in Mapping Toolbox. I can't find the official doc but the below link you an idea what you can do.
If you don't own the toolbox, there is a tool on FEX (haven't tried my self)
I have codded a Matlab based, if the above won't work, I probably could try to provide you part of my code.
Evan
2012 年 1 月 12 日
0 投票
Surprisingly, the help file is rather terse. Testing it out on a simple example, the x and y corner coordinates of the position vector need to be the lower right corner of the rectangle.
1 件のコメント
Walter Roberson
2012 年 1 月 12 日
The help file for which routine, Evan?
カテゴリ
ヘルプ センター および File Exchange で MATLAB についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!