- Joined
- Jun 22, 2016
- Messages
- 71
I've decided to start making my own spells in JASS. So far I'm creating spawn target points with Polar Offset based from the cast click point. I've followed this guide but it's a little difficult since I'm not very knowledgeable with geometry Math. So I'm taking it one step at a time.
This is my based understanding with the circle example so far that works.
I know 0 starts at East and there are 360 degrees in a circle. I want to find the value if I rotate by half. Say if value starts at 190 and I rotate by 180. This will result 370 but it's an overflow of the maximum possible result and should result in 10. Maybe if I reverse the direction by 180 from 170, it could result in 350 instead. Is there a easy function of way to safely get the correct rotation even if an overflow?
Example
This is my based understanding with the circle example so far that works.
JASS:
// PolarProjectionBJ(<location> Target, <real> Offset, <real> Direction) returns <location> Polar Offset Location
// I2R(<integer> Number) returns <real> Integer to Real
// CreateNUnitsAtLocFacingLocBJ(<integer> Create Number, <integer> Unit Type ID, <player> Owner, <location> Target, <location> Facing Target) returns <nothing>
set illusionLoc = PolarProjectionBJ(targetLoc, distance, (I2R(i) * (360.00 / l)))
call CreateNUnitsAtLocFacingLocBJ(1, uType, owner, illusionLoc, targetLoc)
I know 0 starts at East and there are 360 degrees in a circle. I want to find the value if I rotate by half. Say if value starts at 190 and I rotate by 180. This will result 370 but it's an overflow of the maximum possible result and should result in 10. Maybe if I reverse the direction by 180 from 170, it could result in 350 instead. Is there a easy function of way to safely get the correct rotation even if an overflow?
Example
JASS:
function getRotation takes real rotation returns real
// return correct rotation
endfunction
JASS:
local real start = 100.00
local real modify = start + 300.00
local real result = getRotation(modify) returns 40.00