<div dir="auto">This example may help<div dir="auto"><a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/GeometricObjects/OrientedArrow">http://www.vtk.org/Wiki/VTK/Examples/Cxx/GeometricObjects/OrientedArrow</a><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Dec 13, 2016 9:13 AM, "Cory Quammen" <<a href="mailto:cory.quammen@kitware.com">cory.quammen@kitware.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Here's a sketch of how to do this in VTK:<br>
<br>
* Find the cross product h between the normalized default cylinder<br>
axis c and your normalized direction vector v.<br>
* Now compute theta = acos(d) where d is the dot product of c and v.<br>
theta is the rotation angle about h you need to rotate the cylinder to<br>
the direction vector.<br>
* Use vtkTransformFilter with the transform set to a vtkTransform<br>
where you have called vtkTransform::RotateWXYZ (double angle, double<br>
x, double y, double z). theta is in radians, but angle is expected to<br>
be in degrees, so you'll need to convert.<br>
<br>
Hope that helps,<br>
Cory<br>
<br>
On Tue, Dec 13, 2016 at 6:33 AM, M. Jordan <<a href="mailto:mjordan@live.at">mjordan@live.at</a>> wrote:<br>
> Hi,<br>
><br>
> i have a cylinder and a given direction vector. Now I want to align the<br>
> cylinder along that vector.<br>
> How can I do this?<br>
><br>
> Thank you!<br>
><br>
><br>
> ______________________________<wbr>_________________<br>
> Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the VTK FAQ at:<br>
> <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_<wbr>FAQ</a><br>
><br>
> Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>vtkusers</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/vtkusers</a><br>
><br>
<br>
<br>
<br>
--<br>
Cory Quammen<br>
Staff R&D Engineer<br>
Kitware, Inc.<br>
______________________________<wbr>_________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_<wbr>FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/vtkusers</a><br>
</blockquote></div></div>