Changes in src/vector.cpp [29812d:d09ff7]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/vector.cpp
r29812d rd09ff7 225 225 Direction.CopyVector(LineVector); 226 226 Direction.SubtractVector(Origin); 227 Direction.Normalize(); 227 228 //*out << Verbose(4) << "INFO: Direction is " << Direction << "." << endl; 228 229 factor = Direction.ScalarProduct(PlaneNormal); … … 234 235 helper.SubtractVector(Origin); 235 236 factor = helper.ScalarProduct(PlaneNormal)/factor; 237 if (factor < MYEPSILON) { // Origin is in-plane 238 //*out << Verbose(2) << "Origin of line is in-plane, simple." << endl; 239 CopyVector(Origin); 240 return true; 241 } 236 242 //factor = Origin->ScalarProduct(PlaneNormal)*(-PlaneOffset->ScalarProduct(PlaneNormal))/(Direction.ScalarProduct(PlaneNormal)); 237 243 Direction.Scale(factor); … … 655 661 }; 656 662 663 /** Given a box by its matrix \a *M and its inverse *Minv the vector is made to point within that box. 664 * \param *M matrix of box 665 * \param *Minv inverse matrix 666 */ 667 void Vector::WrapPeriodically(const double *M, const double *Minv) 668 { 669 MatrixMultiplication(Minv); 670 // truncate to [0,1] for each axis 671 for (int i=0;i<NDIM;i++) { 672 x[i] += 0.5; // set to center of box 673 while (x[i] >= 1.) 674 x[i] -= 1.; 675 while (x[i] < 0.) 676 x[i] += 1.; 677 } 678 MatrixMultiplication(M); 679 }; 680 657 681 /** Do a matrix multiplication. 658 682 * \param *matrix NDIM_NDIM array 659 683 */ 660 void Vector::MatrixMultiplication( double *M)684 void Vector::MatrixMultiplication(const double *M) 661 685 { 662 686 Vector C; … … 700 724 * \param *matrix NDIM_NDIM array 701 725 */ 702 void Vector::InverseMatrixMultiplication( double *A)726 void Vector::InverseMatrixMultiplication(const double *A) 703 727 { 704 728 Vector C;
Note:
See TracChangeset
for help on using the changeset viewer.