tooltiperror
Super Moderator
- Reaction score
- 231
Normally, I would use a function like this in, say, JASS:
The problem is, it uses [LJASS]Cos[/LJASS], [LJASS]Sin[/LJASS], and [LJASS]bj_DEGTORAD[/LJASS] which are all comparatively slow in JASS, the reason being natives and operations are pretty slow.
Is there way using vectors to do something better? I know Jesus4Lyf uses vectors for something similar to this, wanted to know how it could be done, and it'd be nice if someone could explain the math of it too.
JASS:
function PolarProjectionBJ takes location source, real dist, real angle returns location
local real x = GetLocationX(source) + dist * Cos(angle * bj_DEGTORAD)
local real y = GetLocationY(source) + dist * Sin(angle * bj_DEGTORAD)
return Location(x, y)
endfunction
The problem is, it uses [LJASS]Cos[/LJASS], [LJASS]Sin[/LJASS], and [LJASS]bj_DEGTORAD[/LJASS] which are all comparatively slow in JASS, the reason being natives and operations are pretty slow.
Is there way using vectors to do something better? I know Jesus4Lyf uses vectors for something similar to this, wanted to know how it could be done, and it'd be nice if someone could explain the math of it too.