[vtkusers] Rotation about arbitrary line passing through two points

Koteswara Rao Ruvva ruvva at yahoo.com
Thu May 10 01:08:03 EDT 2018


Any comments on this?

Basically I applied the following transformations:
1) Translate to one of the end points of the line
2) RotateWXYZ( angle, vector)
3) Translate back to the same end point 
If I have two lines, it rotates good around the first line but produce unexpected results about line2.

Best Regards
    On Sunday, May 6, 2018, 11:02:55 PM PDT, Koteswara Rao Ruvva <ruvva at yahoo.com> wrote:  
 
 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/20180510/16481c89/attachment.html>


More information about the vtkusers mailing list