How do I use rectint to find the area of two intersecting rectangles?
Mostrar comentarios más antiguos
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 comentarios
John D'Errico
el 9 de Feb. de 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
el 11 de Feb. de 2011
Brian
el 11 de Feb. de 2011
Respuestas (4)
Rafael
el 9 de Feb. de 2011
0 votos
maybe you get a first idea by looking at this:
http://csc.fsksm.utm.my/syed/projects/image-processing.html
Walter Roberson
el 9 de Feb. de 2011
0 votos
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
el 10 de Feb. de 2011
0 votos
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
el 12 de En. de 2012
0 votos
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 comentario
Walter Roberson
el 12 de En. de 2012
The help file for which routine, Evan?
Categorías
Más información sobre MATLAB en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!