[vtkusers] Align vtk cylinder source to a given vector
cory.quammen at kitware.com
Tue Dec 13 09:13:17 EST 2016
Here's a sketch of how to do this in VTK:
* Find the cross product h between the normalized default cylinder
axis c and your normalized direction vector v.
* Now compute theta = acos(d) where d is the dot product of c and v.
theta is the rotation angle about h you need to rotate the cylinder to
the direction vector.
* Use vtkTransformFilter with the transform set to a vtkTransform
where you have called vtkTransform::RotateWXYZ (double angle, double
x, double y, double z). theta is in radians, but angle is expected to
be in degrees, so you'll need to convert.
Hope that helps,
On Tue, Dec 13, 2016 at 6:33 AM, M. Jordan <mjordan at live.at> wrote:
> i have a cylinder and a given direction vector. Now I want to align the
> cylinder along that vector.
> How can I do this?
> Thank you!
> Powered by www.kitware.com
> Visit other Kitware open-source projects at
> Please keep messages on-topic and check the VTK FAQ at:
> Search the list archives at: http://markmail.org/search/?q=vtkusers
> Follow this link to subscribe/unsubscribe:
Staff R&D Engineer
More information about the vtkusers