Ignore:
Timestamp:
Aug 20, 2009, 3:40:49 PM (16 years ago)
Author:
Saskia Metzler <metzler@…>
Children:
2aea0b, 390a2b
Parents:
6c6d84
Message:

Ticket 17: Write new function molecule::CopyMoleculeFromSubRegion()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/vector.cpp

    r6c6d84 rbc3953  
    12211221  return true;
    12221222};
     1223
     1224/**
     1225 * Checks whether this vector is within the parallelepiped defined by the given three vectors and
     1226 * their offset.
     1227 *
     1228 * @param offest for the origin of the parallelepiped
     1229 * @param three vectors forming the matrix that defines the shape of the parallelpiped
     1230 */
     1231bool Vector::IsInParallelepiped(Vector offset, double *parallelepiped)
     1232{
     1233  Vector a;
     1234  a.CopyVector(this);
     1235  a.SubtractVector(&offset);
     1236  a.InverseMatrixMultiplication(parallelepiped);
     1237  bool isInside = true;
     1238
     1239  for (int i=NDIM;i--;)
     1240    isInside = isInside && ((a.x[i] <= 1) && (a.x[i] >= 0));
     1241
     1242  return isInside;
     1243}
Note: See TracChangeset for help on using the changeset viewer.