CoordTrans.cpp
Go to the documentation of this file.
2 
4  std::vector<V3> xyz,
5  double L, // length of the element(edge)
6  int n1, int n2, // index fo endpoint of the element
7  double &t0, double &t1, double &t2, double &t3, double &t4,
8  double &t5, double &t6, double &t7, double &t8,
9  float p)
10 {
11  // CoordTrans - calculate the 9 elements of the block - diagonal 12 - by - 12
12  // coordinate transformation matrix, t1, t2, ..., t9.
13 
14  // These coordinate transformation factors are used to :
15  // transform frame element end forces from the element(local) coordinate system
16  // to the structral(global) coordinate system.
17 
18  // Element matrix coordinate transformations are carried out by function ATMA
19 
20  double Cx, Cy, Cz, den, /* direction cosines */
21  Cp, Sp; /* cosine and sine of roll angle */
22 
23  Cx = (xyz[n2][0] - xyz[n1][0]) / L;
24  Cy = (xyz[n2][1] - xyz[n1][1]) / L;
25  Cz = (xyz[n2][2] - xyz[n1][2]) / L;
26 
27  t0 = t1 = t2 = t3 = t4 = t5 = t6 = t7 = t8 = 0.0;
28 
29  Cp = cos(p);
30  Sp = sin(p);
31 
32  if (fabs(Cz) == 1.0)
33  {
34  t2 = Cz;
35  t3 = -Cz*Sp;
36  t4 = Cp;
37  t6 = -Cz*Cp;
38  t7 = -Sp;
39  }
40  else
41  {
42 
43  den = sqrt(1.0 - Cz*Cz);
44 
45  t0 = Cx;
46  t1 = Cy;
47  t2 = Cz;
48 
49  t3 = (-Cx*Cz*Sp - Cy*Cp) / den;
50  t4 = (-Cy*Cz*Sp + Cx*Cp) / den;
51  t5 = Sp*den;
52 
53  t6 = (-Cx*Cz*Cp + Cy*Sp) / den;
54  t7 = (-Cy*Cz*Cp - Cx*Sp) / den;
55  t8 = Cp*den;
56  }
57 }
58 
59 
61  point u, point v,
62  double &t0, double &t1, double &t2, double &t3, double &t4,
63  double &t5, double &t6, double &t7, double &t8,
64  float p)
65 {
66  double L = sqrt((u.x() - v.x())*(u.x() - v.x()) + (u.y() - v.y())*(u.y() - v.y())
67  + (u.z() - v.z())*(u.z() - v.z()));
68 
69  double Cx, Cy, Cz, den, /* direction cosines */
70  Cp, Sp; /* cosine and sine of roll angle */
71 
72  Cx = (v.x() - u.x()) / L;
73  Cy = (v.y() - u.y()) / L;
74  Cz = (v.z() - u.z()) / L;
75 
76  t0 = t1 = t2 = t3 = t4 = t5 = t6 = t7 = t8 = 0.0;
77 
78  Cp = cos(p);
79  Sp = sin(p);
80 
81  if (fabs(Cz) == 1.0)
82  {
83  t2 = Cz;
84  t3 = -Cz*Sp;
85  t4 = Cp;
86  t6 = -Cz*Cp;
87  t7 = -Sp;
88  }
89  else
90  {
91  den = sqrt(1.0 - Cz*Cz);
92 
93  t0 = Cx;
94  t1 = Cy;
95  t2 = Cz;
96 
97  t3 = (-Cx*Cz*Sp - Cy*Cp) / den;
98  t4 = (-Cy*Cz*Sp + Cx*Cp) / den;
99  t5 = Sp*den;
100 
101  t6 = (-Cx*Cz*Cp + Cy*Sp) / den;
102  t7 = (-Cy*Cz*Cp - Cx*Sp) / den;
103  t8 = Cp*den;
104  }
105 }
106 
107 
109  double t0, double t1, double t2, double t3, double t4,
110  double t5, double t6, double t7, double t8,
111  MX &m, float r1, float r2)
112 {
113  int i, j, k;
114 
115  MX t(12, 12);
116  MX mt(12, 12);
117 
118  t.setZero();
119  mt.setZero();
120 
121  for (i = 0; i < 4; i++)
122  {
123  t(3 * i, 3 * i) = t0;
124  t(3 * i, 3 * i + 1) = t1;
125  t(3 * i, 3 * i + 2) = t2;
126  t(3 * i + 1, 3 * i) = t3;
127  t(3 * i + 1, 3 * i + 1) = t4;
128  t(3 * i + 1, 3 * i + 2) = t5;
129  t(3 * i + 2, 3 * i) = t6;
130  t(3 * i + 2, 3 * i + 1) = t7;
131  t(3 * i + 2, 3 * i + 2) = t8;
132  }
133 
134  /* effect of finite node radius on coordinate transformation is not supported now */
135 
136  mt = t.transpose() * m * t;
137  m = mt;
138 }
const GLfloat * m
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t0
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t1
reference x()
Definition: Vec.h:194
void TransLocToGlob(double t0, double t1, double t2, double t3, double t4, double t5, double t6, double t7, double t8, MX &m, float r1, float r2)
Definition: CoordTrans.cpp:108
reference y()
Definition: Vec.h:203
GLdouble GLdouble t
void CreateTransMatrix(std::vector< V3 > xyz, double L, int n1, int n2, double &t0, double &t1, double &t2, double &t3, double &t4, double &t5, double &t6, double &t7, double &t8, float p)
Definition: CoordTrans.cpp:3
const GLdouble * v
reference z()
Definition: Vec.h:212
GLfloat GLfloat p
Eigen::MatrixXd MX
Definition: CoordTrans.h:69


choreo_task_sequence_planner
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 04:03:14