Page 2 of 2

Re: Make vertices at intersections of two overlapping polygo

Posted: Thu Oct 29, 2015 6:41 pm
by bvargish
Thanks again for your insight! As always, very helpful!

I was thinking I'd use an open loop for a static ground shape like the one below. I highlighted where the line would be. I could add points to close it up, but nothing will ever hit the bottom of the line so I figured less points would be better. As you can see, the tool I used in Flash is far from optimized! 13 polygons were used to create the ground when really all I need is a line!
Capture.PNG
Capture.PNG (117.33 KiB) Viewed 10930 times
As far as my plus shape question, I thought maybe the weld jointed together shapes would be more optimized from a performance standpoint because it looked like the merged shape had more polygons in it based on the faint lines that form a Z within it as below. I'm sure joints carry a little weight, though, so I'm guessing I'd be better off with the merged shape created by your script.
Capture2.PNG
Capture2.PNG (7.85 KiB) Viewed 10930 times

Re: Make vertices at intersections of two overlapping polygo

Posted: Fri Oct 30, 2015 5:24 am
by iforce2d
Yes, less polygons overall will give better performance. In a case like that you might want to keep the original two rectangles.