Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Algorithm Programming Assistance

Author
Message
luke810
18
Years of Service
User Offline
Joined: 4th Sep 2006
Location: United States
Posted: 15th Oct 2009 04:11
This might be classified as a "team request" post, but I'm looking for assistance and coding some of the addition features of my pathfinder. ( http://forum.thegamecreators.com/?m=forum_view&t=157808&b=22 ) In particular, I've had trouble doing the polygon union operations and with the proper handling of threshold values for testing intersections. There are also a couple other features such as automatic entity following and avoidance that I was thinking of implementing. The code itself is pretty well laid out if you check the header file, so no one should have much trouble trying to understand it. If you are interested, just reply to the post.

Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 17th Oct 2009 01:34
I know how to get the union of two polygons

But I don't have time to program it so I'll just explain it:

You need to know how to do a line/line intersection test, but that is easily available on the internet.

- Take a point on one of the polygons, which is outside the other polygon. (You can check if it is outside by checking for intersections using a horizontal line away from the point a long way away. If it intersects with an even number of lines from the other polygon, it is outside the polygon.)

- Follow the points around that polygon starting with that point.

- For each line on the polygon defined by the current point and the previous point, check if it intersects with any lines from the other polygon.

- If it does intersect, add a point at the intersection, and continue on the new line you found, starting from the new point.

- Once you get back to the start you have drawn a union of the two polygons.

Login to post a reply

Server time is: 2024-10-01 14:24:35
Your offset time is: 2024-10-01 14:24:35