The problem is I use Asin and Acos to get 2 different angle (ang1 and ang2) which i confirmed the result with Msgbox
But the next step is a simple subtraction "ang3 := ang2 - ang1", but the script just gave me a blank answer
I already tried with "ang3 = %ang2% - %ang1%" but the it also led me to same result
Asked google but it seems Im the 1st (or mb the only) one met this kind of trouble
here the code:
Code: Select all
r := 200
x0 := 773
y0 := 711
x1 := 1160
y1 := 349
; CALCULATION START HERE
l := sqrt((x0-x1)**2 +(y0-y1)**2)
Msgbox % "distance is " l
ang1 := asin(r/l)
if(y0>y1){
ang2 := acos((y0-y1)/l)
}
ang3 = %ang2% - %ang1% ; Angle3 = for cast point X Y final calculation
xplus := r*cos(ang3)
yplus := r*sin(ang3)
xtrg := x0 + xplus
ytrg := y0+ yplus
Msgbox, Angle 1 = %ang1%`nAngle 2 = %ang2%`nAngle 3 = %ang3%`nTarget Coord X = %xtrg% , Y = %ytrg%
return