How do I use rectint to find the area of two intersecting rectangles?
Afficher commentaires plus anciens
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 commentaires
John D'Errico
le 9 Fév 2011
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
le 11 Fév 2011
Brian
le 11 Fév 2011
Réponses (4)
Rafael
le 9 Fév 2011
0 votes
maybe you get a first idea by looking at this:
http://csc.fsksm.utm.my/syed/projects/image-processing.html
Walter Roberson
le 9 Fév 2011
0 votes
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
le 10 Fév 2011
0 votes
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
le 12 Jan 2012
0 votes
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 commentaire
Walter Roberson
le 12 Jan 2012
The help file for which routine, Evan?
Catégories
En savoir plus sur MATLAB dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!