Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Calculating the polygon outline from the set of overlapping polygons


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 AnEverydayGuy   Members   -  Reputation: 172

Like
0Likes
Like

Posted 17 June 2014 - 09:55 AM

Hello all. I am working on pathfinding and I am using navigation meshes. I am using A* and have it working. However, as I'm sure most of you know, there's a 'jagged-ness' to the calculated path. I am using the vertices of the various navigation meshes to calculate my path (hence, for me, the jagged-ness). Now the beauty of navigation meshes so that any point on a nav mesh to reachable to any other point on the same nav mesh. So I am trying to put two and two together by using raycasting/line-of-sight/whatever to smooth out my path.

 

I don't know how.

 

My current plan is to post process my calculated path to make it smoother. This will be done by taking the starting point and checking if it has a line-of-sight to the goal, if not check if the starting point has a LoS to the point before the goal and so on. When a LoS is found a path from the start to the point is created, and the process starts again with the found point being the new 'starting point'. Sounds good, but I have a problem with the line-of-sight part.

 

I don't know how.

 

My current plan (regarding the LoS issue) is to calculate a polygon 'outline' that covers the navigation meshes (IE: I'm taking several (overlapping/connected) polygons and 'adding' them together so any overlapping parts are removed and I have a single silhouette polygon). Once I have that, I can simply check if a ray from point-to-point crosses said polygon's edge, if it does then there's no LoS. Of course, I have a problem calculating the outline polygon.

 

I don't know how.

 

So my question is: How do I calculate the polygon outline from set of overlapping/connected polygons?

Or, perhaps even, is this dumb and is there a better way to do this?



Sponsor:

#2 quasar3d   Members   -  Reputation: 709

Like
0Likes
Like

Posted 17 June 2014 - 05:40 PM

What you want is http://en.wikipedia.org/wiki/Boolean_operations_on_polygons with the union operations. It's definitely not an easy thing to implement though, so if you can find a way to do without this, it's probably preferable.



#3 Aardvajk   Crossbones+   -  Reputation: 7125

Like
0Likes
Like

Posted 18 June 2014 - 01:37 AM

I'm by no means an expert in this area, but I think you are thinking about this a little wrong. The advantage of using a navigation mesh is that the polygons you are dealing with are convex, so it is actually very simple to work out if there is a LoS from polygon A to polygon B. If you merge your polygons the way you describe, you will have a non-convex polygon which becomes far, far harder to work with. In fact, if I were trying to work out a LoS across a concave polygon, I'd probably approach this by first decomposing it into convex polys which would be the reverse of what you are proposing :)

 

As I understand the nav mesh, you step from one polygon to the next using a nominal position - say, centre of connecting edges - to confirm the path exists and to form an initial rough path. You then apply smoothing to this generated rough path to minimize its distance. I'll leave the advice on how that works to people who have actually implemented it.



#4 AnEverydayGuy   Members   -  Reputation: 172

Like
0Likes
Like

Posted 18 June 2014 - 03:17 PM

I've changed my plan of attack to more inline with Theta* pathfinding (not sure if that's an actual thing or just the name the guy came up with, http://aigamedev.com/open/tutorials/theta-star-any-angle-paths/). However, I still need to determine if two points have a 'line of sight' with each other (the entire vector is in a nav mesh, though not nessessary in the same nav mesh).

 

 Any ideas?






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS