Library to calculate angles from positions and vice versa (also used for shooting angles)
Dependents: includeair includeair calcul_Ueff2 Mesure_energie
Diff: angleandposition.cpp
- Revision:
- 4:9492c1c361b9
- Parent:
- 3:067c75c62882
- Child:
- 5:2dc21bf3f3a0
diff -r 067c75c62882 -r 9492c1c361b9 angleandposition.cpp --- a/angleandposition.cpp Tue Oct 27 16:13:26 2015 +0000 +++ b/angleandposition.cpp Thu Oct 29 14:03:25 2015 +0000 @@ -15,7 +15,7 @@ } -float angleandposition::positiontoangle1(float x_position, float y_position)//rigth arm +double angleandposition::positiontoangle1(double x_position, double y_position)//rigth arm { double virt_bar_right = sqrt( pow(x_position-0.5*base_spacing,2) + pow(y_position,2) ); @@ -33,7 +33,7 @@ return theta_r; } -float angleandposition::positiontoangle2(float x_position, float y_position)//left arm +double angleandposition::positiontoangle2(double x_position, double y_position)//left arm { double virt_bar_left = sqrt(pow((x_position + 0.5*base_spacing) ,2) + pow(y_position,2) ); @@ -54,7 +54,7 @@ return theta_l; } -float angleandposition::angletoposition(float theta_r,float theta_l) +double angleandposition::angletoposition(double theta_r,double theta_l) { double virt_bar_x = base_spacing + cos(theta_l)*bar1 + cos(theta_r)*bar1; @@ -77,7 +77,7 @@ return x; } -float angleandposition::angletoposition_y (float theta_r, float theta_l) +double angleandposition::angletoposition_y (double theta_r, double theta_l) { double virt_bar_x = base_spacing + cos(theta_l)*bar1 + cos(theta_r)*bar1; double virt_bar_y = sin(theta_l)*bar1 - sin(theta_r)*bar1;