I've been to solve this problem for the last 2 days with no success. say we have this system :
the has an infinite number of solutions when :
to get value of the angle Theta, I use this formula :
The value that I get is correct but only in some points, because the system isn't solvable. and here is how it looks like :
the red curve represents the "must be" value and the blue one represents that I actually get.
after ploting the value of the sum :
here is what I get : as you can see it's sinus curve, that seems to influence the "must be" value of the angle.
to simulate this I've been using this program :
#include <stdio.h>
#include <math.h>
int main (){
float xin =0;
float yin =0;
float zin =0;
float A =0;
float B =0;
float C =0;
float angle =0;
float outangle =0 ;
float angledeg =0;
while (angledeg <=(360*3)) {
angle = angledeg * M_PI/180;
xin = 0.11;
yin = (sin(angle) / sqrt(3)) + xin;
zin = (xin - (sin(angle +(120*M_PI/180))));
A = yin - xin;
B = xin - zin;
C = zin - yin;
outangle = atan2((A*sqrt(3)) , (B -C) ) * 180/M_PI; // 100% correct
printf ("%lf \n" , outangle);
angledeg++;
}
return 0;
}
So my QUESTION is : how could I use the value of sum to adjust the resulted value of "must be" value of the angle ( the red curve)
UPDATE
I don't know if this make a sense but it works : Removing sqrt(3) :
yin = (sin(angle) / sqrt(3)) + xin;
I really don't get it, but it works fine ? any idea why ?
You can dramatically simplify the situation by considering that
sin(t)+sin(t+120°)+sin(t+240°)=0
which just means that the (weight) center point of any equilateral triangle on the unit circle is the origin.
Thus
sin(t)/sqrt(3)+sin(t+120°)+sin(t+240°)=sin(t)*(1/sqrt(3)-1)
So the only values of t=theta
that make the system solvable are t=0°
and t=180°
.
In computing
y=x+sin(t)/sqrt(3); z=x-sin(t+120°)
you produce as value for C
z-y = - sin(t+120°) - sin(t)/sqrt(3)
and thus
B-C = 2*sin(t+120°) + sin(t)/sqrt(3)
= -sin(t) + sqrt(3)*cos(t) + sin(t)/sqrt(3)
where in some kind of expectation you only expect the middle term, which is true for sin(t)=0
, again for t=0°
or t=180°
.