00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <cmath>
00021 #include <vector>
00022 #include <limits>
00023 #include <algorithm>
00024 #include <complex>
00025
00026 #ifdef IKFAST_HEADER
00027 #include IKFAST_HEADER
00028 #endif
00029
00030 #ifndef IKFAST_ASSERT
00031 #include <stdexcept>
00032 #include <sstream>
00033
00034 #ifdef _MSC_VER
00035 #ifndef __PRETTY_FUNCTION__
00036 #define __PRETTY_FUNCTION__ __FUNCDNAME__
00037 #endif
00038 #endif
00039
00040 #ifndef __PRETTY_FUNCTION__
00041 #define __PRETTY_FUNCTION__ __func__
00042 #endif
00043
00044 #define IKFAST_ASSERT(b) { if( !(b) ) { std::stringstream ss; ss << "ikfast exception: " << __FILE__ << ":" << __LINE__ << ": " <<__PRETTY_FUNCTION__ << ": Assertion '" << #b << "' failed"; throw std::runtime_error(ss.str()); } }
00045
00046 #endif
00047
00048 #if defined(_MSC_VER)
00049 #define IKFAST_ALIGNED16(x) __declspec(align(16)) x
00050 #else
00051 #define IKFAST_ALIGNED16(x) x __attribute((aligned(16)))
00052 #endif
00053
00054 #define IK2PI ((IKReal)6.28318530717959)
00055 #define IKPI ((IKReal)3.14159265358979)
00056 #define IKPI_2 ((IKReal)1.57079632679490)
00057
00058 #ifdef _MSC_VER
00059 #ifndef isnan
00060 #define isnan _isnan
00061 #endif
00062 #endif // _MSC_VER
00063
00064
00065 #ifdef IKFAST_CLIBRARY
00066 #ifdef _MSC_VER
00067 #define IKFAST_API extern "C" __declspec(dllexport)
00068 #else
00069 #define IKFAST_API extern "C"
00070 #endif
00071 #else
00072 #define IKFAST_API
00073 #endif
00074
00075
00076 extern "C" {
00077 void dgetrf_ (const int* m, const int* n, double* a, const int* lda, int* ipiv, int* info);
00078 void zgetrf_ (const int* m, const int* n, std::complex<double>* a, const int* lda, int* ipiv, int* info);
00079 void dgetri_(const int* n, const double* a, const int* lda, int* ipiv, double* work, const int* lwork, int* info);
00080 void dgesv_ (const int* n, const int* nrhs, double* a, const int* lda, int* ipiv, double* b, const int* ldb, int* info);
00081 void dgetrs_(const char *trans, const int *n, const int *nrhs, double *a, const int *lda, int *ipiv, double *b, const int *ldb, int *info);
00082 void dgeev_(const char *jobvl, const char *jobvr, const int *n, double *a, const int *lda, double *wr, double *wi,double *vl, const int *ldvl, double *vr, const int *ldvr, double *work, const int *lwork, int *info);
00083 }
00084
00085 using namespace std;
00086
00087 #ifdef IKFAST_NAMESPACE
00088 namespace IKFAST_NAMESPACE {
00089 #endif
00090
00091 #ifdef IKFAST_REAL
00092 typedef IKFAST_REAL IKReal;
00093 #else
00094 typedef double IKReal;
00095 #endif
00096
00097 class IKSolution
00098 {
00099 public:
00102 void GetSolution(IKReal* psolution, const IKReal* pfree) const {
00103 for(std::size_t i = 0; i < basesol.size(); ++i) {
00104 if( basesol[i].freeind < 0 )
00105 psolution[i] = basesol[i].foffset;
00106 else {
00107 IKFAST_ASSERT(pfree != NULL);
00108 psolution[i] = pfree[basesol[i].freeind]*basesol[i].fmul + basesol[i].foffset;
00109 if( psolution[i] > IKPI ) {
00110 psolution[i] -= IK2PI;
00111 }
00112 else if( psolution[i] < -IKPI ) {
00113 psolution[i] += IK2PI;
00114 }
00115 }
00116 }
00117 }
00118
00121 const std::vector<int>& GetFree() const { return vfree; }
00122
00123 struct VARIABLE
00124 {
00125 VARIABLE() : freeind(-1), fmul(0), foffset(0) {}
00126 VARIABLE(int freeind, IKReal fmul, IKReal foffset) : freeind(freeind), fmul(fmul), foffset(foffset) {}
00127 int freeind;
00128 IKReal fmul, foffset;
00129 };
00130
00131 std::vector<VARIABLE> basesol;
00132 std::vector<int> vfree;
00133 };
00134
00135 inline float IKabs(float f) { return fabsf(f); }
00136 inline double IKabs(double f) { return fabs(f); }
00137
00138 inline float IKlog(float f) { return logf(f); }
00139 inline double IKlog(double f) { return log(f); }
00140
00141 #ifndef IKFAST_SINCOS_THRESH
00142 #define IKFAST_SINCOS_THRESH ((IKReal)0.000001)
00143 #endif
00144
00145 inline float IKasin(float f)
00146 {
00147 IKFAST_ASSERT( f > -1-IKFAST_SINCOS_THRESH && f < 1+IKFAST_SINCOS_THRESH );
00148 if( f <= -1 ) return -IKPI_2;
00149 else if( f >= 1 ) return IKPI_2;
00150 return asinf(f);
00151 }
00152 inline double IKasin(double f)
00153 {
00154 IKFAST_ASSERT( f > -1-IKFAST_SINCOS_THRESH && f < 1+IKFAST_SINCOS_THRESH );
00155 if( f <= -1 ) return -IKPI_2;
00156 else if( f >= 1 ) return IKPI_2;
00157 return asin(f);
00158 }
00159
00160
00161 inline float IKfmod(float x, float y)
00162 {
00163 while(x < 0) {
00164 x += y;
00165 }
00166 return fmodf(x,y);
00167 }
00168
00169
00170 inline float IKfmod(double x, double y)
00171 {
00172 while(x < 0) {
00173 x += y;
00174 }
00175 return fmod(x,y);
00176 }
00177
00178 inline float IKacos(float f)
00179 {
00180 IKFAST_ASSERT( f > -1-IKFAST_SINCOS_THRESH && f < 1+IKFAST_SINCOS_THRESH );
00181 if( f <= -1 ) return IKPI;
00182 else if( f >= 1 ) return 0;
00183 return acosf(f);
00184 }
00185 inline double IKacos(double f)
00186 {
00187 IKFAST_ASSERT( f > -1-IKFAST_SINCOS_THRESH && f < 1+IKFAST_SINCOS_THRESH );
00188 if( f <= -1 ) return IKPI;
00189 else if( f >= 1 ) return 0;
00190 return acos(f);
00191 }
00192 inline float IKsin(float f) { return sinf(f); }
00193 inline double IKsin(double f) { return sin(f); }
00194 inline float IKcos(float f) { return cosf(f); }
00195 inline double IKcos(double f) { return cos(f); }
00196 inline float IKtan(float f) { return tanf(f); }
00197 inline double IKtan(double f) { return tan(f); }
00198 inline float IKsqrt(float f) { if( f <= 0.0f ) return 0.0f; return sqrtf(f); }
00199 inline double IKsqrt(double f) { if( f <= 0.0 ) return 0.0; return sqrt(f); }
00200 inline float IKatan2(float fy, float fx) {
00201 if( isnan(fy) ) {
00202 IKFAST_ASSERT(!isnan(fx));
00203 return IKPI_2;
00204 }
00205 else if( isnan(fx) ) {
00206 return 0;
00207 }
00208 return atan2f(fy,fx);
00209 }
00210 inline double IKatan2(double fy, double fx) {
00211 if( isnan(fy) ) {
00212 IKFAST_ASSERT(!isnan(fx));
00213 return IKPI_2;
00214 }
00215 else if( isnan(fx) ) {
00216 return 0;
00217 }
00218 return atan2(fy,fx);
00219 }
00220
00221 inline float IKsign(float f) {
00222 if( f > 0 ) {
00223 return 1.0f;
00224 }
00225 else if( f < 0 ) {
00226 return -1.0f;
00227 }
00228 return 0;
00229 }
00230
00231 inline double IKsign(double f) {
00232 if( f > 0 ) {
00233 return 1.0;
00234 }
00235 else if( f < 0 ) {
00236 return -1.0;
00237 }
00238 return 0;
00239 }
00240
00243 IKFAST_API void fk(const IKReal* j, IKReal* eetrans, IKReal* eerot) {
00244 IKReal x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,x17,x18,x19,x20,x21,x22,x23,x24,x25,x26,x27,x28,x29,x30,x31,x32,x33,x34,x35,x36,x37,x38,x39,x40,x41,x42,x43,x44,x45,x46,x47,x48,x49,x50,x51,x52,x53,x54,x55,x56,x57,x58,x59,x60,x61,x62,x63,x64,x65,x66,x67,x68,x69,x70,x71,x72,x73,x74;
00245 x0=IKcos(j[0]);
00246 x1=IKcos(j[1]);
00247 x2=IKcos(j[2]);
00248 x3=IKsin(j[0]);
00249 x4=IKsin(j[2]);
00250 x5=IKsin(j[3]);
00251 x6=((x3)*(x4));
00252 x7=((x0)*(x1)*(x2));
00253 x8=IKcos(j[3]);
00254 x9=IKsin(j[1]);
00255 x10=IKcos(j[4]);
00256 x11=((x7)+(((-1.00000000000000)*(x6))));
00257 x12=((x11)*(x8));
00258 x13=((x0)*(x5)*(x9));
00259 x14=((x13)+(x12));
00260 x15=((x2)*(x3));
00261 x16=((x0)*(x1)*(x4));
00262 x17=((x15)+(x16));
00263 x18=IKsin(j[4]);
00264 x19=IKsin(j[6]);
00265 x20=IKsin(j[5]);
00266 x21=((x6)+(((-1.00000000000000)*(x7))));
00267 x22=((x21)*(x5));
00268 x23=((x0)*(x8)*(x9));
00269 x24=((x22)+(x23));
00270 x25=((x20)*(x24));
00271 x26=IKcos(j[5]);
00272 x27=((x10)*(x14));
00273 x28=((x17)*(x18));
00274 x29=((x27)+(x28));
00275 x30=((x26)*(x29));
00276 x31=((x30)+(x25));
00277 x32=IKcos(j[6]);
00278 x33=((x10)*(x17));
00279 x34=((-1.00000000000000)*(x14));
00280 x35=((x18)*(x34));
00281 x36=((x33)+(x35));
00282 x37=((x0)*(x4));
00283 x38=((x1)*(x15));
00284 x39=((x38)+(x37));
00285 x40=((x1)*(x6));
00286 x41=((x0)*(x2));
00287 x42=((((-1.00000000000000)*(x41)))+(x40));
00288 x43=((x39)*(x8));
00289 x44=((x3)*(x5)*(x9));
00290 x45=((x44)+(x43));
00291 x46=((-1.00000000000000)*(x39));
00292 x47=((x46)*(x5));
00293 x48=((x3)*(x8)*(x9));
00294 x49=((x48)+(x47));
00295 x50=((x20)*(x49));
00296 x51=((x18)*(x42));
00297 x52=((x10)*(x45));
00298 x53=((x51)+(x52));
00299 x54=((x26)*(x53));
00300 x55=((x54)+(x50));
00301 x56=((x10)*(x42));
00302 x57=((-1.00000000000000)*(x45));
00303 x58=((x18)*(x57));
00304 x59=((x58)+(x56));
00305 x60=((x1)*(x5));
00306 x61=((x2)*(x8)*(x9));
00307 x62=((x10)*(x4)*(x9));
00308 x63=((x61)+(((-1.00000000000000)*(x60))));
00309 x64=((x18)*(x63));
00310 x65=((x60)+(((-1.00000000000000)*(x61))));
00311 x66=((x10)*(x65));
00312 x67=((x18)*(x4)*(x9));
00313 x68=((x66)+(((-1.00000000000000)*(x67))));
00314 x69=((x26)*(x68));
00315 x70=((x2)*(x5)*(x9));
00316 x71=((x1)*(x8));
00317 x72=((x71)+(x70));
00318 x73=((x20)*(x72));
00319 x74=((x73)+(x69));
00320 eerot[0]=((((x19)*(x36)))+(((x31)*(x32))));
00321 eerot[1]=((((x19)*(x31)))+(((-1.00000000000000)*(x32)*(x36))));
00322 eerot[2]=((((-1.00000000000000)*(x20)*(x29)))+(((x24)*(x26))));
00323 eetrans[0]=((((x5)*(((((0.360000000000000)*(x6)))+(((-0.360000000000000)*(x7)))))))+(((x20)*(((((-0.155000000000000)*(x27)))+(((-0.155000000000000)*(x28)))))))+(((0.360000000000000)*(x23)))+(((0.360000000000000)*(x0)*(x9)))+(((x26)*(((((0.155000000000000)*(x22)))+(((0.155000000000000)*(x23))))))));
00324 eerot[3]=((((x19)*(x59)))+(((x32)*(x55))));
00325 eerot[4]=((((-1.00000000000000)*(x32)*(x59)))+(((x19)*(x55))));
00326 eerot[5]=((((x26)*(x49)))+(((-1.00000000000000)*(x20)*(x53))));
00327 eetrans[1]=((((0.360000000000000)*(x3)*(x9)))+(((x20)*(((((-0.155000000000000)*(x52)))+(((-0.155000000000000)*(x51)))))))+(((x26)*(((((0.155000000000000)*(x48)))+(((0.155000000000000)*(x47)))))))+(((0.360000000000000)*(x48)))+(((x5)*(((((-0.360000000000000)*(x37)))+(((-0.360000000000000)*(x38))))))));
00328 eerot[6]=((((x32)*(x74)))+(((x19)*(((x64)+(((-1.00000000000000)*(x62))))))));
00329 eerot[7]=((((x32)*(((x62)+(((-1.00000000000000)*(x64)))))))+(((x19)*(x74))));
00330 eerot[8]=((((x26)*(x72)))+(((x20)*(((x67)+(((-1.00000000000000)*(x66))))))));
00331 eetrans[2]=((0.360000000000000)+(((0.360000000000000)*(x70)))+(((0.360000000000000)*(x71)))+(((0.360000000000000)*(x1)))+(((x20)*(((((0.155000000000000)*(x67)))+(((-0.155000000000000)*(x66)))))))+(((x26)*(((((0.155000000000000)*(x70)))+(((0.155000000000000)*(x71))))))));
00332 }
00333
00334 IKFAST_API int getNumFreeParameters() { return 1; }
00335 IKFAST_API int* getFreeParameters() { static int freeparams[] = {2}; return freeparams; }
00336 IKFAST_API int getNumJoints() { return 7; }
00337
00338 IKFAST_API int getIKRealSize() { return sizeof(IKReal); }
00339
00340 IKFAST_API int getIKType() { return 0x67000001; }
00341
00342 class IKSolver {
00343 public:
00344 IKReal j0,cj0,sj0,htj0,j1,cj1,sj1,htj1,j3,cj3,sj3,htj3,j4,cj4,sj4,htj4,j5,cj5,sj5,htj5,j6,cj6,sj6,htj6,j2,cj2,sj2,htj2,new_r00,r00,rxp0_0,new_r01,r01,rxp0_1,new_r02,r02,rxp0_2,new_r10,r10,rxp1_0,new_r11,r11,rxp1_1,new_r12,r12,rxp1_2,new_r20,r20,rxp2_0,new_r21,r21,rxp2_1,new_r22,r22,rxp2_2,new_px,px,npx,new_py,py,npy,new_pz,pz,npz,pp;
00345
00346 bool ik(const IKReal* eetrans, const IKReal* eerot, const IKReal* pfree, std::vector<IKSolution>& vsolutions) {
00347 for(int dummyiter = 0; dummyiter < 1; ++dummyiter) {
00348 vsolutions.resize(0); vsolutions.reserve(8);
00349 j2=pfree[0]; cj2=cos(pfree[0]); sj2=sin(pfree[0]);
00350 r00 = eerot[0*3+0];
00351 r01 = eerot[0*3+1];
00352 r02 = eerot[0*3+2];
00353 r10 = eerot[1*3+0];
00354 r11 = eerot[1*3+1];
00355 r12 = eerot[1*3+2];
00356 r20 = eerot[2*3+0];
00357 r21 = eerot[2*3+1];
00358 r22 = eerot[2*3+2];
00359 px = eetrans[0]; py = eetrans[1]; pz = eetrans[2];
00360
00361 new_r00=r00;
00362 new_r01=((-1.00000000000000)*(r01));
00363 new_r02=((-1.00000000000000)*(r02));
00364 new_px=((((-0.155000000000000)*(r02)))+(px));
00365 new_r10=r10;
00366 new_r11=((-1.00000000000000)*(r11));
00367 new_r12=((-1.00000000000000)*(r12));
00368 new_py=((((-0.155000000000000)*(r12)))+(py));
00369 new_r20=r20;
00370 new_r21=((-1.00000000000000)*(r21));
00371 new_r22=((-1.00000000000000)*(r22));
00372 new_pz=((-0.360000000000000)+(((-0.155000000000000)*(r22)))+(pz));
00373 r00 = new_r00; r01 = new_r01; r02 = new_r02; r10 = new_r10; r11 = new_r11; r12 = new_r12; r20 = new_r20; r21 = new_r21; r22 = new_r22; px = new_px; py = new_py; pz = new_pz;
00374 pp=(((px)*(px))+((py)*(py))+((pz)*(pz)));
00375 npx=((((px)*(r00)))+(((py)*(r10)))+(((pz)*(r20))));
00376 npy=((((px)*(r01)))+(((py)*(r11)))+(((pz)*(r21))));
00377 npz=((((px)*(r02)))+(((py)*(r12)))+(((pz)*(r22))));
00378 rxp0_0=((((-1.00000000000000)*(py)*(r20)))+(((pz)*(r10))));
00379 rxp0_1=((((px)*(r20)))+(((-1.00000000000000)*(pz)*(r00))));
00380 rxp0_2=((((-1.00000000000000)*(px)*(r10)))+(((py)*(r00))));
00381 rxp1_0=((((-1.00000000000000)*(py)*(r21)))+(((pz)*(r11))));
00382 rxp1_1=((((px)*(r21)))+(((-1.00000000000000)*(pz)*(r01))));
00383 rxp1_2=((((-1.00000000000000)*(px)*(r11)))+(((py)*(r01))));
00384 rxp2_0=((((-1.00000000000000)*(py)*(r22)))+(((pz)*(r12))));
00385 rxp2_1=((((px)*(r22)))+(((-1.00000000000000)*(pz)*(r02))));
00386 rxp2_2=((((-1.00000000000000)*(px)*(r12)))+(((py)*(r02))));
00387 {
00388 IKReal j3array[2], cj3array[2], sj3array[2];
00389 bool j3valid[2]={false};
00390 cj3array[0]=((-1.00000000000000)+(((3.85802469135802)*(pp))));
00391 if( cj3array[0] >= -1-IKFAST_SINCOS_THRESH && cj3array[0] <= 1+IKFAST_SINCOS_THRESH )
00392 {
00393 j3valid[0] = j3valid[1] = true;
00394 j3array[0] = IKacos(cj3array[0]);
00395 sj3array[0] = IKsin(j3array[0]);
00396 cj3array[1] = cj3array[0];
00397 j3array[1] = -j3array[0];
00398 sj3array[1] = -sj3array[0];
00399 }
00400 else if( isnan(cj3array[0]) )
00401 {
00402
00403 j3valid[0] = true;
00404 cj3array[0] = 1; sj3array[0] = 0; j3array[0] = 0;
00405 }
00406 if( j3valid[0] && j3valid[1] && IKabs(cj3array[0]-cj3array[1]) < 0.0001 && IKabs(sj3array[0]-sj3array[1]) < 0.0001 )
00407 {
00408 j3valid[1]=false;
00409 }
00410 for(int ij3 = 0; ij3 < 2; ++ij3)
00411 {
00412 if( !j3valid[ij3] )
00413 {
00414 continue;
00415 }
00416 j3 = j3array[ij3]; cj3 = cj3array[ij3]; sj3 = sj3array[ij3];
00417
00418 {
00419 IKReal dummyeval[1];
00420 IKReal gconst0;
00421 IKReal x75=(py)*(py);
00422 IKReal x76=(sj2)*(sj2);
00423 IKReal x77=(cj2)*(cj2);
00424 gconst0=IKsign(((((25.0000000000000)*(px)*(((((-1.00000000000000)*(x75)*(x77)))+(((-1.00000000000000)*(x75)*(x76)))))))+(((25.0000000000000)*(py)*(((((px)*(py)*(x76)))+(((px)*(py)*(x77)))))))));
00425 dummyeval[0]=0;
00426 if( IKabs(dummyeval[0]) < 0.0000010000000000 )
00427 {
00428 {
00429 IKReal dummyeval[1];
00430 dummyeval[0]=(((px)*(px))+((py)*(py)));
00431 if( IKabs(dummyeval[0]) < 0.0000010000000000 )
00432 {
00433 {
00434 IKReal dummyeval[1];
00435 dummyeval[0]=((1.00000000000000)+((cj3)*(cj3))+((((cj2)*(cj2))*((sj3)*(sj3))))+(((2.00000000000000)*(cj3))));
00436 if( IKabs(dummyeval[0]) < 0.0000010000000000 )
00437 {
00438 {
00439 IKReal evalcond[3];
00440 evalcond[0]=((-3.14159265358979)+(IKfmod(((1.11022302462516e-16)+(j3)), 6.28318530717959)));
00441 evalcond[1]=((-1.00000000000000)*(pp));
00442 evalcond[2]=((-1.00000000000000)*(pz));
00443 if( IKabs(evalcond[0]) < 0.0000010000000000 && IKabs(evalcond[1]) < 0.0000010000000000 && IKabs(evalcond[2]) < 0.0000010000000000 )
00444 {
00445 {
00446 IKReal j0array[2], cj0array[2], sj0array[2];
00447 bool j0valid[2]={false};
00448 IKReal x78=IKatan2(px, py);
00449 j0array[0]=((-1.00000000000000)*(x78));
00450 sj0array[0]=IKsin(j0array[0]);
00451 cj0array[0]=IKcos(j0array[0]);
00452 j0array[1]=((3.14159265358979)+(((-1.00000000000000)*(x78))));
00453 sj0array[1]=IKsin(j0array[1]);
00454 cj0array[1]=IKcos(j0array[1]);
00455 if( j0array[0] > IKPI )
00456 {
00457 j0array[0]-=IK2PI;
00458 }
00459 else if( j0array[0] < -IKPI )
00460 { j0array[0]+=IK2PI;
00461 }
00462 j0valid[0] = true;
00463 if( j0array[1] > IKPI )
00464 {
00465 j0array[1]-=IK2PI;
00466 }
00467 else if( j0array[1] < -IKPI )
00468 { j0array[1]+=IK2PI;
00469 }
00470 j0valid[1] = true;
00471 if( j0valid[0] && j0valid[1] && IKabs(cj0array[0]-cj0array[1]) < 0.0001 && IKabs(sj0array[0]-sj0array[1]) < 0.0001 )
00472 {
00473 j0valid[1]=false;
00474 }
00475 for(int ij0 = 0; ij0 < 2; ++ij0)
00476 {
00477 if( !j0valid[ij0] )
00478 {
00479 continue;
00480 }
00481 j0 = j0array[ij0]; cj0 = cj0array[ij0]; sj0 = sj0array[ij0];
00482
00483 {
00484 IKReal dummyeval[1];
00485 IKReal gconst7;
00486 gconst7=IKsign(((((-2.00000000000000)*(cj0)*(px)*(py)*(sj0)*(sj2)))+(((-1.00000000000000)*(sj2)*((cj0)*(cj0))*((px)*(px))))+(((-1.00000000000000)*(sj2)*((pz)*(pz))))+(((-1.00000000000000)*(sj2)*((py)*(py))*((sj0)*(sj0))))));
00487 dummyeval[0]=((((-2.00000000000000)*(cj0)*(px)*(py)*(sj0)*(sj2)))+(((-1.00000000000000)*(sj2)*((cj0)*(cj0))*((px)*(px))))+(((-1.00000000000000)*(sj2)*((pz)*(pz))))+(((-1.00000000000000)*(sj2)*((py)*(py))*((sj0)*(sj0)))));
00488 if( IKabs(dummyeval[0]) < 0.0000010000000000 )
00489 {
00490 {
00491 IKReal evalcond[6];
00492 IKReal x79=((cj0)*(py));
00493 IKReal x80=((px)*(sj0));
00494 evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(j2)), 6.28318530717959)));
00495 evalcond[1]=((-1.00000000000000)*(pp));
00496 evalcond[2]=((((-1.00000000000000)*(x79)))+(x80));
00497 evalcond[3]=((-1.00000000000000)*(pz));
00498 evalcond[4]=((((cj0)*(px)))+(((py)*(sj0))));
00499 evalcond[5]=((x79)+(((-1.00000000000000)*(x80))));
00500 if( IKabs(evalcond[0]) < 0.0000010000000000 && IKabs(evalcond[1]) < 0.0000010000000000 && IKabs(evalcond[2]) < 0.0000010000000000 && IKabs(evalcond[3]) < 0.0000010000000000 && IKabs(evalcond[4]) < 0.0000010000000000 && IKabs(evalcond[5]) < 0.0000010000000000 )
00501 {
00502 {
00503 IKReal dummyeval[1];
00504 dummyeval[0]=((((-1.00000000000000)*((cj0)*(cj0))*((px)*(px))))+(((-1.00000000000000)*((pz)*(pz))))+(((-2.00000000000000)*(cj0)*(px)*(py)*(sj0)))+(((-1.00000000000000)*((py)*(py))*((sj0)*(sj0)))));
00505 if( IKabs(dummyeval[0]) < 0.0000010000000000 )
00506 {
00507 continue;
00508
00509 } else
00510 {
00511 {
00512 IKReal j1array[1], cj1array[1], sj1array[1];
00513 bool j1valid[1]={false};
00514 IKReal x81=(pz)*(pz);
00515 IKReal x82=((18.0000000000000)*(x81));
00516 IKReal x83=(cj0)*(cj0);
00517 IKReal x84=(px)*(px);
00518 IKReal x85=((18.0000000000000)*(x83)*(x84));
00519 IKReal x86=(py)*(py);
00520 IKReal x87=(sj0)*(sj0);
00521 IKReal x88=((18.0000000000000)*(x86)*(x87));
00522 IKReal x89=((36.0000000000000)*(cj0)*(px)*(py)*(sj0));
00523 IKReal x90=((x88)+(x89)+(x82)+(x85));
00524 j1array[0]=IKatan2(((-1.00000000000000)*(((IKabs(x90) != 0)?((IKReal)1/(x90)):(IKReal)1.0e30))*(((((-25.0000000000000)*(pp)*(py)*(sj0)))+(((-25.0000000000000)*(cj0)*(pp)*(px)))))), ((25.0000000000000)*(pp)*(pz)*(((IKabs(x90) != 0)?((IKReal)1/(x90)):(IKReal)1.0e30))));
00525 sj1array[0]=IKsin(j1array[0]);
00526 cj1array[0]=IKcos(j1array[0]);
00527 if( j1array[0] > IKPI )
00528 {
00529 j1array[0]-=IK2PI;
00530 }
00531 else if( j1array[0] < -IKPI )
00532 { j1array[0]+=IK2PI;
00533 }
00534 j1valid[0] = true;
00535 for(int ij1 = 0; ij1 < 1; ++ij1)
00536 {
00537 if( !j1valid[ij1] )
00538 {
00539 continue;
00540 }
00541 j1 = j1array[ij1]; cj1 = cj1array[ij1]; sj1 = sj1array[ij1];
00542
00543 rotationfunction0(vsolutions);
00544 }
00545 }
00546
00547 }
00548
00549 }
00550
00551 } else
00552 {
00553 IKReal x138=((px)*(sj0));
00554 IKReal x139=((cj0)*(py));
00555 IKReal x140=((x138)+(((-1.00000000000000)*(x139))));
00556 evalcond[0]=((-3.14159265358979)+(IKfmod(((1.11022302462516e-16)+(j2)), 6.28318530717959)));
00557 evalcond[1]=((-1.00000000000000)*(pp));
00558 evalcond[2]=x140;
00559 evalcond[3]=((-1.00000000000000)*(pz));
00560 evalcond[4]=((((cj0)*(px)))+(((py)*(sj0))));
00561 evalcond[5]=x140;
00562 if( IKabs(evalcond[0]) < 0.0000010000000000 && IKabs(evalcond[1]) < 0.0000010000000000 && IKabs(evalcond[2]) < 0.0000010000000000 && IKabs(evalcond[3]) < 0.0000010000000000 && IKabs(evalcond[4]) < 0.0000010000000000 && IKabs(evalcond[5]) < 0.0000010000000000 )
00563 {
00564 {
00565 IKReal dummyeval[1];
00566 IKReal gconst8;
00567 gconst8=IKsign(((((18.0000000000000)*((pz)*(pz))))+(((18.0000000000000)*((cj0)*(cj0))*((px)*(px))))+(((18.0000000000000)*((py)*(py))*((sj0)*(sj0))))+(((36.0000000000000)*(cj0)*(px)*(py)*(sj0)))));
00568 dummyeval[0]=(((((py)*(py))*((sj0)*(sj0))))+((pz)*(pz))+((((cj0)*(cj0))*((px)*(px))))+(((2.00000000000000)*(cj0)*(px)*(py)*(sj0))));
00569 if( IKabs(dummyeval[0]) < 0.0000010000000000 )
00570 {
00571 continue;
00572
00573 } else
00574 {
00575 {
00576 IKReal j1array[1], cj1array[1], sj1array[1];
00577 bool j1valid[1]={false};
00578 j1array[0]=IKatan2(((gconst8)*(((((25.0000000000000)*(pp)*(py)*(sj0)))+(((25.0000000000000)*(cj0)*(pp)*(px)))))), ((25.0000000000000)*(gconst8)*(pp)*(pz)));
00579 sj1array[0]=IKsin(j1array[0]);
00580 cj1array[0]=IKcos(j1array[0]);
00581 if( j1array[0] > IKPI )
00582 {
00583 j1array[0]-=IK2PI;
00584 }
00585 else if( j1array[0] < -IKPI )
00586 { j1array[0]+=IK2PI;
00587 }
00588 j1valid[0] = true;
00589 for(int ij1 = 0; ij1 < 1; ++ij1)
00590 {
00591 if( !j1valid[ij1] )
00592 {
00593 continue;
00594 }
00595 j1 = j1array[ij1]; cj1 = cj1array[ij1]; sj1 = sj1array[ij1];
00596
00597 rotationfunction0(vsolutions);
00598 }
00599 }
00600
00601 }
00602
00603 }
00604
00605 } else
00606 {
00607 if( 1 )
00608 {
00609 continue;
00610
00611 } else
00612 {
00613 }
00614 }
00615 }
00616 }
00617
00618 } else
00619 {
00620 {
00621 IKReal j1array[1], cj1array[1], sj1array[1];
00622 bool j1valid[1]={false};
00623 j1array[0]=IKatan2(((gconst7)*(((((-1.00000000000000)*(cj2)*(px)*(pz)*(sj0)))+(((cj0)*(cj2)*(py)*(pz)))))), ((gconst7)*(((((-1.00000000000000)*(cj0)*(cj2)*(sj0)*((py)*(py))))+(((cj2)*(px)*(py)*((sj0)*(sj0))))+(((cj0)*(cj2)*(sj0)*((px)*(px))))+(((-1.00000000000000)*(cj2)*(px)*(py)*((cj0)*(cj0))))))));
00624 sj1array[0]=IKsin(j1array[0]);
00625 cj1array[0]=IKcos(j1array[0]);
00626 if( j1array[0] > IKPI )
00627 {
00628 j1array[0]-=IK2PI;
00629 }
00630 else if( j1array[0] < -IKPI )
00631 { j1array[0]+=IK2PI;
00632 }
00633 j1valid[0] = true;
00634 for(int ij1 = 0; ij1 < 1; ++ij1)
00635 {
00636 if( !j1valid[ij1] )
00637 {
00638 continue;
00639 }
00640 j1 = j1array[ij1]; cj1 = cj1array[ij1]; sj1 = sj1array[ij1];
00641
00642 rotationfunction0(vsolutions);
00643 }
00644 }
00645
00646 }
00647
00648 }
00649 }
00650 }
00651
00652 } else
00653 {
00654 if( 1 )
00655 {
00656 continue;
00657
00658 } else
00659 {
00660 }
00661 }
00662 }
00663
00664 } else
00665 {
00666 {
00667 IKReal j1array[2], cj1array[2], sj1array[2];
00668 bool j1valid[2]={false};
00669 IKReal x141=((0.360000000000000)*(cj3));
00670 IKReal x142=((0.360000000000000)+(x141));
00671 IKReal x143=(x142)*(x142);
00672 IKReal x144=(cj2)*(cj2);
00673 IKReal x145=(sj3)*(sj3);
00674 IKReal x146=((0.129600000000000)*(x144)*(x145));
00675 IKReal x147=((x143)+(x146));
00676 if( (x147) < (IKReal)-0.00001 )
00677 continue;
00678 IKReal x148=IKsqrt(x147);
00679 IKReal x149=IKabs(x148);
00680 IKReal x150=((IKabs(x149) != 0)?((IKReal)1/(x149)):(IKReal)1.0e30);
00681 IKReal x151=((pz)*(x150));
00682 if( (x151) < -1-IKFAST_SINCOS_THRESH || (x151) > 1+IKFAST_SINCOS_THRESH )
00683 continue;
00684 IKReal x152=IKasin(x151);
00685 IKReal x153=((0.360000000000000)*(cj2)*(sj3));
00686 IKReal x154=IKatan2(x142, x153);
00687 j1array[0]=((((-1.00000000000000)*(x154)))+(x152));
00688 sj1array[0]=IKsin(j1array[0]);
00689 cj1array[0]=IKcos(j1array[0]);
00690 j1array[1]=((3.14159265358979)+(((-1.00000000000000)*(x152)))+(((-1.00000000000000)*(x154))));
00691 sj1array[1]=IKsin(j1array[1]);
00692 cj1array[1]=IKcos(j1array[1]);
00693 if( j1array[0] > IKPI )
00694 {
00695 j1array[0]-=IK2PI;
00696 }
00697 else if( j1array[0] < -IKPI )
00698 { j1array[0]+=IK2PI;
00699 }
00700 j1valid[0] = true;
00701 if( j1array[1] > IKPI )
00702 {
00703 j1array[1]-=IK2PI;
00704 }
00705 else if( j1array[1] < -IKPI )
00706 { j1array[1]+=IK2PI;
00707 }
00708 j1valid[1] = true;
00709 if( j1valid[0] && j1valid[1] && IKabs(cj1array[0]-cj1array[1]) < 0.0001 && IKabs(sj1array[0]-sj1array[1]) < 0.0001 )
00710 {
00711 j1valid[1]=false;
00712 }
00713 for(int ij1 = 0; ij1 < 2; ++ij1)
00714 {
00715 if( !j1valid[ij1] )
00716 {
00717 continue;
00718 }
00719 j1 = j1array[ij1]; cj1 = cj1array[ij1]; sj1 = sj1array[ij1];
00720
00721 {
00722 IKReal dummyeval[1];
00723 IKReal gconst1;
00724 gconst1=IKsign(((((-450.000000000000)*(sj1)*((py)*(py))))+(((-450.000000000000)*(sj1)*((px)*(px))))));
00725 dummyeval[0]=((((-1.00000000000000)*(sj1)*((py)*(py))))+(((-1.00000000000000)*(sj1)*((px)*(px)))));
00726 if( IKabs(dummyeval[0]) < 0.0000010000000000 )
00727 {
00728 {
00729 IKReal evalcond[5];
00730 IKReal x155=((0.360000000000000)*(cj3));
00731 IKReal x156=((0.360000000000000)+(x155));
00732 IKReal x157=((x156)+(((-1.00000000000000)*(pz))));
00733 evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(j1)), 6.28318530717959)));
00734 evalcond[1]=((0.259200000000000)+(((0.259200000000000)*(cj3)))+(((-1.00000000000000)*(pp))));
00735 evalcond[2]=((((0.720000000000000)*(pz)))+(((-1.00000000000000)*(pp))));
00736 evalcond[3]=x157;
00737 evalcond[4]=x157;
00738 if( IKabs(evalcond[0]) < 0.0000010000000000 && IKabs(evalcond[1]) < 0.0000010000000000 && IKabs(evalcond[2]) < 0.0000010000000000 && IKabs(evalcond[3]) < 0.0000010000000000 && IKabs(evalcond[4]) < 0.0000010000000000 )
00739 {
00740 {
00741 IKReal dummyeval[1];
00742 IKReal gconst2;
00743 gconst2=IKsign(((((-25.0000000000000)*((py)*(py))))+(((-25.0000000000000)*((px)*(px))))));
00744 dummyeval[0]=((((-1.00000000000000)*((px)*(px))))+(((-1.00000000000000)*((py)*(py)))));
00745 if( IKabs(dummyeval[0]) < 0.0000010000000000 )
00746 {
00747 continue;
00748
00749 } else
00750 {
00751 {
00752 IKReal j0array[1], cj0array[1], sj0array[1];
00753 bool j0valid[1]={false};
00754 j0array[0]=IKatan2(((gconst2)*(((((-9.00000000000000)*(px)*(sj2)*(sj3)))+(((9.00000000000000)*(cj2)*(py)*(sj3)))))), ((gconst2)*(((((9.00000000000000)*(py)*(sj2)*(sj3)))+(((9.00000000000000)*(cj2)*(px)*(sj3)))))));
00755 sj0array[0]=IKsin(j0array[0]);
00756 cj0array[0]=IKcos(j0array[0]);
00757 if( j0array[0] > IKPI )
00758 {
00759 j0array[0]-=IK2PI;
00760 }
00761 else if( j0array[0] < -IKPI )
00762 { j0array[0]+=IK2PI;
00763 }
00764 j0valid[0] = true;
00765 for(int ij0 = 0; ij0 < 1; ++ij0)
00766 {
00767 if( !j0valid[ij0] )
00768 {
00769 continue;
00770 }
00771 j0 = j0array[ij0]; cj0 = cj0array[ij0]; sj0 = sj0array[ij0];
00772
00773 rotationfunction0(vsolutions);
00774 }
00775 }
00776
00777 }
00778
00779 }
00780
00781 } else
00782 {
00783 IKReal x158=((0.360000000000000)*(cj3));
00784 evalcond[0]=((-3.14159265358979)+(IKfmod(((1.11022302462516e-16)+(j1)), 6.28318530717959)));
00785 evalcond[1]=((0.259200000000000)+(((0.259200000000000)*(cj3)))+(((-1.00000000000000)*(pp))));
00786 evalcond[2]=((((-0.720000000000000)*(pz)))+(((-1.00000000000000)*(pp))));
00787 evalcond[3]=((-0.360000000000000)+(((-1.00000000000000)*(x158)))+(((-1.00000000000000)*(pz))));
00788 evalcond[4]=((0.360000000000000)+(x158)+(pz));
00789 if( IKabs(evalcond[0]) < 0.0000010000000000 && IKabs(evalcond[1]) < 0.0000010000000000 && IKabs(evalcond[2]) < 0.0000010000000000 && IKabs(evalcond[3]) < 0.0000010000000000 && IKabs(evalcond[4]) < 0.0000010000000000 )
00790 {
00791 {
00792 IKReal dummyeval[1];
00793 IKReal gconst3;
00794 gconst3=IKsign(((((25.0000000000000)*((px)*(px))))+(((25.0000000000000)*((py)*(py))))));
00795 dummyeval[0]=(((px)*(px))+((py)*(py)));
00796 if( IKabs(dummyeval[0]) < 0.0000010000000000 )
00797 {
00798 continue;
00799
00800 } else
00801 {
00802 {
00803 IKReal j0array[1], cj0array[1], sj0array[1];
00804 bool j0valid[1]={false};
00805 j0array[0]=IKatan2(((gconst3)*(((((9.00000000000000)*(px)*(sj2)*(sj3)))+(((9.00000000000000)*(cj2)*(py)*(sj3)))))), ((gconst3)*(((((9.00000000000000)*(cj2)*(px)*(sj3)))+(((-9.00000000000000)*(py)*(sj2)*(sj3)))))));
00806 sj0array[0]=IKsin(j0array[0]);
00807 cj0array[0]=IKcos(j0array[0]);
00808 if( j0array[0] > IKPI )
00809 {
00810 j0array[0]-=IK2PI;
00811 }
00812 else if( j0array[0] < -IKPI )
00813 { j0array[0]+=IK2PI;
00814 }
00815 j0valid[0] = true;
00816 for(int ij0 = 0; ij0 < 1; ++ij0)
00817 {
00818 if( !j0valid[ij0] )
00819 {
00820 continue;
00821 }
00822 j0 = j0array[ij0]; cj0 = cj0array[ij0]; sj0 = sj0array[ij0];
00823
00824 rotationfunction0(vsolutions);
00825 }
00826 }
00827
00828 }
00829
00830 }
00831
00832 } else
00833 {
00834 if( 1 )
00835 {
00836 continue;
00837
00838 } else
00839 {
00840 }
00841 }
00842 }
00843 }
00844
00845 } else
00846 {
00847 {
00848 IKReal j0array[1], cj0array[1], sj0array[1];
00849 bool j0valid[1]={false};
00850 j0array[0]=IKatan2(((gconst1)*(((((-625.000000000000)*(pp)*(py)))+(((450.000000000000)*(cj1)*(py)*(pz)))+(((-162.000000000000)*(px)*(sj1)*(sj2)*(sj3)))))), ((gconst1)*(((((450.000000000000)*(cj1)*(px)*(pz)))+(((-625.000000000000)*(pp)*(px)))+(((162.000000000000)*(py)*(sj1)*(sj2)*(sj3)))))));
00851 sj0array[0]=IKsin(j0array[0]);
00852 cj0array[0]=IKcos(j0array[0]);
00853 if( j0array[0] > IKPI )
00854 {
00855 j0array[0]-=IK2PI;
00856 }
00857 else if( j0array[0] < -IKPI )
00858 { j0array[0]+=IK2PI;
00859 }
00860 j0valid[0] = true;
00861 for(int ij0 = 0; ij0 < 1; ++ij0)
00862 {
00863 if( !j0valid[ij0] )
00864 {
00865 continue;
00866 }
00867 j0 = j0array[ij0]; cj0 = cj0array[ij0]; sj0 = sj0array[ij0];
00868
00869 rotationfunction0(vsolutions);
00870 }
00871 }
00872
00873 }
00874
00875 }
00876 }
00877 }
00878
00879 }
00880
00881 }
00882
00883 } else
00884 {
00885 {
00886 IKReal j0array[2], cj0array[2], sj0array[2];
00887 bool j0valid[2]={false};
00888 IKReal x159=((-1.00000000000000)*(py));
00889 IKReal x160=IKatan2(x159, px);
00890 IKReal x161=(px)*(px);
00891 IKReal x162=(py)*(py);
00892 IKReal x163=((x162)+(x161));
00893 if( (x163) < (IKReal)-0.00001 )
00894 continue;
00895 IKReal x164=IKsqrt(x163);
00896 IKReal x165=IKabs(x164);
00897 IKReal x166=((IKabs(x165) != 0)?((IKReal)1/(x165)):(IKReal)1.0e30);
00898 IKReal x167=((0.360000000000000)*(sj2)*(sj3)*(x166));
00899 if( (x167) < -1-IKFAST_SINCOS_THRESH || (x167) > 1+IKFAST_SINCOS_THRESH )
00900 continue;
00901 IKReal x168=IKasin(x167);
00902 j0array[0]=((((-1.00000000000000)*(x160)))+(x168));
00903 sj0array[0]=IKsin(j0array[0]);
00904 cj0array[0]=IKcos(j0array[0]);
00905 j0array[1]=((3.14159265358979)+(((-1.00000000000000)*(x168)))+(((-1.00000000000000)*(x160))));
00906 sj0array[1]=IKsin(j0array[1]);
00907 cj0array[1]=IKcos(j0array[1]);
00908 if( j0array[0] > IKPI )
00909 {
00910 j0array[0]-=IK2PI;
00911 }
00912 else if( j0array[0] < -IKPI )
00913 { j0array[0]+=IK2PI;
00914 }
00915 j0valid[0] = true;
00916 if( j0array[1] > IKPI )
00917 {
00918 j0array[1]-=IK2PI;
00919 }
00920 else if( j0array[1] < -IKPI )
00921 { j0array[1]+=IK2PI;
00922 }
00923 j0valid[1] = true;
00924 if( j0valid[0] && j0valid[1] && IKabs(cj0array[0]-cj0array[1]) < 0.0001 && IKabs(sj0array[0]-sj0array[1]) < 0.0001 )
00925 {
00926 j0valid[1]=false;
00927 }
00928 for(int ij0 = 0; ij0 < 2; ++ij0)
00929 {
00930 if( !j0valid[ij0] )
00931 {
00932 continue;
00933 }
00934 j0 = j0array[ij0]; cj0 = cj0array[ij0]; sj0 = sj0array[ij0];
00935
00936 {
00937 IKReal dummyeval[1];
00938 IKReal gconst4;
00939 gconst4=IKsign(((((162.000000000000)*(cj0)*(cj3)*(px)))+(((162.000000000000)*(cj3)*(py)*(sj0)))+(((162.000000000000)*(py)*(sj0)))+(((-162.000000000000)*(cj2)*(pz)*(sj3)))+(((162.000000000000)*(cj0)*(px)))));
00940 dummyeval[0]=((((-1.00000000000000)*(cj2)*(pz)*(sj3)))+(((cj3)*(py)*(sj0)))+(((cj0)*(cj3)*(px)))+(((cj0)*(px)))+(((py)*(sj0))));
00941 if( IKabs(dummyeval[0]) < 0.0000010000000000 )
00942 {
00943 {
00944 IKReal evalcond[5];
00945 evalcond[0]=((-3.14159265358979)+(IKfmod(((1.11022302462516e-16)+(j3)), 6.28318530717959)));
00946 evalcond[1]=((-1.00000000000000)*(pp));
00947 evalcond[2]=((((-1.00000000000000)*(cj0)*(py)))+(((px)*(sj0))));
00948 evalcond[3]=((-1.00000000000000)*(pz));
00949 evalcond[4]=((((cj0)*(px)))+(((py)*(sj0))));
00950 if( IKabs(evalcond[0]) < 0.0000010000000000 && IKabs(evalcond[1]) < 0.0000010000000000 && IKabs(evalcond[2]) < 0.0000010000000000 && IKabs(evalcond[3]) < 0.0000010000000000 && IKabs(evalcond[4]) < 0.0000010000000000 )
00951 {
00952 {
00953 IKReal dummyeval[1];
00954 IKReal gconst5;
00955 gconst5=IKsign(((((-2.00000000000000)*(cj0)*(px)*(py)*(sj0)*(sj2)))+(((-1.00000000000000)*(sj2)*((cj0)*(cj0))*((px)*(px))))+(((-1.00000000000000)*(sj2)*((pz)*(pz))))+(((-1.00000000000000)*(sj2)*((py)*(py))*((sj0)*(sj0))))));
00956 dummyeval[0]=((((-2.00000000000000)*(cj0)*(px)*(py)*(sj0)*(sj2)))+(((-1.00000000000000)*(sj2)*((cj0)*(cj0))*((px)*(px))))+(((-1.00000000000000)*(sj2)*((pz)*(pz))))+(((-1.00000000000000)*(sj2)*((py)*(py))*((sj0)*(sj0)))));
00957 if( IKabs(dummyeval[0]) < 0.0000010000000000 )
00958 {
00959 {
00960 IKReal evalcond[6];
00961 IKReal x169=((cj0)*(py));
00962 IKReal x170=((px)*(sj0));
00963 evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(j2)), 6.28318530717959)));
00964 evalcond[1]=((-1.00000000000000)*(pp));
00965 evalcond[2]=((((-1.00000000000000)*(x169)))+(x170));
00966 evalcond[3]=((-1.00000000000000)*(pz));
00967 evalcond[4]=((((cj0)*(px)))+(((py)*(sj0))));
00968 evalcond[5]=((((-1.00000000000000)*(x170)))+(x169));
00969 if( IKabs(evalcond[0]) < 0.0000010000000000 && IKabs(evalcond[1]) < 0.0000010000000000 && IKabs(evalcond[2]) < 0.0000010000000000 && IKabs(evalcond[3]) < 0.0000010000000000 && IKabs(evalcond[4]) < 0.0000010000000000 && IKabs(evalcond[5]) < 0.0000010000000000 )
00970 {
00971 {
00972 IKReal dummyeval[1];
00973 dummyeval[0]=((((-1.00000000000000)*((cj0)*(cj0))*((px)*(px))))+(((-1.00000000000000)*((pz)*(pz))))+(((-2.00000000000000)*(cj0)*(px)*(py)*(sj0)))+(((-1.00000000000000)*((py)*(py))*((sj0)*(sj0)))));
00974 if( IKabs(dummyeval[0]) < 0.0000010000000000 )
00975 {
00976 continue;
00977
00978 } else
00979 {
00980 {
00981 IKReal j1array[1], cj1array[1], sj1array[1];
00982 bool j1valid[1]={false};
00983 IKReal x171=(pz)*(pz);
00984 IKReal x172=((18.0000000000000)*(x171));
00985 IKReal x173=(cj0)*(cj0);
00986 IKReal x174=(px)*(px);
00987 IKReal x175=((18.0000000000000)*(x173)*(x174));
00988 IKReal x176=(py)*(py);
00989 IKReal x177=(sj0)*(sj0);
00990 IKReal x178=((18.0000000000000)*(x176)*(x177));
00991 IKReal x179=((36.0000000000000)*(cj0)*(px)*(py)*(sj0));
00992 IKReal x180=((x179)+(x178)+(x172)+(x175));
00993 j1array[0]=IKatan2(((-1.00000000000000)*(((IKabs(x180) != 0)?((IKReal)1/(x180)):(IKReal)1.0e30))*(((((-25.0000000000000)*(pp)*(py)*(sj0)))+(((-25.0000000000000)*(cj0)*(pp)*(px)))))), ((25.0000000000000)*(pp)*(pz)*(((IKabs(x180) != 0)?((IKReal)1/(x180)):(IKReal)1.0e30))));
00994 sj1array[0]=IKsin(j1array[0]);
00995 cj1array[0]=IKcos(j1array[0]);
00996 if( j1array[0] > IKPI )
00997 {
00998 j1array[0]-=IK2PI;
00999 }
01000 else if( j1array[0] < -IKPI )
01001 { j1array[0]+=IK2PI;
01002 }
01003 j1valid[0] = true;
01004 for(int ij1 = 0; ij1 < 1; ++ij1)
01005 {
01006 if( !j1valid[ij1] )
01007 {
01008 continue;
01009 }
01010 j1 = j1array[ij1]; cj1 = cj1array[ij1]; sj1 = sj1array[ij1];
01011
01012 rotationfunction0(vsolutions);
01013 }
01014 }
01015
01016 }
01017
01018 }
01019
01020 } else
01021 {
01022 IKReal x181=((px)*(sj0));
01023 IKReal x182=((cj0)*(py));
01024 IKReal x183=((((-1.00000000000000)*(x182)))+(x181));
01025 evalcond[0]=((-3.14159265358979)+(IKfmod(((1.11022302462516e-16)+(j2)), 6.28318530717959)));
01026 evalcond[1]=((-1.00000000000000)*(pp));
01027 evalcond[2]=x183;
01028 evalcond[3]=((-1.00000000000000)*(pz));
01029 evalcond[4]=((((cj0)*(px)))+(((py)*(sj0))));
01030 evalcond[5]=x183;
01031 if( IKabs(evalcond[0]) < 0.0000010000000000 && IKabs(evalcond[1]) < 0.0000010000000000 && IKabs(evalcond[2]) < 0.0000010000000000 && IKabs(evalcond[3]) < 0.0000010000000000 && IKabs(evalcond[4]) < 0.0000010000000000 && IKabs(evalcond[5]) < 0.0000010000000000 )
01032 {
01033 {
01034 IKReal dummyeval[1];
01035 IKReal gconst6;
01036 gconst6=IKsign(((((18.0000000000000)*((pz)*(pz))))+(((18.0000000000000)*((cj0)*(cj0))*((px)*(px))))+(((18.0000000000000)*((py)*(py))*((sj0)*(sj0))))+(((36.0000000000000)*(cj0)*(px)*(py)*(sj0)))));
01037 dummyeval[0]=(((((py)*(py))*((sj0)*(sj0))))+((pz)*(pz))+((((cj0)*(cj0))*((px)*(px))))+(((2.00000000000000)*(cj0)*(px)*(py)*(sj0))));
01038 if( IKabs(dummyeval[0]) < 0.0000010000000000 )
01039 {
01040 continue;
01041
01042 } else
01043 {
01044 {
01045 IKReal j1array[1], cj1array[1], sj1array[1];
01046 bool j1valid[1]={false};
01047 j1array[0]=IKatan2(((gconst6)*(((((25.0000000000000)*(pp)*(py)*(sj0)))+(((25.0000000000000)*(cj0)*(pp)*(px)))))), ((25.0000000000000)*(gconst6)*(pp)*(pz)));
01048 sj1array[0]=IKsin(j1array[0]);
01049 cj1array[0]=IKcos(j1array[0]);
01050 if( j1array[0] > IKPI )
01051 {
01052 j1array[0]-=IK2PI;
01053 }
01054 else if( j1array[0] < -IKPI )
01055 { j1array[0]+=IK2PI;
01056 }
01057 j1valid[0] = true;
01058 for(int ij1 = 0; ij1 < 1; ++ij1)
01059 {
01060 if( !j1valid[ij1] )
01061 {
01062 continue;
01063 }
01064 j1 = j1array[ij1]; cj1 = cj1array[ij1]; sj1 = sj1array[ij1];
01065
01066 rotationfunction0(vsolutions);
01067 }
01068 }
01069
01070 }
01071
01072 }
01073
01074 } else
01075 {
01076 if( 1 )
01077 {
01078 continue;
01079
01080 } else
01081 {
01082 }
01083 }
01084 }
01085 }
01086
01087 } else
01088 {
01089 {
01090 IKReal j1array[1], cj1array[1], sj1array[1];
01091 bool j1valid[1]={false};
01092 j1array[0]=IKatan2(((gconst5)*(((((-1.00000000000000)*(cj2)*(px)*(pz)*(sj0)))+(((cj0)*(cj2)*(py)*(pz)))))), ((gconst5)*(((((-1.00000000000000)*(cj0)*(cj2)*(sj0)*((py)*(py))))+(((cj2)*(px)*(py)*((sj0)*(sj0))))+(((cj0)*(cj2)*(sj0)*((px)*(px))))+(((-1.00000000000000)*(cj2)*(px)*(py)*((cj0)*(cj0))))))));
01093 sj1array[0]=IKsin(j1array[0]);
01094 cj1array[0]=IKcos(j1array[0]);
01095 if( j1array[0] > IKPI )
01096 {
01097 j1array[0]-=IK2PI;
01098 }
01099 else if( j1array[0] < -IKPI )
01100 { j1array[0]+=IK2PI;
01101 }
01102 j1valid[0] = true;
01103 for(int ij1 = 0; ij1 < 1; ++ij1)
01104 {
01105 if( !j1valid[ij1] )
01106 {
01107 continue;
01108 }
01109 j1 = j1array[ij1]; cj1 = cj1array[ij1]; sj1 = sj1array[ij1];
01110
01111 rotationfunction0(vsolutions);
01112 }
01113 }
01114
01115 }
01116
01117 }
01118
01119 } else
01120 {
01121 if( 1 )
01122 {
01123 continue;
01124
01125 } else
01126 {
01127 }
01128 }
01129 }
01130
01131 } else
01132 {
01133 {
01134 IKReal j1array[1], cj1array[1], sj1array[1];
01135 bool j1valid[1]={false};
01136 j1array[0]=IKatan2(((gconst4)*(((((225.000000000000)*(cj3)*(pp)))+(((-450.000000000000)*((pz)*(pz))))+(((225.000000000000)*(pp)))))), ((gconst4)*(((((450.000000000000)*(cj0)*(px)*(pz)))+(((-225.000000000000)*(cj2)*(pp)*(sj3)))+(((450.000000000000)*(py)*(pz)*(sj0)))))));
01137 sj1array[0]=IKsin(j1array[0]);
01138 cj1array[0]=IKcos(j1array[0]);
01139 if( j1array[0] > IKPI )
01140 {
01141 j1array[0]-=IK2PI;
01142 }
01143 else if( j1array[0] < -IKPI )
01144 { j1array[0]+=IK2PI;
01145 }
01146 j1valid[0] = true;
01147 for(int ij1 = 0; ij1 < 1; ++ij1)
01148 {
01149 if( !j1valid[ij1] )
01150 {
01151 continue;
01152 }
01153 j1 = j1array[ij1]; cj1 = cj1array[ij1]; sj1 = sj1array[ij1];
01154
01155 rotationfunction0(vsolutions);
01156 }
01157 }
01158
01159 }
01160
01161 }
01162 }
01163 }
01164
01165 }
01166
01167 }
01168
01169 } else
01170 {
01171 {
01172 IKReal j0array[1], cj0array[1], sj0array[1];
01173 bool j0valid[1]={false};
01174 IKReal x184=(py)*(py);
01175 IKReal x185=(sj2)*(sj2);
01176 IKReal x186=(cj2)*(cj2);
01177 j0array[0]=IKatan2(((gconst0)*(((((9.00000000000000)*(sj2)*(sj3)*(((((-1.00000000000000)*(x184)*(x185)))+(((-1.00000000000000)*(x184)*(x186)))))))+(((9.00000000000000)*(sj2)*(sj3)*(x184)))))), ((gconst0)*(((((-9.00000000000000)*(sj2)*(sj3)*(((((px)*(py)*(x185)))+(((px)*(py)*(x186)))))))+(((9.00000000000000)*(px)*(py)*(sj2)*(sj3)))))));
01178 sj0array[0]=IKsin(j0array[0]);
01179 cj0array[0]=IKcos(j0array[0]);
01180 if( j0array[0] > IKPI )
01181 {
01182 j0array[0]-=IK2PI;
01183 }
01184 else if( j0array[0] < -IKPI )
01185 { j0array[0]+=IK2PI;
01186 }
01187 j0valid[0] = true;
01188 for(int ij0 = 0; ij0 < 1; ++ij0)
01189 {
01190 if( !j0valid[ij0] )
01191 {
01192 continue;
01193 }
01194 j0 = j0array[ij0]; cj0 = cj0array[ij0]; sj0 = sj0array[ij0];
01195
01196 {
01197 IKReal dummyeval[1];
01198 IKReal gconst4;
01199 gconst4=IKsign(((((162.000000000000)*(cj0)*(cj3)*(px)))+(((162.000000000000)*(cj3)*(py)*(sj0)))+(((162.000000000000)*(py)*(sj0)))+(((-162.000000000000)*(cj2)*(pz)*(sj3)))+(((162.000000000000)*(cj0)*(px)))));
01200 dummyeval[0]=((((-1.00000000000000)*(cj2)*(pz)*(sj3)))+(((cj3)*(py)*(sj0)))+(((cj0)*(cj3)*(px)))+(((cj0)*(px)))+(((py)*(sj0))));
01201 if( IKabs(dummyeval[0]) < 0.0000010000000000 )
01202 {
01203 {
01204 IKReal evalcond[5];
01205 evalcond[0]=((-3.14159265358979)+(IKfmod(((1.11022302462516e-16)+(j3)), 6.28318530717959)));
01206 evalcond[1]=((-1.00000000000000)*(pp));
01207 evalcond[2]=((((-1.00000000000000)*(cj0)*(py)))+(((px)*(sj0))));
01208 evalcond[3]=((-1.00000000000000)*(pz));
01209 evalcond[4]=((((cj0)*(px)))+(((py)*(sj0))));
01210 if( IKabs(evalcond[0]) < 0.0000010000000000 && IKabs(evalcond[1]) < 0.0000010000000000 && IKabs(evalcond[2]) < 0.0000010000000000 && IKabs(evalcond[3]) < 0.0000010000000000 && IKabs(evalcond[4]) < 0.0000010000000000 )
01211 {
01212 {
01213 IKReal dummyeval[1];
01214 IKReal gconst5;
01215 gconst5=IKsign(((((-2.00000000000000)*(cj0)*(px)*(py)*(sj0)*(sj2)))+(((-1.00000000000000)*(sj2)*((cj0)*(cj0))*((px)*(px))))+(((-1.00000000000000)*(sj2)*((pz)*(pz))))+(((-1.00000000000000)*(sj2)*((py)*(py))*((sj0)*(sj0))))));
01216 dummyeval[0]=((((-2.00000000000000)*(cj0)*(px)*(py)*(sj0)*(sj2)))+(((-1.00000000000000)*(sj2)*((cj0)*(cj0))*((px)*(px))))+(((-1.00000000000000)*(sj2)*((pz)*(pz))))+(((-1.00000000000000)*(sj2)*((py)*(py))*((sj0)*(sj0)))));
01217 if( IKabs(dummyeval[0]) < 0.0000010000000000 )
01218 {
01219 {
01220 IKReal evalcond[6];
01221 IKReal x187=((cj0)*(py));
01222 IKReal x188=((px)*(sj0));
01223 evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(j2)), 6.28318530717959)));
01224 evalcond[1]=((-1.00000000000000)*(pp));
01225 evalcond[2]=((((-1.00000000000000)*(x187)))+(x188));
01226 evalcond[3]=((-1.00000000000000)*(pz));
01227 evalcond[4]=((((cj0)*(px)))+(((py)*(sj0))));
01228 evalcond[5]=((((-1.00000000000000)*(x188)))+(x187));
01229 if( IKabs(evalcond[0]) < 0.0000010000000000 && IKabs(evalcond[1]) < 0.0000010000000000 && IKabs(evalcond[2]) < 0.0000010000000000 && IKabs(evalcond[3]) < 0.0000010000000000 && IKabs(evalcond[4]) < 0.0000010000000000 && IKabs(evalcond[5]) < 0.0000010000000000 )
01230 {
01231 {
01232 IKReal dummyeval[1];
01233 dummyeval[0]=((((-1.00000000000000)*((cj0)*(cj0))*((px)*(px))))+(((-1.00000000000000)*((pz)*(pz))))+(((-2.00000000000000)*(cj0)*(px)*(py)*(sj0)))+(((-1.00000000000000)*((py)*(py))*((sj0)*(sj0)))));
01234 if( IKabs(dummyeval[0]) < 0.0000010000000000 )
01235 {
01236 continue;
01237
01238 } else
01239 {
01240 {
01241 IKReal j1array[1], cj1array[1], sj1array[1];
01242 bool j1valid[1]={false};
01243 IKReal x189=(pz)*(pz);
01244 IKReal x190=((18.0000000000000)*(x189));
01245 IKReal x191=(cj0)*(cj0);
01246 IKReal x192=(px)*(px);
01247 IKReal x193=((18.0000000000000)*(x191)*(x192));
01248 IKReal x194=(py)*(py);
01249 IKReal x195=(sj0)*(sj0);
01250 IKReal x196=((18.0000000000000)*(x194)*(x195));
01251 IKReal x197=((36.0000000000000)*(cj0)*(px)*(py)*(sj0));
01252 IKReal x198=((x193)+(x190)+(x197)+(x196));
01253 j1array[0]=IKatan2(((-1.00000000000000)*(((IKabs(x198) != 0)?((IKReal)1/(x198)):(IKReal)1.0e30))*(((((-25.0000000000000)*(pp)*(py)*(sj0)))+(((-25.0000000000000)*(cj0)*(pp)*(px)))))), ((25.0000000000000)*(pp)*(pz)*(((IKabs(x198) != 0)?((IKReal)1/(x198)):(IKReal)1.0e30))));
01254 sj1array[0]=IKsin(j1array[0]);
01255 cj1array[0]=IKcos(j1array[0]);
01256 if( j1array[0] > IKPI )
01257 {
01258 j1array[0]-=IK2PI;
01259 }
01260 else if( j1array[0] < -IKPI )
01261 { j1array[0]+=IK2PI;
01262 }
01263 j1valid[0] = true;
01264 for(int ij1 = 0; ij1 < 1; ++ij1)
01265 {
01266 if( !j1valid[ij1] )
01267 {
01268 continue;
01269 }
01270 j1 = j1array[ij1]; cj1 = cj1array[ij1]; sj1 = sj1array[ij1];
01271
01272 rotationfunction0(vsolutions);
01273 }
01274 }
01275
01276 }
01277
01278 }
01279
01280 } else
01281 {
01282 IKReal x199=((px)*(sj0));
01283 IKReal x200=((cj0)*(py));
01284 IKReal x201=((x199)+(((-1.00000000000000)*(x200))));
01285 evalcond[0]=((-3.14159265358979)+(IKfmod(((1.11022302462516e-16)+(j2)), 6.28318530717959)));
01286 evalcond[1]=((-1.00000000000000)*(pp));
01287 evalcond[2]=x201;
01288 evalcond[3]=((-1.00000000000000)*(pz));
01289 evalcond[4]=((((cj0)*(px)))+(((py)*(sj0))));
01290 evalcond[5]=x201;
01291 if( IKabs(evalcond[0]) < 0.0000010000000000 && IKabs(evalcond[1]) < 0.0000010000000000 && IKabs(evalcond[2]) < 0.0000010000000000 && IKabs(evalcond[3]) < 0.0000010000000000 && IKabs(evalcond[4]) < 0.0000010000000000 && IKabs(evalcond[5]) < 0.0000010000000000 )
01292 {
01293 {
01294 IKReal dummyeval[1];
01295 IKReal gconst6;
01296 gconst6=IKsign(((((18.0000000000000)*((pz)*(pz))))+(((18.0000000000000)*((cj0)*(cj0))*((px)*(px))))+(((18.0000000000000)*((py)*(py))*((sj0)*(sj0))))+(((36.0000000000000)*(cj0)*(px)*(py)*(sj0)))));
01297 dummyeval[0]=(((((py)*(py))*((sj0)*(sj0))))+((pz)*(pz))+((((cj0)*(cj0))*((px)*(px))))+(((2.00000000000000)*(cj0)*(px)*(py)*(sj0))));
01298 if( IKabs(dummyeval[0]) < 0.0000010000000000 )
01299 {
01300 continue;
01301
01302 } else
01303 {
01304 {
01305 IKReal j1array[1], cj1array[1], sj1array[1];
01306 bool j1valid[1]={false};
01307 j1array[0]=IKatan2(((gconst6)*(((((25.0000000000000)*(pp)*(py)*(sj0)))+(((25.0000000000000)*(cj0)*(pp)*(px)))))), ((25.0000000000000)*(gconst6)*(pp)*(pz)));
01308 sj1array[0]=IKsin(j1array[0]);
01309 cj1array[0]=IKcos(j1array[0]);
01310 if( j1array[0] > IKPI )
01311 {
01312 j1array[0]-=IK2PI;
01313 }
01314 else if( j1array[0] < -IKPI )
01315 { j1array[0]+=IK2PI;
01316 }
01317 j1valid[0] = true;
01318 for(int ij1 = 0; ij1 < 1; ++ij1)
01319 {
01320 if( !j1valid[ij1] )
01321 {
01322 continue;
01323 }
01324 j1 = j1array[ij1]; cj1 = cj1array[ij1]; sj1 = sj1array[ij1];
01325
01326 rotationfunction0(vsolutions);
01327 }
01328 }
01329
01330 }
01331
01332 }
01333
01334 } else
01335 {
01336 if( 1 )
01337 {
01338 continue;
01339
01340 } else
01341 {
01342 }
01343 }
01344 }
01345 }
01346
01347 } else
01348 {
01349 {
01350 IKReal j1array[1], cj1array[1], sj1array[1];
01351 bool j1valid[1]={false};
01352 j1array[0]=IKatan2(((gconst5)*(((((-1.00000000000000)*(cj2)*(px)*(pz)*(sj0)))+(((cj0)*(cj2)*(py)*(pz)))))), ((gconst5)*(((((-1.00000000000000)*(cj0)*(cj2)*(sj0)*((py)*(py))))+(((cj2)*(px)*(py)*((sj0)*(sj0))))+(((cj0)*(cj2)*(sj0)*((px)*(px))))+(((-1.00000000000000)*(cj2)*(px)*(py)*((cj0)*(cj0))))))));
01353 sj1array[0]=IKsin(j1array[0]);
01354 cj1array[0]=IKcos(j1array[0]);
01355 if( j1array[0] > IKPI )
01356 {
01357 j1array[0]-=IK2PI;
01358 }
01359 else if( j1array[0] < -IKPI )
01360 { j1array[0]+=IK2PI;
01361 }
01362 j1valid[0] = true;
01363 for(int ij1 = 0; ij1 < 1; ++ij1)
01364 {
01365 if( !j1valid[ij1] )
01366 {
01367 continue;
01368 }
01369 j1 = j1array[ij1]; cj1 = cj1array[ij1]; sj1 = sj1array[ij1];
01370
01371 rotationfunction0(vsolutions);
01372 }
01373 }
01374
01375 }
01376
01377 }
01378
01379 } else
01380 {
01381 if( 1 )
01382 {
01383 continue;
01384
01385 } else
01386 {
01387 }
01388 }
01389 }
01390
01391 } else
01392 {
01393 {
01394 IKReal j1array[1], cj1array[1], sj1array[1];
01395 bool j1valid[1]={false};
01396 j1array[0]=IKatan2(((gconst4)*(((((225.000000000000)*(cj3)*(pp)))+(((-450.000000000000)*((pz)*(pz))))+(((225.000000000000)*(pp)))))), ((gconst4)*(((((450.000000000000)*(cj0)*(px)*(pz)))+(((-225.000000000000)*(cj2)*(pp)*(sj3)))+(((450.000000000000)*(py)*(pz)*(sj0)))))));
01397 sj1array[0]=IKsin(j1array[0]);
01398 cj1array[0]=IKcos(j1array[0]);
01399 if( j1array[0] > IKPI )
01400 {
01401 j1array[0]-=IK2PI;
01402 }
01403 else if( j1array[0] < -IKPI )
01404 { j1array[0]+=IK2PI;
01405 }
01406 j1valid[0] = true;
01407 for(int ij1 = 0; ij1 < 1; ++ij1)
01408 {
01409 if( !j1valid[ij1] )
01410 {
01411 continue;
01412 }
01413 j1 = j1array[ij1]; cj1 = cj1array[ij1]; sj1 = sj1array[ij1];
01414
01415 rotationfunction0(vsolutions);
01416 }
01417 }
01418
01419 }
01420
01421 }
01422 }
01423 }
01424
01425 }
01426
01427 }
01428 }
01429 }
01430 }
01431 return vsolutions.size()>0;
01432 }
01433 inline void rotationfunction0(std::vector<IKSolution>& vsolutions) {
01434 for(int rotationiter = 0; rotationiter < 1; ++rotationiter) {
01435 IKReal x91=((sj1)*(sj3));
01436 IKReal x92=((cj1)*(cj2)*(cj3));
01437 IKReal x93=((x91)+(x92));
01438 IKReal x94=((cj0)*(cj3)*(sj2));
01439 IKReal x95=((sj0)*(x93));
01440 IKReal x96=((x95)+(x94));
01441 IKReal x97=((cj0)*(x93));
01442 IKReal x98=((cj3)*(sj0)*(sj2));
01443 IKReal x99=((x97)+(((-1.00000000000000)*(x98))));
01444 IKReal x100=((cj1)*(sj3));
01445 IKReal x101=((cj2)*(cj3)*(sj1));
01446 IKReal x102=((((-1.00000000000000)*(x101)))+(x100));
01447 IKReal x103=((cj2)*(sj0));
01448 IKReal x104=((cj0)*(cj1)*(sj2));
01449 IKReal x105=((x104)+(x103));
01450 IKReal x106=((cj1)*(sj0)*(sj2));
01451 IKReal x107=((cj0)*(cj2));
01452 IKReal x108=((((-1.00000000000000)*(x107)))+(x106));
01453 IKReal x109=((cj2)*(x100));
01454 IKReal x110=((cj3)*(sj1));
01455 IKReal x111=((((-1.00000000000000)*(x110)))+(x109));
01456 IKReal x112=((cj1)*(cj3));
01457 IKReal x113=((cj2)*(x91));
01458 IKReal x114=((x113)+(x112));
01459 IKReal x115=((-1.00000000000000)*(x114));
01460 IKReal x116=((sj0)*(x111));
01461 IKReal x117=((cj0)*(sj2)*(sj3));
01462 IKReal x118=((x117)+(x116));
01463 IKReal x119=((cj0)*(x111));
01464 IKReal x120=((-1.00000000000000)*(sj0)*(sj2)*(sj3));
01465 IKReal x121=((x120)+(x119));
01466 new_r00=((((r10)*(x96)))+(((r00)*(x99)))+(((r20)*(x102))));
01467 new_r01=((((r11)*(x96)))+(((r21)*(x102)))+(((r01)*(x99))));
01468 new_r02=((((r12)*(x96)))+(((r22)*(x102)))+(((r02)*(x99))));
01469 new_r10=((((r10)*(x108)))+(((-1.00000000000000)*(r20)*(sj1)*(sj2)))+(((r00)*(x105))));
01470 new_r11=((((-1.00000000000000)*(r21)*(sj1)*(sj2)))+(((r01)*(x105)))+(((r11)*(x108))));
01471 new_r12=((((r02)*(x105)))+(((r12)*(x108)))+(((-1.00000000000000)*(r22)*(sj1)*(sj2))));
01472 new_r20=((((r10)*(x118)))+(((r00)*(x121)))+(((r20)*(x115))));
01473 new_r21=((((r01)*(x121)))+(((r21)*(x115)))+(((r11)*(x118))));
01474 new_r22=((((r22)*(x115)))+(((r02)*(x121)))+(((r12)*(x118))));
01475 {
01476 IKReal j5array[2], cj5array[2], sj5array[2];
01477 bool j5valid[2]={false};
01478 cj5array[0]=new_r22;
01479 if( cj5array[0] >= -1-IKFAST_SINCOS_THRESH && cj5array[0] <= 1+IKFAST_SINCOS_THRESH )
01480 {
01481 j5valid[0] = j5valid[1] = true;
01482 j5array[0] = IKacos(cj5array[0]);
01483 sj5array[0] = IKsin(j5array[0]);
01484 cj5array[1] = cj5array[0];
01485 j5array[1] = -j5array[0];
01486 sj5array[1] = -sj5array[0];
01487 }
01488 else if( isnan(cj5array[0]) )
01489 {
01490
01491 j5valid[0] = true;
01492 cj5array[0] = 1; sj5array[0] = 0; j5array[0] = 0;
01493 }
01494 if( j5valid[0] && j5valid[1] && IKabs(cj5array[0]-cj5array[1]) < 0.0001 && IKabs(sj5array[0]-sj5array[1]) < 0.0001 )
01495 {
01496 j5valid[1]=false;
01497 }
01498 for(int ij5 = 0; ij5 < 2; ++ij5)
01499 {
01500 if( !j5valid[ij5] )
01501 {
01502 continue;
01503 }
01504 j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5];
01505
01506 {
01507 IKReal dummyeval[1];
01508 IKReal gconst10;
01509 gconst10=IKsign(sj5);
01510 dummyeval[0]=sj5;
01511 if( IKabs(dummyeval[0]) < 0.0000010000000000 )
01512 {
01513 {
01514 IKReal dummyeval[1];
01515 IKReal gconst9;
01516 gconst9=IKsign((((new_r12)*(new_r12))+((new_r02)*(new_r02))));
01517 dummyeval[0]=(((new_r12)*(new_r12))+((new_r02)*(new_r02)));
01518 if( IKabs(dummyeval[0]) < 0.0000010000000000 )
01519 {
01520 {
01521 IKReal evalcond[7];
01522 evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(j5)), 6.28318530717959)));
01523 evalcond[1]=((-1.00000000000000)+(new_r22));
01524 evalcond[2]=new_r20;
01525 evalcond[3]=new_r21;
01526 evalcond[4]=((-1.00000000000000)*(new_r20));
01527 evalcond[5]=((-1.00000000000000)*(new_r21));
01528 evalcond[6]=((1.00000000000000)+(((-1.00000000000000)*(new_r22))));
01529 if( IKabs(evalcond[0]) < 0.0000010000000000 && IKabs(evalcond[1]) < 0.0000010000000000 && IKabs(evalcond[2]) < 0.0000010000000000 && IKabs(evalcond[3]) < 0.0000010000000000 && IKabs(evalcond[4]) < 0.0000010000000000 && IKabs(evalcond[5]) < 0.0000010000000000 && IKabs(evalcond[6]) < 0.0000010000000000 )
01530 {
01531 {
01532 IKReal j4array[2], cj4array[2], sj4array[2];
01533 bool j4valid[2]={false};
01534 IKReal x122=IKatan2(new_r02, new_r12);
01535 j4array[0]=((-1.00000000000000)*(x122));
01536 sj4array[0]=IKsin(j4array[0]);
01537 cj4array[0]=IKcos(j4array[0]);
01538 j4array[1]=((3.14159265358979)+(((-1.00000000000000)*(x122))));
01539 sj4array[1]=IKsin(j4array[1]);
01540 cj4array[1]=IKcos(j4array[1]);
01541 if( j4array[0] > IKPI )
01542 {
01543 j4array[0]-=IK2PI;
01544 }
01545 else if( j4array[0] < -IKPI )
01546 { j4array[0]+=IK2PI;
01547 }
01548 j4valid[0] = true;
01549 if( j4array[1] > IKPI )
01550 {
01551 j4array[1]-=IK2PI;
01552 }
01553 else if( j4array[1] < -IKPI )
01554 { j4array[1]+=IK2PI;
01555 }
01556 j4valid[1] = true;
01557 if( j4valid[0] && j4valid[1] && IKabs(cj4array[0]-cj4array[1]) < 0.0001 && IKabs(sj4array[0]-sj4array[1]) < 0.0001 )
01558 {
01559 j4valid[1]=false;
01560 }
01561 for(int ij4 = 0; ij4 < 2; ++ij4)
01562 {
01563 if( !j4valid[ij4] )
01564 {
01565 continue;
01566 }
01567 j4 = j4array[ij4]; cj4 = cj4array[ij4]; sj4 = sj4array[ij4];
01568
01569 {
01570 IKReal j6array[1], cj6array[1], sj6array[1];
01571 bool j6valid[1]={false};
01572 j6array[0]=IKatan2(((((-1.00000000000000)*(cj4)*(new_r01)))+(((-1.00000000000000)*(new_r11)*(sj4)))), ((((cj4)*(new_r00)))+(((new_r10)*(sj4)))));
01573 sj6array[0]=IKsin(j6array[0]);
01574 cj6array[0]=IKcos(j6array[0]);
01575 if( j6array[0] > IKPI )
01576 {
01577 j6array[0]-=IK2PI;
01578 }
01579 else if( j6array[0] < -IKPI )
01580 { j6array[0]+=IK2PI;
01581 }
01582 j6valid[0] = true;
01583 for(int ij6 = 0; ij6 < 1; ++ij6)
01584 {
01585 if( !j6valid[ij6] )
01586 {
01587 continue;
01588 }
01589 j6 = j6array[ij6]; cj6 = cj6array[ij6]; sj6 = sj6array[ij6];
01590
01591 {
01592 vsolutions.push_back(IKSolution()); IKSolution& solution = vsolutions.back();
01593 solution.basesol.resize(7);
01594 solution.basesol[0].foffset = j0;
01595 solution.basesol[1].foffset = j1;
01596 solution.basesol[2].foffset = j2;
01597 solution.basesol[3].foffset = j3;
01598 solution.basesol[4].foffset = j4;
01599 solution.basesol[5].foffset = j5;
01600 solution.basesol[6].foffset = j6;
01601 solution.vfree.resize(0);
01602 }
01603 }
01604 }
01605 }
01606 }
01607
01608 } else
01609 {
01610 IKReal x123=((1.00000000000000)+(new_r22));
01611 evalcond[0]=((-3.14159265358979)+(IKfmod(((1.11022302462516e-16)+(j5)), 6.28318530717959)));
01612 evalcond[1]=x123;
01613 evalcond[2]=new_r20;
01614 evalcond[3]=new_r21;
01615 evalcond[4]=new_r20;
01616 evalcond[5]=new_r21;
01617 evalcond[6]=x123;
01618 if( IKabs(evalcond[0]) < 0.0000010000000000 && IKabs(evalcond[1]) < 0.0000010000000000 && IKabs(evalcond[2]) < 0.0000010000000000 && IKabs(evalcond[3]) < 0.0000010000000000 && IKabs(evalcond[4]) < 0.0000010000000000 && IKabs(evalcond[5]) < 0.0000010000000000 && IKabs(evalcond[6]) < 0.0000010000000000 )
01619 {
01620 {
01621 IKReal j4array[2], cj4array[2], sj4array[2];
01622 bool j4valid[2]={false};
01623 IKReal x124=IKatan2(new_r02, new_r12);
01624 j4array[0]=((-1.00000000000000)*(x124));
01625 sj4array[0]=IKsin(j4array[0]);
01626 cj4array[0]=IKcos(j4array[0]);
01627 j4array[1]=((3.14159265358979)+(((-1.00000000000000)*(x124))));
01628 sj4array[1]=IKsin(j4array[1]);
01629 cj4array[1]=IKcos(j4array[1]);
01630 if( j4array[0] > IKPI )
01631 {
01632 j4array[0]-=IK2PI;
01633 }
01634 else if( j4array[0] < -IKPI )
01635 { j4array[0]+=IK2PI;
01636 }
01637 j4valid[0] = true;
01638 if( j4array[1] > IKPI )
01639 {
01640 j4array[1]-=IK2PI;
01641 }
01642 else if( j4array[1] < -IKPI )
01643 { j4array[1]+=IK2PI;
01644 }
01645 j4valid[1] = true;
01646 if( j4valid[0] && j4valid[1] && IKabs(cj4array[0]-cj4array[1]) < 0.0001 && IKabs(sj4array[0]-sj4array[1]) < 0.0001 )
01647 {
01648 j4valid[1]=false;
01649 }
01650 for(int ij4 = 0; ij4 < 2; ++ij4)
01651 {
01652 if( !j4valid[ij4] )
01653 {
01654 continue;
01655 }
01656 j4 = j4array[ij4]; cj4 = cj4array[ij4]; sj4 = sj4array[ij4];
01657
01658 {
01659 IKReal j6array[1], cj6array[1], sj6array[1];
01660 bool j6valid[1]={false};
01661 j6array[0]=IKatan2(((((cj4)*(new_r01)))+(((new_r11)*(sj4)))), ((((-1.00000000000000)*(new_r10)*(sj4)))+(((-1.00000000000000)*(cj4)*(new_r00)))));
01662 sj6array[0]=IKsin(j6array[0]);
01663 cj6array[0]=IKcos(j6array[0]);
01664 if( j6array[0] > IKPI )
01665 {
01666 j6array[0]-=IK2PI;
01667 }
01668 else if( j6array[0] < -IKPI )
01669 { j6array[0]+=IK2PI;
01670 }
01671 j6valid[0] = true;
01672 for(int ij6 = 0; ij6 < 1; ++ij6)
01673 {
01674 if( !j6valid[ij6] )
01675 {
01676 continue;
01677 }
01678 j6 = j6array[ij6]; cj6 = cj6array[ij6]; sj6 = sj6array[ij6];
01679
01680 {
01681 vsolutions.push_back(IKSolution()); IKSolution& solution = vsolutions.back();
01682 solution.basesol.resize(7);
01683 solution.basesol[0].foffset = j0;
01684 solution.basesol[1].foffset = j1;
01685 solution.basesol[2].foffset = j2;
01686 solution.basesol[3].foffset = j3;
01687 solution.basesol[4].foffset = j4;
01688 solution.basesol[5].foffset = j5;
01689 solution.basesol[6].foffset = j6;
01690 solution.vfree.resize(0);
01691 }
01692 }
01693 }
01694 }
01695 }
01696
01697 } else
01698 {
01699 if( 1 )
01700 {
01701 continue;
01702
01703 } else
01704 {
01705 }
01706 }
01707 }
01708 }
01709
01710 } else
01711 {
01712 {
01713 IKReal j4array[1], cj4array[1], sj4array[1];
01714 bool j4valid[1]={false};
01715 j4array[0]=IKatan2(((gconst9)*(new_r12)*(sj5)), ((gconst9)*(new_r02)*(sj5)));
01716 sj4array[0]=IKsin(j4array[0]);
01717 cj4array[0]=IKcos(j4array[0]);
01718 if( j4array[0] > IKPI )
01719 {
01720 j4array[0]-=IK2PI;
01721 }
01722 else if( j4array[0] < -IKPI )
01723 { j4array[0]+=IK2PI;
01724 }
01725 j4valid[0] = true;
01726 for(int ij4 = 0; ij4 < 1; ++ij4)
01727 {
01728 if( !j4valid[ij4] )
01729 {
01730 continue;
01731 }
01732 j4 = j4array[ij4]; cj4 = cj4array[ij4]; sj4 = sj4array[ij4];
01733
01734 {
01735 IKReal dummyeval[1];
01736 IKReal gconst11;
01737 gconst11=IKsign(sj5);
01738 dummyeval[0]=sj5;
01739 if( IKabs(dummyeval[0]) < 0.0000010000000000 )
01740 {
01741 {
01742 IKReal evalcond[11];
01743 IKReal x125=((cj4)*(new_r12));
01744 IKReal x126=((new_r02)*(sj4));
01745 IKReal x127=((((-1.00000000000000)*(x126)))+(x125));
01746 IKReal x128=((new_r12)*(sj4));
01747 IKReal x129=((cj4)*(new_r02));
01748 IKReal x130=((x128)+(x129));
01749 evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(j5)), 6.28318530717959)));
01750 evalcond[1]=((-1.00000000000000)+(new_r22));
01751 evalcond[2]=new_r20;
01752 evalcond[3]=new_r21;
01753 evalcond[4]=x127;
01754 evalcond[5]=x127;
01755 evalcond[6]=x130;
01756 evalcond[7]=x130;
01757 evalcond[8]=((-1.00000000000000)*(new_r20));
01758 evalcond[9]=((-1.00000000000000)*(new_r21));
01759 evalcond[10]=((1.00000000000000)+(((-1.00000000000000)*(new_r22))));
01760 if( IKabs(evalcond[0]) < 0.0000010000000000 && IKabs(evalcond[1]) < 0.0000010000000000 && IKabs(evalcond[2]) < 0.0000010000000000 && IKabs(evalcond[3]) < 0.0000010000000000 && IKabs(evalcond[4]) < 0.0000010000000000 && IKabs(evalcond[5]) < 0.0000010000000000 && IKabs(evalcond[6]) < 0.0000010000000000 && IKabs(evalcond[7]) < 0.0000010000000000 && IKabs(evalcond[8]) < 0.0000010000000000 && IKabs(evalcond[9]) < 0.0000010000000000 && IKabs(evalcond[10]) < 0.0000010000000000 )
01761 {
01762 {
01763 IKReal j6array[1], cj6array[1], sj6array[1];
01764 bool j6valid[1]={false};
01765 j6array[0]=IKatan2(((((-1.00000000000000)*(cj4)*(new_r01)))+(((-1.00000000000000)*(new_r11)*(sj4)))), ((((cj4)*(new_r00)))+(((new_r10)*(sj4)))));
01766 sj6array[0]=IKsin(j6array[0]);
01767 cj6array[0]=IKcos(j6array[0]);
01768 if( j6array[0] > IKPI )
01769 {
01770 j6array[0]-=IK2PI;
01771 }
01772 else if( j6array[0] < -IKPI )
01773 { j6array[0]+=IK2PI;
01774 }
01775 j6valid[0] = true;
01776 for(int ij6 = 0; ij6 < 1; ++ij6)
01777 {
01778 if( !j6valid[ij6] )
01779 {
01780 continue;
01781 }
01782 j6 = j6array[ij6]; cj6 = cj6array[ij6]; sj6 = sj6array[ij6];
01783
01784 {
01785 vsolutions.push_back(IKSolution()); IKSolution& solution = vsolutions.back();
01786 solution.basesol.resize(7);
01787 solution.basesol[0].foffset = j0;
01788 solution.basesol[1].foffset = j1;
01789 solution.basesol[2].foffset = j2;
01790 solution.basesol[3].foffset = j3;
01791 solution.basesol[4].foffset = j4;
01792 solution.basesol[5].foffset = j5;
01793 solution.basesol[6].foffset = j6;
01794 solution.vfree.resize(0);
01795 }
01796 }
01797 }
01798
01799 } else
01800 {
01801 IKReal x131=((cj4)*(new_r12));
01802 IKReal x132=((new_r02)*(sj4));
01803 IKReal x133=((x131)+(((-1.00000000000000)*(x132))));
01804 IKReal x134=((new_r12)*(sj4));
01805 IKReal x135=((cj4)*(new_r02));
01806 IKReal x136=((x135)+(x134));
01807 IKReal x137=((1.00000000000000)+(new_r22));
01808 evalcond[0]=((-3.14159265358979)+(IKfmod(((1.11022302462516e-16)+(j5)), 6.28318530717959)));
01809 evalcond[1]=x137;
01810 evalcond[2]=new_r20;
01811 evalcond[3]=new_r21;
01812 evalcond[4]=x133;
01813 evalcond[5]=x133;
01814 evalcond[6]=x136;
01815 evalcond[7]=((-1.00000000000000)*(x136));
01816 evalcond[8]=new_r20;
01817 evalcond[9]=new_r21;
01818 evalcond[10]=x137;
01819 if( IKabs(evalcond[0]) < 0.0000010000000000 && IKabs(evalcond[1]) < 0.0000010000000000 && IKabs(evalcond[2]) < 0.0000010000000000 && IKabs(evalcond[3]) < 0.0000010000000000 && IKabs(evalcond[4]) < 0.0000010000000000 && IKabs(evalcond[5]) < 0.0000010000000000 && IKabs(evalcond[6]) < 0.0000010000000000 && IKabs(evalcond[7]) < 0.0000010000000000 && IKabs(evalcond[8]) < 0.0000010000000000 && IKabs(evalcond[9]) < 0.0000010000000000 && IKabs(evalcond[10]) < 0.0000010000000000 )
01820 {
01821 {
01822 IKReal j6array[1], cj6array[1], sj6array[1];
01823 bool j6valid[1]={false};
01824 j6array[0]=IKatan2(((((cj4)*(new_r01)))+(((new_r11)*(sj4)))), ((((-1.00000000000000)*(new_r10)*(sj4)))+(((-1.00000000000000)*(cj4)*(new_r00)))));
01825 sj6array[0]=IKsin(j6array[0]);
01826 cj6array[0]=IKcos(j6array[0]);
01827 if( j6array[0] > IKPI )
01828 {
01829 j6array[0]-=IK2PI;
01830 }
01831 else if( j6array[0] < -IKPI )
01832 { j6array[0]+=IK2PI;
01833 }
01834 j6valid[0] = true;
01835 for(int ij6 = 0; ij6 < 1; ++ij6)
01836 {
01837 if( !j6valid[ij6] )
01838 {
01839 continue;
01840 }
01841 j6 = j6array[ij6]; cj6 = cj6array[ij6]; sj6 = sj6array[ij6];
01842
01843 {
01844 vsolutions.push_back(IKSolution()); IKSolution& solution = vsolutions.back();
01845 solution.basesol.resize(7);
01846 solution.basesol[0].foffset = j0;
01847 solution.basesol[1].foffset = j1;
01848 solution.basesol[2].foffset = j2;
01849 solution.basesol[3].foffset = j3;
01850 solution.basesol[4].foffset = j4;
01851 solution.basesol[5].foffset = j5;
01852 solution.basesol[6].foffset = j6;
01853 solution.vfree.resize(0);
01854 }
01855 }
01856 }
01857
01858 } else
01859 {
01860 if( 1 )
01861 {
01862 continue;
01863
01864 } else
01865 {
01866 }
01867 }
01868 }
01869 }
01870
01871 } else
01872 {
01873 {
01874 IKReal j6array[1], cj6array[1], sj6array[1];
01875 bool j6valid[1]={false};
01876 j6array[0]=IKatan2(((gconst11)*(new_r21)), ((-1.00000000000000)*(gconst11)*(new_r20)));
01877 sj6array[0]=IKsin(j6array[0]);
01878 cj6array[0]=IKcos(j6array[0]);
01879 if( j6array[0] > IKPI )
01880 {
01881 j6array[0]-=IK2PI;
01882 }
01883 else if( j6array[0] < -IKPI )
01884 { j6array[0]+=IK2PI;
01885 }
01886 j6valid[0] = true;
01887 for(int ij6 = 0; ij6 < 1; ++ij6)
01888 {
01889 if( !j6valid[ij6] )
01890 {
01891 continue;
01892 }
01893 j6 = j6array[ij6]; cj6 = cj6array[ij6]; sj6 = sj6array[ij6];
01894
01895 {
01896 vsolutions.push_back(IKSolution()); IKSolution& solution = vsolutions.back();
01897 solution.basesol.resize(7);
01898 solution.basesol[0].foffset = j0;
01899 solution.basesol[1].foffset = j1;
01900 solution.basesol[2].foffset = j2;
01901 solution.basesol[3].foffset = j3;
01902 solution.basesol[4].foffset = j4;
01903 solution.basesol[5].foffset = j5;
01904 solution.basesol[6].foffset = j6;
01905 solution.vfree.resize(0);
01906 }
01907 }
01908 }
01909
01910 }
01911
01912 }
01913 }
01914 }
01915
01916 }
01917
01918 }
01919
01920 } else
01921 {
01922 {
01923 IKReal j6array[1], cj6array[1], sj6array[1];
01924 bool j6valid[1]={false};
01925 j6array[0]=IKatan2(((gconst10)*(new_r21)), ((-1.00000000000000)*(gconst10)*(new_r20)));
01926 sj6array[0]=IKsin(j6array[0]);
01927 cj6array[0]=IKcos(j6array[0]);
01928 if( j6array[0] > IKPI )
01929 {
01930 j6array[0]-=IK2PI;
01931 }
01932 else if( j6array[0] < -IKPI )
01933 { j6array[0]+=IK2PI;
01934 }
01935 j6valid[0] = true;
01936 for(int ij6 = 0; ij6 < 1; ++ij6)
01937 {
01938 if( !j6valid[ij6] )
01939 {
01940 continue;
01941 }
01942 j6 = j6array[ij6]; cj6 = cj6array[ij6]; sj6 = sj6array[ij6];
01943
01944 {
01945 IKReal dummyeval[1];
01946 IKReal gconst12;
01947 gconst12=IKsign((((new_r12)*(new_r12))+((new_r02)*(new_r02))));
01948 dummyeval[0]=(((new_r12)*(new_r12))+((new_r02)*(new_r02)));
01949 if( IKabs(dummyeval[0]) < 0.0000010000000000 )
01950 {
01951 continue;
01952
01953 } else
01954 {
01955 {
01956 IKReal j4array[1], cj4array[1], sj4array[1];
01957 bool j4valid[1]={false};
01958 j4array[0]=IKatan2(((gconst12)*(new_r12)*(sj5)), ((gconst12)*(new_r02)*(sj5)));
01959 sj4array[0]=IKsin(j4array[0]);
01960 cj4array[0]=IKcos(j4array[0]);
01961 if( j4array[0] > IKPI )
01962 {
01963 j4array[0]-=IK2PI;
01964 }
01965 else if( j4array[0] < -IKPI )
01966 { j4array[0]+=IK2PI;
01967 }
01968 j4valid[0] = true;
01969 for(int ij4 = 0; ij4 < 1; ++ij4)
01970 {
01971 if( !j4valid[ij4] )
01972 {
01973 continue;
01974 }
01975 j4 = j4array[ij4]; cj4 = cj4array[ij4]; sj4 = sj4array[ij4];
01976
01977 {
01978 vsolutions.push_back(IKSolution()); IKSolution& solution = vsolutions.back();
01979 solution.basesol.resize(7);
01980 solution.basesol[0].foffset = j0;
01981 solution.basesol[1].foffset = j1;
01982 solution.basesol[2].foffset = j2;
01983 solution.basesol[3].foffset = j3;
01984 solution.basesol[4].foffset = j4;
01985 solution.basesol[5].foffset = j5;
01986 solution.basesol[6].foffset = j6;
01987 solution.vfree.resize(0);
01988 }
01989 }
01990 }
01991
01992 }
01993
01994 }
01995 }
01996 }
01997
01998 }
01999
02000 }
02001 }
02002 }
02003 }
02004 }};
02005
02006
02009 IKFAST_API bool ik(const IKReal* eetrans, const IKReal* eerot, const IKReal* pfree, std::vector<IKSolution>& vsolutions) {
02010 IKSolver solver;
02011 return solver.ik(eetrans,eerot,pfree,vsolutions);
02012 }
02013
02014 IKFAST_API const char* getKinematicsHash() { return "97103586e77ffd381ff66ffa06718176"; }
02015
02016 #ifdef IKFAST_NAMESPACE
02017 }
02018 #endif
02019
02020 #ifndef IKFAST_NO_MAIN
02021 #include <stdio.h>
02022 #include <stdlib.h>
02023 #ifdef IKFAST_NAMESPACE
02024 using namespace IKFAST_NAMESPACE;
02025 #endif
02026 int main(int argc, char** argv)
02027 {
02028 if( argc != 12+getNumFreeParameters()+1 ) {
02029 printf("\nUsage: ./ik r00 r01 r02 t0 r10 r11 r12 t1 r20 r21 r22 t2 free0 ...\n\n"
02030 "Returns the ik solutions given the transformation of the end effector specified by\n"
02031 "a 3x3 rotation R (rXX), and a 3x1 translation (tX).\n"
02032 "There are %d free parameters that have to be specified.\n\n",getNumFreeParameters());
02033 return 1;
02034 }
02035
02036 std::vector<IKSolution> vsolutions;
02037 std::vector<IKReal> vfree(getNumFreeParameters());
02038 IKReal eerot[9],eetrans[3];
02039 eerot[0] = atof(argv[1]); eerot[1] = atof(argv[2]); eerot[2] = atof(argv[3]); eetrans[0] = atof(argv[4]);
02040 eerot[3] = atof(argv[5]); eerot[4] = atof(argv[6]); eerot[5] = atof(argv[7]); eetrans[1] = atof(argv[8]);
02041 eerot[6] = atof(argv[9]); eerot[7] = atof(argv[10]); eerot[8] = atof(argv[11]); eetrans[2] = atof(argv[12]);
02042 for(std::size_t i = 0; i < vfree.size(); ++i)
02043 vfree[i] = atof(argv[13+i]);
02044 bool bSuccess = ik(eetrans, eerot, vfree.size() > 0 ? &vfree[0] : NULL, vsolutions);
02045
02046 if( !bSuccess ) {
02047 fprintf(stderr,"Failed to get ik solution\n");
02048 return -1;
02049 }
02050
02051 printf("Found %d ik solutions:\n", (int)vsolutions.size());
02052 std::vector<IKReal> sol(getNumJoints());
02053 for(std::size_t i = 0; i < vsolutions.size(); ++i) {
02054 printf("sol%d (free=%d): ", (int)i, (int)vsolutions[i].GetFree().size());
02055 std::vector<IKReal> vsolfree(vsolutions[i].GetFree().size());
02056 vsolutions[i].GetSolution(&sol[0],vsolfree.size()>0?&vsolfree[0]:NULL);
02057 for( std::size_t j = 0; j < sol.size(); ++j)
02058 printf("%.15f, ", sol[j]);
02059 printf("\n");
02060 }
02061 return 0;
02062 }
02063
02064 #endif