Ignore:
Timestamp:
Apr 13, 2010, 1:22:42 PM (16 years ago)
Author:
Tillmann Crueger <crueger@…>
Children:
e7ea64
Parents:
0f55b2
Message:

Prepared interface of Vector Class for transition to VectorComposites

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/SingleVector.cpp

    r0f55b2 r1f591b  
    119119        TranslationVector.MatrixMultiplication(matrix);
    120120        // add onto the original vector to compare with
    121         Shiftedy.CopyVector(y);
    122         Shiftedy.AddVector(&TranslationVector);
     121        Shiftedy = y + TranslationVector;
    123122        // get distance and compare with minimum so far
    124123        tmp = Distance(Shiftedy);
     
    157156        TranslationVector.MatrixMultiplication(matrix);
    158157        // add onto the original vector to compare with
    159         Shiftedy.CopyVector(y);
    160         Shiftedy.AddVector(&TranslationVector);
     158        Shiftedy = y + TranslationVector;
    161159        // get distance and compare with minimum so far
    162160        tmp = DistanceSquared(Shiftedy);
     
    180178//  Output(out);
    181179//  Log() << Verbose(0) << endl;
    182   TestVector.CopyVector(this);
     180  TestVector = *this;
    183181  TestVector.InverseMatrixMultiplication(matrix);
    184182  for(int i=NDIM;i--;) { // correct periodically
     
    190188  }
    191189  TestVector.MatrixMultiplication(matrix);
    192   CopyVector(&TestVector);
     190  CopyVector(TestVector);
    193191//  Log() << Verbose(2) << "New corrected vector is: ";
    194192//  Output(out);
     
    250248
    251249  // first create part that is orthonormal to PlaneNormal with withdraw
    252   temp = *this - PlaneOffset;
     250  temp = (*this )- PlaneOffset;
    253251  temp.MakeNormalTo(PlaneNormal);
    254252  temp.Scale(-1.);
    255253  // 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);
    258256  if (fabs(sign) > MYEPSILON)
    259257    sign /= fabs(sign);
     
    271269  Vector helper = y;
    272270  helper.Scale(-(ScalarProduct(y)));
    273   AddVector(&helper);
     271  AddVector(helper);
    274272};
    275273
     
    556554{
    557555  bool result = false;
    558   double factor = y1.ScalarProduct(this)/y1.NormSquared();
     556  double factor = y1.ScalarProduct(*this)/y1.NormSquared();
    559557  Vector x1;
    560   x1.CopyVector(&y1);
    561   x1.Scale(factor);
    562   SubtractVector(&x1);
     558  x1 = factor * y1;
     559  SubtractVector(x1);
    563560  for (int i=NDIM;i--;)
    564561    result = result || (fabs(x[i]) > MYEPSILON);
     
    618615bool SingleVector::IsInParallelepiped(const Vector &offset, const double * const parallelepiped) const
    619616{
    620   Vector a;
    621   a.CopyVector(this);
    622   a.SubtractVector(&offset);
     617  Vector a = (*this) - offset;
    623618  a.InverseMatrixMultiplication(parallelepiped);
    624619  bool isInside = true;
Note: See TracChangeset for help on using the changeset viewer.