~ben-b-boyer/ptools/readPDB

« back to all changes in this revision

Viewing changes to Movement.cpp

  • Committer: Adrien Saladin
  • Date: 2010-03-12 23:05:58 UTC
  • Revision ID: adrien@saladin.fr-20100312230558-rp12y9gbbnfp3jkh
code cleaning: references to const instead of object copy

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
#include <Movement.h>
6
6
 
7
7
using namespace std;
8
 
using namespace PTools;
9
 
 
10
 
 
 
8
 
 
9
 
 
10
namespace PTools {
11
11
 
12
12
 
13
13
//base class movement--------------------------------------------------------
44
44
}
45
45
 
46
46
 
47
 
Movement Movement::operator+ (Movement mov)
 
47
Movement Movement::operator+ (const Movement& mov) const
48
48
{
49
49
  Matrix mat = mov.getMatrix();
50
50
  return Movement(matrixMultiply(m,mat)); 
58
58
 
59
59
 
60
60
//functions for matrix (to displace to ptools)--------------------------------------------------------
61
 
Matrix PTools::matrixMultiply( Matrix m1, Matrix m2 )
 
61
Matrix matrixMultiply(const Matrix& m1, const Matrix& m2)
62
62
{
63
63
  double mat1[4][4];
64
64
  double mat2[4][4];
90
90
}
91
91
 
92
92
 
93
 
Matrix PTools::inverseTranformationMatrix(Matrix m)
 
93
Matrix inverseTranformationMatrix(const Matrix & m)
94
94
{
95
95
  //1 the inverse of a translation matrix is the translation matrice with the oposite signs on each of the translation components.
96
96
  //2 the inverse of a rotation matrix is the rotation matrix's transpose.
117
117
}
118
118
 
119
119
 
120
 
Matrix PTools::inverseTranformationMatrixPlusPlus(Matrix m)
 
120
Matrix inverseTranformationMatrixPlusPlus(const Matrix& m)
121
121
{
122
122
  //1 the inverse of a translation matrix is the translation matrice with the oposite signs on each of the translation components.
123
123
  //2 the inverse of a rotation matrix is the rotation matrix's transpose.
136
136
}
137
137
 
138
138
 
139
 
Matrix PTools::inverseMatrix44 (Matrix a)
 
139
Matrix inverseMatrix44 (const Matrix&  a)
140
140
141
141
  Matrix inv = Matrix(4,4);
142
142
  
241
241
 
242
242
//child class--------------------------------------------------------
243
243
const double RADIAN = 0.0175;
244
 
Shift::Shift(double alpha): Movement()
 
244
Shift::Shift(double alpha)
 
245
 :Movement()
245
246
{
246
247
   m(0,0)=1;    m(0,1)=0;          m(0,2)=0;           m(0,3)=alpha;
247
248
   m(1,0)=0;    m(1,1)=1;          m(1,2)=0;           m(1,3)=0;
250
251
}
251
252
 
252
253
 
253
 
Slide::Slide(double alpha): Movement()
 
254
Slide::Slide(double alpha)
 
255
 :Movement()
254
256
{
255
257
   m(0,0)=1;    m(0,1)=0;          m(0,2)=0;           m(0,3)=0;
256
258
   m(1,0)=0;    m(1,1)=1;          m(1,2)=0;           m(1,3)=alpha;
259
261
}
260
262
 
261
263
 
262
 
Rise::Rise(double alpha): Movement()
 
264
Rise::Rise(double alpha)
 
265
 :Movement()
263
266
{
264
267
   m(0,0)=1;    m(0,1)=0;          m(0,2)=0;           m(0,3)=0;
265
268
   m(1,0)=0;    m(1,1)=1;          m(1,2)=0;           m(1,3)=0;
268
271
}
269
272
 
270
273
 
271
 
Twist::Twist(double alpha): Movement()
 
274
Twist::Twist(double alpha)
 
275
 :Movement()
272
276
{
273
277
  alpha = (alpha * RADIAN);//conversion in radian
274
278
  
280
284
}
281
285
 
282
286
 
283
 
Roll::Roll(double alpha): Movement()
 
287
Roll::Roll(double alpha) 
 
288
 :Movement()
284
289
{
285
290
  alpha = (alpha * RADIAN);//conversion in radian
286
291
  
292
297
}
293
298
 
294
299
 
295
 
Tilt::Tilt(double alpha): Movement()
 
300
Tilt::Tilt(double alpha)
 
301
 :Movement()
296
302
{
297
303
  alpha = (alpha * RADIAN);//conversion in radian
298
304
  
306
312
// Movement for building "classic" DNA
307
313
// reference for parameter:
308
314
// S.Arnott, R.Chandrasekaran, D.L.Birdsall, A.G.W.Leslie and R.L.Ratliff, Nature 283, 743-746 (1980) 
309
 
BDNA::BDNA():Movement()
 
315
BDNA::BDNA()
 
316
 :Movement()
310
317
{
311
318
  m=(Twist(35.99)+Roll(0.91)+Rise(3.38)+Slide(0.08)).getMatrix();
312
319
}
314
321
ADNA::ADNA():Movement()
315
322
{
316
323
  m=(Twist(30.69)+Roll(11.44)+Rise(3.44)+Slide(-1.92)).getMatrix();
317
 
}
 
 
b'\\ No newline at end of file'
 
324
}
 
325
 
 
326
 
 
327
 
 
328
 
 
329
} //namespace PTools
 
330