def exercise_basis_of_mirror_plane_with_normal():
  from cctbx.math_module import basis_of_mirror_plane_with_normal
  for u in [(1,0,0), (0,1,0), (0,0,1), (1,1,0), (1,1,1), (0,-1,1), (-1,1,1)]:
    u = mat.col(u)
    v,w = [ mat.col(x) for x in basis_of_mirror_plane_with_normal(u.elems) ]
    assert u.dot(v) == 0
    assert u.dot(w) == 0
    assert abs(v.cross(w)) != 0
  try:
    basis_of_mirror_plane_with_normal((0,0,0))
  except AssertionError:
    pass
  else:
    raise Exception_expected
Exemple #2
0
def exercise_basis_of_mirror_plane_with_normal():
    from cctbx.math_module import basis_of_mirror_plane_with_normal
    for u in [(1, 0, 0), (0, 1, 0), (0, 0, 1), (1, 1, 0), (1, 1, 1),
              (0, -1, 1), (-1, 1, 1)]:
        u = mat.col(u)
        v, w = [mat.col(x) for x in basis_of_mirror_plane_with_normal(u.elems)]
        assert u.dot(v) == 0
        assert u.dot(w) == 0
        assert abs(v.cross(w)) != 0
    try:
        basis_of_mirror_plane_with_normal((0, 0, 0))
    except AssertionError:
        pass
    else:
        raise Exception_expected
Exemple #3
0
 def basis_of_invariant(self):
     from cctbx.math_module import basis_of_mirror_plane_with_normal
     if not hasattr(self, '_basis_of_invariant'):
         if self.type() == 1:
             basis = ((1, 0, 0), (0, 1, 0), (0, 0, 1))
         elif self.type() == -2:
             basis = basis_of_mirror_plane_with_normal(self.ev())
         elif self.type() < 0:
             basis = ()
         else:
             basis = (self.ev(), )
         self._basis_of_invariant = basis
     return self._basis_of_invariant
Exemple #4
0
 def basis_of_invariant(self):
   from cctbx.math_module import basis_of_mirror_plane_with_normal
   if not hasattr(self, '_basis_of_invariant'):
     if self.type() == 1:
       basis = ((1,0,0), (0,1,0), (0,0,1))
     elif self.type() == -2:
       basis = basis_of_mirror_plane_with_normal(self.ev())
     elif self.type() < 0:
       basis = ()
     else:
       basis = (self.ev(), )
     self._basis_of_invariant = basis
   return self._basis_of_invariant