[snippet]PointInTriangle

explained, lol...


if you are still confused
->remember a triangle is made up of 3 points, which means that it has 6 coordinates (x1, y1, x2, y2, x3, y3)

srsly your explanation is bad
I googled a bit and noticed that I have to know stuff about vectors
we didn't cover this topic at school yet so I will have to find out how things work myself

then I tried to do something with Atan2 (which would probably be faster because JASS is slow at math and atan2 is quite fast because it's lower level) but it didn't work because it does not return 0 to 2 pi but -pi to pi
sure this is easy to fix but then it would be slower again

at least I came to test yours and it works just fine

edit:
here's a good explanation http://www.blackpawn.com/texts/pointinpoly/default.html
basically you just check if point P always is on the left (right) side of A to B, B to C and C to A
 
Last edited:
Changed > to >= so that it includes things on edges of triangle.

Removed description above script. The comment description should be enough.

->Add Axarion awesome link to the description (it will be necessary believe me).

I will not : ). I have the belief that a post should only contain minimal information for how to use a script. If you don't know what a concept is within a script, you should google it : P. For example, a script for a stack, a queue, or a linked list shouldn't contain information as to what those things actually are =). Now, if there is a concept entirely unique to that script, like attackPath or superNova, then yea, it should talk about them : p.

->Vexorian has made something alike this although it's about group/units.
Ok.. lol.
 
Well the rules say the documentation has to say everything. If someone has a question you have to add the information^^

I don't see that in the rules and that's a stupid rule anyways, so no : P. If it were added, it'd still be a no, lol.

However, I do agree with the rule: "Documentation should include everything unique to the resource"
 
Level 8
Joined
Oct 3, 2008
Messages
367
It really doesn't get much more self explanatory than this. You don't need to know why it works, you just need to know where to use it and how. It lets you know if a given point (px, py) is inside a triangle composed of the three points (ax, ay), (bx, by), and (cx, cy). Why should anything more be required?
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
This might be a bit useless..
But since there was a little struggle about whether to use > or >=, why not make 2 functions?
IsPointInTriangle() and
IsPointOnTriangle()
Or well.. I suck at thinking of good names.. make up some of your own.. but this might be handy.. well i can't think of any situations, but it might be..

This might just be my most confusing post ever.. ><
 
Top