I want to translate my object and then rotate it around the translated origin not the main origin of the page’s coordinate.I don’t know how i can solve the problem. can any one help me?(my code is shown below)
You are applying two independent transforms (two vtkTransform objects). You need to composite them as a single vtkTransform to rotate an object about an arbitrary center. To rotate something about a center not in the global origin (e.g. (42,42,42)), you need, first, to translate A=(-42,-42,-42) towards the origin; then rotate about the origin (R), then undo the translation back to the correct location B=(+42,+42,+42). Pay attention to multiply the transform matrices in the correct order: the matrix product must be B*R*A and not A*R*B. The first transform to be applied is the last one in the multiplication order.
Please, I recommend a nice book called “Graphics Gems”. It’s 9th chapter delves into the linear algebra necessary for computer graphics. It’s a 1990 book, but if you want to even write you own graphics engine, it’s still worth it.