| 10-15-2007, 11:31 AM | #2 |
The easiest method to calculate Xn Yn points is to notice that all these points are on a circle. For 5 sided figure angle between center of figure and 2 near points is 360/5 = 72 So you do CosBJ(72*k) and SinBJ(72*k) k=0..n-1 To find out if unit is inside polygon use unit inside triangle function (you can find the fastest implementation on jass vault site) So for 5 sided polygon you do InTriangle(center, P0, P1) InTriangle(center, P1, P2) InTriangle(center, P2, P3) InTriangle(center, P3, P4) InTriangle(center, P4, P0) |
| 10-15-2007, 12:16 PM | #3 |
You could do what cohader suggested to group all the units in the polygon (using the triangles). You could then use computational geometry to find the distance between the unit and the outer edge (of the triangle you are checking for). That would allow you to filter for units only just inside the polygon (that would also be possible with two triangle groupings, but computational geometry should be faster). |
| 10-15-2007, 12:26 PM | #4 |
| 10-15-2007, 03:25 PM | #5 |
If I'm understanding your problem correctly-
|
| 10-16-2007, 03:03 AM | #6 |
there is a polygon detection system out tere, u can use it to detect if a unit is inside or outside a poygon :) and then just push them |
| 10-16-2007, 03:41 AM | #7 | |
Quote:
And the problem was not detecting units inside the quad, it was getting the vertexes. I've figured it out now and I'm just going to use some concentric circles and figure out what the X/Y values are by projecting onto that circle at the specific angle. |
| 10-16-2007, 10:52 AM | #8 |
Where is my rep biach :) khe khe khe. |
| 10-16-2007, 10:59 AM | #9 | |
Quote:
|
| 10-16-2007, 11:17 AM | #10 |
Sorry but I am strait. |
| 10-16-2007, 07:11 PM | #11 |
You even spelled "straight" wrong. |
