[vtkusers] Rotation about a line

Koteswara Rao Ruvva ruvva at yahoo.com
Mon May 7 02:02:55 EDT 2018


Hello,
I have the following routine to rotate an assembly about a line passing through two points pt1 and pt2. It works good for the rotation about the first line. But when I rotate about another line it produce unexpected results. Looks like I am missing something here.
    def RotateAboutAxis(assembly, pt1, pt2, degrees):
        vec = vtk.vtkVector3d(pt1[0]-pt2[0], pt1[1]-pt2[1], pt1[2]-pt2[2])
        transform = assembly.GetUserTransform()
        transform.Translate(pt1[0], pt1[1], pt1[2])        transform.RotateWXYZ(degrees, vec[0], vec[1], vec[2])        transform.Translate(-pt1[0], -pt1[1], -pt1[2])

ThanksRao
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180507/eb27e258/attachment.html>


More information about the vtkusers mailing list