how can i add the two different polyshape to another varriable and then can check the overlap between them ?
2 views (last 30 days)
Show older comments
is there any way out how can i get new varriable with two polyshapes ? one is circle other is polygon
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/199762/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/199763/image.png)
0 Comments
Answers (2)
Steven Lord
on 26 Dec 2018
The line where that error occurred is
a(i) = polyin2;
Why are you trying to store your polyshape as a single element of the double array of coordinate data you used to create polyin1?
If you're using release R2018a or later, use the overlaps function to determine if they overlap, or call intersect to determine the intersection then calculate the area of that intersection.
You may be interested in this blog post which uses overlap calculation to determine if two states share a border.
0 Comments
Image Analyst
on 26 Dec 2018
Not sure how to do it with polyshapes, but if you want to use poly2mask() to create a digital image, then you could use & on the two binary images
binaryImage1 = polymask(x1, y1, rows, columns);
binaryImage2 = polymask(x2, y2, rows, columns);
overlapImage = binaryImage1 & binaryImage2;
0 Comments
See Also
Categories
Find more on Elementary Polygons in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!