Changeset 6c6d84 for molecuilder/src/vector.cpp
- Timestamp:
- Aug 20, 2009, 11:35:19 AM (16 years ago)
- Children:
- bc3953
- Parents:
- 84b811
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/vector.cpp
r84b811 r6c6d84 467 467 }; 468 468 469 /** Rotates the vector around the axis given by \a *axis by an angle of \a alpha.469 /** Rotates the vector relative to the origin around the axis given by \a *axis by an angle of \a alpha. 470 470 * \param *axis rotation axis 471 471 * \param alpha rotation angle in radian … … 478 478 a.ProjectOntoPlane(axis); 479 479 // construct normal vector 480 y.MakeNormalVector(axis,this); 480 bool rotatable = y.MakeNormalVector(axis,&a); 481 // The normal vector cannot be created if there is linar dependency. 482 // Then the vector to rotate is on the axis and any rotation leads to the vector itself. 483 if (!rotatable) { 484 return; 485 } 481 486 y.Scale(Norm()); 482 487 // scale normal vector by sine and this vector by cosine 483 488 y.Scale(sin(alpha)); 484 Scale(cos(alpha)); 489 a.Scale(cos(alpha)); 490 CopyVector(Projection(axis)); 485 491 // add scaled normal vector onto this vector 486 492 AddVector(&y);
Note:
See TracChangeset
for help on using the changeset viewer.