Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_tensor_rotation_z():
transform = vtk.vtkTransform()
transform.RotateZ(20)
transform.Update()
rot_matrix = transform.GetMatrix()
# rot_matrix.Invert() # <-- this should not be necessary
trans = pv.trans_from_matrix(rot_matrix)
s_test = stress.copy().reshape(1, -1)
_binary_reader.tensor_arbitrary(s_test, trans)
assert np.allclose(s_test, stress_rot_z)
def test_tensor_rotation_y():
transform = vtk.vtkTransform()
transform.RotateY(20)
transform.Update()
rot_matrix = transform.GetMatrix()
# rot_matrix.Invert() # <-- this should not be necessary
trans = pv.trans_from_matrix(rot_matrix)
s_test = stress.copy().reshape(1, -1)
_binary_reader.tensor_arbitrary(s_test, trans)
assert np.allclose(s_test, stress_rot_y)
for i in range(self.n_sector):
# transform to standard position, rotate about Z axis,
# transform back
transform = vtk.vtkTransform()
transform.RotateZ(rang*i)
transform.Update()
rot_matrix = transform.GetMatrix()
if cs_cord > 1:
temp_matrix = vtk.vtkMatrix4x4()
rot_matrix.Multiply4x4(i_matrix, rot_matrix, temp_matrix)
rot_matrix.Multiply4x4(temp_matrix, matrix, rot_matrix)
trans = pv.trans_from_matrix(rot_matrix)
if tensor:
_binary_reader.tensor_arbitrary(full_result[i], trans)
else:
_binary_reader.affline_transform(full_result[i], trans)
return full_result
rang = 360.0 / self.n_sector
for i in range(self.n_sector):
# transform to standard position, rotate about Z axis,
# transform back
transform = vtk.vtkTransform()
transform.RotateZ(rang*i)
transform.Update()
rot_matrix = transform.GetMatrix()
if cs_cord > 1:
temp_matrix = vtk.vtkMatrix4x4()
rot_matrix.Multiply4x4(i_matrix, rot_matrix, temp_matrix)
rot_matrix.Multiply4x4(temp_matrix, matrix, rot_matrix)
trans = pv.trans_from_matrix(rot_matrix)
_binary_reader.tensor_arbitrary(full_result[i], trans)
return full_result