everything is clear now, however your (2/3) * alpha is bigger than alpha
and i am not sure why you draw a pic with angles elow x origin since they should be pointed up liek on this picture:
![ante.png](https://sites.google.com/site/customprog/ante.png)
here is my apporach, find angle of T vector, your assumptions (A = R1 * (cos(alpha), sin(alpha))) show that if t points directly right from coord origin then alpha is 0
when alpha is 90 its pointing straight up when 180 then left and when 270 then down. thats how i like it ![:P tongue.png](http://public.gamedev5.net//public/style_emoticons/default/tongue.png)
note i use degrees not radians (for me its more intuitive)
anyway my notebook burned and i am using old one i have no option to compile and test + i had some of my math functions with bugs (not sure if those i show you were bugged, my recent math unit is on other notebook
)
const long double pild = 3.1415926535897932384626433832795;
template <class type> type VALIDATE_TO_360(type angle2)
{
type angle = angle2;
int kat=(int)angle2;
kat=kat/360;
if (angle < 0 )
angle = angle + (type)(kat+1)*360.0;
if (angle >= 360)
angle = angle - (type)kat*360.0;
return angle;
}
long double n2dGetPolarCoordAngleAD(double x,double y)
{
if ( (x == 0) && (y > 0) ) { return 3.1415926535897932384626433832795/2.0; }
if ( (x == 0) && (y < 0) ) { return 3.0*3.1415926535897932384626433832795/2.0; }
if (x == 0) return 0.0; //actually we cant find the angle
long double k; k = (long double)y / (long double)x;
if ( (x > 0) && (y >= 0) ) { return atanl(k); }
if ( (x > 0) && (y < 0) ) { return atanl(k)+2.0*3.1415926535897932384626433832795; }
if (x < 0) { return atanl(k)+3.1415926535897932384626433832795; }
//last versions were without .0 just simple 2 division
return 0.0; //actually we cant find the angle
}
long double GetAngle(vec2 vector)
{
vec2 origin = vec2(0.0, 0.0);
long double angle;
angle = n2dGetPolarCoordAngleAD(
(long double)vector.x-origin.x,
(long double)vector.y-origin.y) / (pild*2.0);
return VALIDATE_TO_360(360.0*angle); //not sure if there should be * 360.0 ut it seems that it should. since i divide with getpolarcoord by two pi
}
now actual function
we define the angles of the A and B so B additionally 2/3 of alpha
1 and 2/3 => 3/3 + 2/3 = 5 / 3
float return_my_angle(vec2 vector)
{
float angle = float(GetAngle(vector)); //angle between 0-360
// 5/3 * alpha = angle;
return (angle * 3.0) / 5.0;
}
but it should work
so you now have found your alpha
EDIT:
there could be a problem with floating point precision for function
n2dGetPolarCoordAngleAD
with if x == 0 or if y == 0 that needs to be tweaked to use some sort of epsilon like 0.0001 or even smaller so it will assume small numbers as 0.0