that_one_nigga_you_k

pose do robo

Jun 3rd, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.93 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.   float x=10,y=10,z=4,c;
  8.   float l0 = 10,l1=10,l2=10;
  9.   float theta1, theta2, theta3;
  10.   float interno = l1-l2;
  11.   float externo = l1+l2;
  12.   float r = sqrt(x*x + y*y);
  13.   float tg1, tg2;
  14.  
  15.   if(r>externo) {
  16.     cout<<"coordenada além do limite ext";
  17.   }
  18.  
  19.  
  20.   if(r<interno){
  21.     cout<<"coordenada além do limite int";
  22.   }
  23.  
  24.   if (r>= interno && r<= externo){
  25.     theta1 = acos(x/r) - acos((x*x + y*y + l1*l1 - l2*l2)/(2*l1*r));
  26.     theta2 = M_PI- acos((l1*l1 + l2*l2 - (x*x + y*y))/(2*l1*l2));
  27.     c=  z - l0;
  28.  
  29.     tg1 = theta1*180/M_PI;
  30.     tg2 = theta2*180/M_PI;
  31.  
  32.     cout<<"\t\t\tRADIANS";
  33.     cout<<"\n\n\ntheta1 em radianos = "<< theta1;
  34.     cout<<"\ntheta2 em radianos = "<<theta2;
  35.     cout<<"\n\n\t\t\tDEG";
  36.     cout<<"\n\ntheta1 em graus = "<<tg1;
  37.     cout<<"\ntheta2 em graus = "<<tg2;
  38.  
  39.     cout<<"\n\nC";
  40.     cout<<"\nc= "<<c;
  41.   }
  42. }
Add Comment
Please, Sign In to add comment