Problem with 2D Rotation about a point using Python Programmable Filter
Hi,
I am trying to transform a STL file using the "Python Programmable Filter" and follwing python code. Not sure what I'm doing wrong here! Any help is highly appreciated.
Thanks, Tash
import math
pdi = self.GetInput()
pdo = self.GetOutput()
newPoints = vtk.vtkPoints()
numPoints = pdi.GetNumberOfPoints()
for i in range(0, numPoints):
coord = pdi.GetPoint(i)
angle = math.radians(90)
ox, oy, oz = (0,0,0)
x, y, z = coord[:3]
x = ox + math.cos(angle) * (x - ox) - math.sin(angle) * (y - oy)
y = oy + math.sin(angle) * (x - ox) + math.cos(angle) * (y - oy)
z = z*1
newPoints.InsertPoint(i, x, y, z)
pdo.SetPoints(newPoints)