Polyshape/union returns incorrect polygon shape
Ältere Kommentare anzeigen
I am combining multiple overlapping small rectangles (randomly placed and oriented) together in a larger square area (one by one whitin a loop) and computing the resulting polygon shape. I use both the intersect and union commands. For some reason, ocasionally during this process the union command between the square and one rectangle results in an incorrect shape. I assume that this is related with some numerical error that occurs when the vertices of the rectangle and the square are nearby. This is the square before the rectangle is added

and this is the union shape when the rectangle is added

notice how when the rectangle is added to the square the polygon becomes distorted (for some reason) almost as if the command wants to join the vertices of both. Finally, I then ask for the intersection between this shape and the square, resulting in a smaller area than what I had originally

For reference, I am also adding a figure with the generated rectangles in red and the offensive rectangle is shown in blue

Thank you in advance for any help. I have tested and this problem occurs both in Matlab 2018a and Matlab 2019a.
7 Kommentare
Scott MacKenzie
am 10 Jul. 2021
It might help if you post the code that generated these images.
ola macaco
am 10 Jul. 2021
Scott MacKenzie
am 10 Jul. 2021
I'm not seeing what you see (see figure below). I notice there are some NaN values in the poly_before vertices. Perhaps that's an issue.

ola macaco
am 10 Jul. 2021
Bearbeitet: ola macaco
am 10 Jul. 2021
ola macaco
am 10 Jul. 2021
Scott MacKenzie
am 10 Jul. 2021
Not sure what you mean by "that" in Can you compare that against the poly_during. I'm running R2021a
ola macaco
am 10 Jul. 2021
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Logical finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!