[vtkusers] Align vtk cylinder source to a given vector
Bill Lorensen
bill.lorensen at gmail.com
Tue Dec 13 09:23:10 EST 2016
This example may help
http://www.vtk.org/Wiki/VTK/Examples/Cxx/GeometricObjects/OrientedArrow
On Dec 13, 2016 9:13 AM, "Cory Quammen" <cory.quammen at kitware.com> wrote:
> 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.
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20161213/2bc47a46/attachment.html>
More information about the vtkusers
mailing list