00001 #ifndef SIGEL_ROBOT_SIG_MIRTICH_H
00002 #define SIGEL_ROBOT_SIG_MIRTICH_H
00003
00004 namespace SIGEL_Robot { class SIG_Mirtich; }
00005
00006 #include <math.h>
00007 #include <pointvector.h>
00008 #include "SIGEL_Robot/SIG_Geometry.h"
00009 #include "SIGEL_Robot/SIG_GeometryIterator.h"
00010 #include "SIGEL_Robot/SIG_Polygon.h"
00011
00012 #include "SIGEL_Robot/SIG_RobotExceptions.h"
00013 #include <qstring.h>
00014
00015 namespace SIGEL_Robot {
00016
00017 class SIG_Mirtich {
00018 struct POLYHEDRON;
00019 typedef double tridouble [3];
00020 struct FACE {
00021 int numVerts;
00022 double norm[3];
00023 double w;
00024 int *verts;
00025 POLYHEDRON *poly;
00026 };
00027 struct POLYHEDRON {
00028 int numVerts, numFaces;
00029 tridouble *verts;
00030 FACE *faces;
00031 };
00032 protected:
00033
00034 SIG_Geometry *geom;
00035
00036 int A, B, C;
00037
00038 double P1, Pa, Pb, Paa, Pab, Pbb, Paaa, Paab, Pabb, Pbbb;
00039
00040 double Fa, Fb, Fc, Faa, Fbb, Fcc, Faaa, Fbbb, Fccc, Faab, Fbbc, Fcca;
00041
00042 double T0, T1[3], T2[3], TP[3];
00043
00044 bool computed;
00045 QString myExcName;
00046
00047 void compProjectionIntegrals (FACE *f);
00048 void compFaceIntegrals (FACE *f);
00049 void compVolumeIntegrals (POLYHEDRON *p);
00050 void compFaceNormal (FACE *f);
00051 void compute (void);
00052
00053 public:
00054 SIG_Mirtich (SIG_Geometry *geom, QString nameOfGeom);
00055 virtual ~SIG_Mirtich (void);
00056
00057 void computePhysics (double density,
00058 DL_Scalar & masse,
00059 DL_vector & centreOfMass,
00060 DL_matrix & inertiaTensor);
00061 void computeMajorAxes (DL_vector & centreOfMass,
00062 DL_vector & v1, DL_vector & v2, DL_vector & v3);
00063 void moveToOriginAndMajorAxes (DL_vector & translation,
00064 DL_matrix & rotation);
00065 void computeAgain (void) { computed = false; }
00066 };
00067
00068 }
00069
00070 #endif