[vtkusers] Align vtk cylinder source to a given vector

Bill Lorensen bill.lorensen at gmail.com
Tue Dec 13 12:44:12 EST 2016


I added a new example:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/GeometricObjects/OrientedCylinder


On Tue, Dec 13, 2016 at 9:23 AM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
> 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



-- 
Unpaid intern in BillsBasement at noware dot com


More information about the vtkusers mailing list