forked from 541435721/myVTKPythonLibrary
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmoveMeshWithWorldMatrix.py
More file actions
40 lines (30 loc) · 1.24 KB
/
moveMeshWithWorldMatrix.py
File metadata and controls
40 lines (30 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/python
#coding=utf8
########################################################################
### ###
### Created by Martin Genet, 2012-2016 ###
### ###
### University of California at San Francisco (UCSF), USA ###
### Swiss Federal Institute of Technology (ETH), Zurich, Switzerland ###
### École Polytechnique, Palaiseau, France ###
### ###
########################################################################
import numpy
import vtk
import myVTKPythonLibrary as myVTK
########################################################################
def moveMeshWithWorldMatrix(
mesh,
M,
verbose=1):
myVTK.myPrint(verbose, "*** moveMeshWithWorldMatrix ***")
n_points = mesh.GetNumberOfPoints()
points = mesh.GetPoints()
P = numpy.array([0.]*4)
for k_point in xrange(n_points):
P[0:3] = points.GetPoint(k_point)
P[3] = 1.
#print P
P = numpy.dot(M, P)
#print new_P
points.SetPoint(k_point, P[0:3])