[vtkusers] Align vtk cylinder source to a given vector
Cory Quammen
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,
Cory
On Tue, Dec 13, 2016 at 6:33 AM, M. Jordan <mjordan at live.at> wrote:
> Hi,
>
> 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
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
--
Cory Quammen
Staff R&D Engineer
Kitware, Inc.
More information about the vtkusers
mailing list