Changeset 1f591b for molecuilder/src/SingleVector.cpp
- Timestamp:
- Apr 13, 2010, 1:22:42 PM (16 years ago)
- Children:
- e7ea64
- Parents:
- 0f55b2
- File:
-
- 1 edited
-
molecuilder/src/SingleVector.cpp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/SingleVector.cpp
r0f55b2 r1f591b 119 119 TranslationVector.MatrixMultiplication(matrix); 120 120 // add onto the original vector to compare with 121 Shiftedy.CopyVector(y); 122 Shiftedy.AddVector(&TranslationVector); 121 Shiftedy = y + TranslationVector; 123 122 // get distance and compare with minimum so far 124 123 tmp = Distance(Shiftedy); … … 157 156 TranslationVector.MatrixMultiplication(matrix); 158 157 // add onto the original vector to compare with 159 Shiftedy.CopyVector(y); 160 Shiftedy.AddVector(&TranslationVector); 158 Shiftedy = y + TranslationVector; 161 159 // get distance and compare with minimum so far 162 160 tmp = DistanceSquared(Shiftedy); … … 180 178 // Output(out); 181 179 // Log() << Verbose(0) << endl; 182 TestVector .CopyVector(this);180 TestVector = *this; 183 181 TestVector.InverseMatrixMultiplication(matrix); 184 182 for(int i=NDIM;i--;) { // correct periodically … … 190 188 } 191 189 TestVector.MatrixMultiplication(matrix); 192 CopyVector( &TestVector);190 CopyVector(TestVector); 193 191 // Log() << Verbose(2) << "New corrected vector is: "; 194 192 // Output(out); … … 250 248 251 249 // first create part that is orthonormal to PlaneNormal with withdraw 252 temp = *this- PlaneOffset;250 temp = (*this )- PlaneOffset; 253 251 temp.MakeNormalTo(PlaneNormal); 254 252 temp.Scale(-1.); 255 253 // then add connecting vector from plane to point 256 temp += *this-PlaneOffset;257 double sign = temp.ScalarProduct( &PlaneNormal);254 temp += (*this)-PlaneOffset; 255 double sign = temp.ScalarProduct(PlaneNormal); 258 256 if (fabs(sign) > MYEPSILON) 259 257 sign /= fabs(sign); … … 271 269 Vector helper = y; 272 270 helper.Scale(-(ScalarProduct(y))); 273 AddVector( &helper);271 AddVector(helper); 274 272 }; 275 273 … … 556 554 { 557 555 bool result = false; 558 double factor = y1.ScalarProduct( this)/y1.NormSquared();556 double factor = y1.ScalarProduct(*this)/y1.NormSquared(); 559 557 Vector x1; 560 x1.CopyVector(&y1); 561 x1.Scale(factor); 562 SubtractVector(&x1); 558 x1 = factor * y1; 559 SubtractVector(x1); 563 560 for (int i=NDIM;i--;) 564 561 result = result || (fabs(x[i]) > MYEPSILON); … … 618 615 bool SingleVector::IsInParallelepiped(const Vector &offset, const double * const parallelepiped) const 619 616 { 620 Vector a; 621 a.CopyVector(this); 622 a.SubtractVector(&offset); 617 Vector a = (*this) - offset; 623 618 a.InverseMatrixMultiplication(parallelepiped); 624 619 bool isInside = true;
Note:
See TracChangeset
for help on using the changeset viewer.
