| 04-18-2007, 11:53 AM | #1 |
I can't say I suck at math because I am asking you this question, I haven't taken up the more advanced algebra yet. I still don't know what the hell sin, cosine, atan, radians and whatever are.. Anywho, can someone show me a formula on how an angle between two coordinates is calculated? ![]() EDIT: Another problem :( I don't know how to do move XY coordinates to another XY coordinate towards the angle.. It's too hard to elaborate.. It's kinda like polar projection but instead of using a location it uses a coordinate. |
| 04-18-2007, 11:58 AM | #2 |
JASS:function AngleBetweenPoints takes location locA, location locB returns real return bj_RADTODEG * Atan2(GetLocationY(locB) - GetLocationY(locA), GetLocationX(locB) - GetLocationX(locA)) endfunction Here's the version of the wrapper I use. JASS://*************************************************************************************************************** //*Returns the angle between two points when you give the (X,Y) coordinates. //* function AngleBetweenPointsXY takes real x1, real y1, real x2, real y2 returns real return 57.29582 * Atan2(y2 - y1, x2 - x1) endfunction |
| 04-18-2007, 11:59 AM | #3 |
Thanks! I'll try and understand this :D EDIT: Sorry can't rep you, have to spread some first <_< Anywho, I have another problem >_< check the first post please? :D |
| 04-18-2007, 12:10 PM | #4 |
JASS://*************************************************************************************************************** //*Returns a target X value projected from a given X value, a distance, and an angle. //* function ProjectX takes real x, real dist, real angle returns real return x + dist * Cos(angle * 0.01745) endfunction JASS://*************************************************************************************************************** //*Returns a target Y value projected from a given Y value, a distance, and an angle. //* function ProjectY takes real y, real dist, real angle returns real return y + dist * Sin(angle * 0.01745) endfunction |
| 04-18-2007, 12:13 PM | #5 |
I really feel bad that I can't rep you anymore >_< Anyways, thank you very much! |
| 04-18-2007, 12:13 PM | #6 | |
Quote:
I'm not here to get rep, I'm here to help people. These are common knowledge functions anyways. |
| 04-18-2007, 12:16 PM | #7 |
Well then, I'm pretty glad you're here Oh, and I haven't heard of these functions before :/ |
| 04-18-2007, 12:22 PM | #8 |
Here is where they're all located in some form or another. |
| 04-18-2007, 12:28 PM | #9 |
Wow I must be blessed or something.. xD Anyways, thanks again :P The link contains almost everything I need :D |
