Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python (VTK): Connect two 3D points by an oriented cylinder

Consider we have two points in 3D space, wishing to connect them by a cylinder with specified radius. Apparently the height (length) of cylinder will be the distance between tow two points. However the standard Cylinder object has nothing to be oriented to follow the above.

How to do this?

like image 580
Developer Avatar asked Jul 05 '26 06:07

Developer


1 Answers

The simplest way I can see is using TubeFilter. Basically you draw a line between the two points and then apply the filter. Here is an example in c++, but it should be straightforward to port it to Python.

EDIT: And here there's an example in python if that helps.

like image 54
dudu Avatar answered Jul 06 '26 20:07

dudu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!