Go to the documentation of this file.00001
00018 #include <vector>
00019 #include <math.h>
00020
00021 void setUpFrictionEllipsoid(unsigned int numLatitudes, unsigned int numDirs[], double phi[],
00022 double eccen[], unsigned int& numFrictionEdges, std::vector<double>& frictionEdges)
00023 {
00024 numFrictionEdges = 0;
00025 for (unsigned int i = 0; i < numLatitudes; i++)
00026 {
00027 numFrictionEdges += numDirs[i];
00028 }
00029
00030 frictionEdges.resize(6 * numFrictionEdges, 0);
00031
00032 unsigned int col = 0;
00033 for (unsigned int i = 0; i < numLatitudes; i++)
00034 {
00035 double cosphi = cos(phi[i]);
00036 double sinphi = sin(phi[i]);
00037 for (unsigned int j = 0; j < numDirs[i]; j++)
00038 {
00039 double theta = j * 2 * M_PI / numDirs[i];
00040
00041 double num = cos(theta) * cosphi;
00042 double denom = num * num / (eccen[0] * eccen[0]);
00043 num = sin(theta) * cosphi;
00044 denom += num * num / (eccen[1] * eccen[1]);
00045 num = sinphi;
00046 denom += num * num / (eccen[2] * eccen[2]);
00047 denom = sqrt(denom);
00048
00049 frictionEdges[col * 6] = cos(theta) * cosphi / denom;
00050 frictionEdges[col * 6 + 1] = sin(theta) * cosphi / denom;
00051 frictionEdges[col * 6 + 2] = 0;
00052 frictionEdges[col * 6 + 3] = 0;
00053 frictionEdges[col * 6 + 4] = 0;
00054 frictionEdges[col * 6 + 5] = sinphi / denom;
00055 col++;
00056 }
00057 }
00058 }
00059
00060 void setUpSoftFrictionEdges(unsigned int& numEdges, std::vector<double>& frictionEdges)
00061 {
00062
00063
00064 double eccen[3];
00065
00066
00067
00068
00069 eccen[0] = 1;
00070 eccen[1] = 1;
00071 eccen[2] = 1;
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093 unsigned int numDirs[5] = {1, 5, 8, 5, 1};
00094 double phi[5] = {M_PI_2, M_PI_2 * 0.50, 0.0, -M_PI_2 * 0.50, -M_PI_2};
00095 return setUpFrictionEllipsoid(5, numDirs, phi, eccen , numEdges, frictionEdges);
00096 }
00097
00098
00099 void setUpFrictionEdges(unsigned int& numEdges, std::vector<double>& frictionEdges)
00100 {
00101 double eccen[3] = {1, 1, 1};
00102 unsigned int numDirs[1] = {8};
00103 double phi[1] = {0.0};
00104 setUpFrictionEllipsoid(1, numDirs, phi, eccen, numEdges, frictionEdges);
00105 }