"geometry, trigonometry" is what i'm trying to figure out here.
got a question about math functions with x and y reals.
actually, i don't know almost anything about those, and wish someone would make a tutorial on them.
anyway...here's the pressing question i have for now.
let's say i have a hero select a target x/y a certain distance away from him...let's say 200-750 range away.
now i want to get the math to get the x/y points for two more angles of a triangle. but i don't know anything about the math functions to do that.
let's say that there is a line for the triangle crossing with the caster's facing direction. since he's facing the direction of the target x/y when casting there...the line will cross his viewing angle...and i want to in the trigger select the points a certain distance away from there.
so let's say the spell is casted 500 range or more away from the caster. now we want to get a line to draw us a couple more points that will be closer to the caster. each a certain distance from the center of the line.
something like that.
i need the math functions to be able to get those points so i can use them...also i want to be able to select targets within this triangle of the target, and 2 other points which are extrapolated from the caster's position.
of course...if the target is close to the hero, then the triangle will be drawn differently.
like that
i knowthere's a tutorial
http://www.hiveworkshop.com/forums/archive/index.php/t-172620.html
there, but i don't understand it.
looks like i can find some angles...but i don't know what their degrees are! here's what i mean:
so here's where i'm stuck. although i can target the 3 points depending on where the target point is...how am i to calculate for what is in the triangle?
i would think that it would be good to get the degrees of the angles. but i don't know how to do that. i don't know how to get the degrees in the triangle even though with those functions which i don't even know what they do i was able to establish the angles of the triangle. i could make 3 units cast siphon mana on eachother...that would display the sides...but i have no way to know how to do anything physically with that. it's not like you could make units that try to cross that line get attacked by the line.
and what about figuring out how to make one of the 3 units face the direction that is in the middle of the other two units? like i said, i don't know how to figure out what the degrees of an angle is, so how can i cut it in half if i don't even know what it is? wouldn't the degrees of an angle depend on the distances?
hmm...well, i think i figured out kindof how to do it by reading some wiki articles about triangles.
in my code if i write it like this, then the 3 sides will be the same length...meaning that they have the same angle, which is 1/3 of 180, or 60.
they said that
c/ca=b/ba=c/ca. that's the formula.
there was another formula that made me realize that the 3 sides were the same length...lol
2d^2+2m^2=a^2+b^2
so since the line going to the far angle was 300, and it going to the other angles was both 300, that was 600times 600...or shorten it to 6x6 giving me 36. and m was c cut in half. which was what i did. and d was that first number. so it was all the same. another 36. so a and b making the 72 meant they both had to have the range of 600 each. it didn't take long after that to realize the angles all had the same degrees.
EDIT: ah...somehow the triangles aren't making sense to me...i thought i figured it out but it's somehow...i think i messed up in interpreting the calculations...meh...whatever. i guess angle of 60 for all three is close enough...
got a question about math functions with x and y reals.
actually, i don't know almost anything about those, and wish someone would make a tutorial on them.
anyway...here's the pressing question i have for now.
let's say i have a hero select a target x/y a certain distance away from him...let's say 200-750 range away.
now i want to get the math to get the x/y points for two more angles of a triangle. but i don't know anything about the math functions to do that.
let's say that there is a line for the triangle crossing with the caster's facing direction. since he's facing the direction of the target x/y when casting there...the line will cross his viewing angle...and i want to in the trigger select the points a certain distance away from there.
so let's say the spell is casted 500 range or more away from the caster. now we want to get a line to draw us a couple more points that will be closer to the caster. each a certain distance from the center of the line.
Code:
t
p_______p
c
i need the math functions to be able to get those points so i can use them...also i want to be able to select targets within this triangle of the target, and 2 other points which are extrapolated from the caster's position.
of course...if the target is close to the hero, then the triangle will be drawn differently.
Code:
p_______p
t
c
i knowthere's a tutorial
http://www.hiveworkshop.com/forums/archive/index.php/t-172620.html
there, but i don't understand it.
looks like i can find some angles...but i don't know what their degrees are! here's what i mean:
JASS:
local real uf=GetUnitFacing(SpellEvent.CastingUnit)
local real lf=uf+90.00//these two reals go left and right from the center of the
local real rf=uf-90.00//hypotanuse...thus, getting ready to form the two angles of it
local real dist=getdisr(SpellEvent.TargetX,SpellEvent.TargetY,SpellEvent.CastingUnit)
local integer lvl=GetUnitAbilityLevel(SpellEvent.CastingUnit,iac)
local real disfrocen=300.00//we will use this 3 times, twice in establishing
// the angles of the hypotanuse, and once to get the last angle.
// the distance numbers can change, that doesn't matter what they are.
local unit xa=null
local unit xb=null
local unit xc=null
local player y = GetOwningPlayer(SpellEvent.CastingUnit)
local real tx = SpellEvent.TargetX
local real ty = SpellEvent.TargetY
if dist<500 then
set xa = CreateUnit(y, 039;ospw039;, tx + disfrocen * Cos(lf * bj_DEGTORAD), ty + disfrocen * Sin(lf * bj_DEGTORAD), lf+180.00)
//i don't know what these functions do...i only know they seem to let me make units
//that are at an angle at a distance from a point...(Cos, Sin, bjDEG)
set xb = CreateUnit(y, 039;ospw039;, tx + disfrocen * Cos(rf * bj_DEGTORAD), ty + disfrocen * Sin(rf * bj_DEGTORAD), rf+180.00)
set xc = CreateUnit(y, 039;ospw039;, tx + disfrocen * Cos(uf * bj_DEGTORAD), ty + disfrocen * Sin(uf * bj_DEGTORAD), uf+180.00)
else
set xa = CreateUnit(y, 039;ospw039;, tx - disfrocen * Cos(lf * bj_DEGTORAD), ty - disfrocen * Sin(lf * bj_DEGTORAD), lf-180.00)
set xb = CreateUnit(y, 039;ospw039;, tx - disfrocen * Cos(rf * bj_DEGTORAD), ty - disfrocen * Sin(rf * bj_DEGTORAD), rf-180.00)
set xc = CreateUnit(y, 039;ospw039;, tx - disfrocen * Cos(uf * bj_DEGTORAD), ty - disfrocen * Sin(uf * bj_DEGTORAD), uf-180.00)
endif
set xa = null
set xb = null
set xc = null
so here's where i'm stuck. although i can target the 3 points depending on where the target point is...how am i to calculate for what is in the triangle?
i would think that it would be good to get the degrees of the angles. but i don't know how to do that. i don't know how to get the degrees in the triangle even though with those functions which i don't even know what they do i was able to establish the angles of the triangle. i could make 3 units cast siphon mana on eachother...that would display the sides...but i have no way to know how to do anything physically with that. it's not like you could make units that try to cross that line get attacked by the line.
and what about figuring out how to make one of the 3 units face the direction that is in the middle of the other two units? like i said, i don't know how to figure out what the degrees of an angle is, so how can i cut it in half if i don't even know what it is? wouldn't the degrees of an angle depend on the distances?
hmm...well, i think i figured out kindof how to do it by reading some wiki articles about triangles.
in my code if i write it like this, then the 3 sides will be the same length...meaning that they have the same angle, which is 1/3 of 180, or 60.
they said that
c/ca=b/ba=c/ca. that's the formula.
there was another formula that made me realize that the 3 sides were the same length...lol
2d^2+2m^2=a^2+b^2
so since the line going to the far angle was 300, and it going to the other angles was both 300, that was 600times 600...or shorten it to 6x6 giving me 36. and m was c cut in half. which was what i did. and d was that first number. so it was all the same. another 36. so a and b making the 72 meant they both had to have the range of 600 each. it didn't take long after that to realize the angles all had the same degrees.
EDIT: ah...somehow the triangles aren't making sense to me...i thought i figured it out but it's somehow...i think i messed up in interpreting the calculations...meh...whatever. i guess angle of 60 for all three is close enough...