Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //---------- 2リンク逆運動学 ------------//
- double inv_kin2the(double x1,double y1,double x3,double y3,double L1,double L2){
- double ow=pow((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1),0.5);
- double oe=(L1*L1-L2*L2+ow*ow)/(2*ow);
- return atan2(y3-y1,x3-x1)+acos(oe/L1);//acsの前の符号を+-変えることで解を二つ出せる
- }
- double inv_kin2x(double the,double x1,double L1){
- return L1*cos(the)+x1;
- }
- double inv_kin2y(double the,double y1,double L1){
- return L1*sin(the)+y1;
- }
Add Comment
Please, Sign In to add comment