Hi,
I have written a programmable filter to perform Euler transformations based on a poly data set and a csv input. The code boils down to a loop over the mesh points and a set of standard matrix transformations of the form
for i in range(0, numPoints):
coord = pdi.GetPoint(i)
x, y, z = coord[:3]
x : rotate around ZYX with psi, theta, phi
y : rotate around ZYX with psi, theta, phi
z : rotate around ZYX with psi, theta, phi
newPoints.InsertPoint(i, x, y, z)
pdo.SetPoints(newPoints)
The transformations work as intended but are extremely slow. For a 5 million points surface mesh it takes an hour to do just one transformation and I have to do 4000 of them (for each of the 4000 time steps). When I apply the Transform filter, it takes just a few seconds. Unfortunately I cannot use the transform filter to achieve what I need, because I have to transform around custom axes.
I have the following questions:
- is the slow speed related to the “for loop”? Is there a way to optimise the loop, by using some VTK (C++?) loop for example?
- is there an alternative to the Transform filter, which uses the Euler rotation around body fixed axes? Perhaps there is some VTK transformation which can be exposed in the programmable filter.
Thanks