[vtkusers] how to draw a 3D spring
Marius S Giurgi
rendezvous at dreamxplosion.com
Sun Jan 16 14:30:37 EST 2005
Hey, Shi
Here's an example I used to create tubed axes, using the vtkTubeFilter.
# Axes
vtkAxes axes
axes SetOrigin 0 0 0
axes SetScaleFactor 200
axes SymmetricOn
vtkTubeFilter tubedAxes
tubedAxes SetInput [axes GetOutput]
tubedAxes SetRadius 3
tubedAxes SetNumberOfSides 16
tubedAxes CappingOn
vtkPolyDataMapper axesMapper
axesMapper SetInput [tubedAxes GetOutput]
vtkActor axesActor
axesActor SetMapper axesMapper
Once you get the polyline created (the spiral/helix for your spring)
you can pass it as an input to the vtkTubeFilter to get it tubed.
Pretty cool. Check it out and see if this is what you're looking for.
(I don't know whether there's a class to create the helix though. You
might have to generate it on your own).
cheers,
marius
On Jan 15, 2005, at 9:07 PM, Shi Jin wrote:
> Hi there,
>
> I am very new to VTK. My first intention is to draw
> something for my research which requires drawing a
> spring-mass system. My question is how to draw the
> spring connectting the two balls. I am thinking using
> a sprial(helix) tube. The helix has a very simple
> mathematica form but the problem is how to draw it
> three dimensionly, like the real springs. I am
> thinking the vtkSweptSurface Class. But is there any
> other way to do it, like curved tubes?
> Thanks a lot.
> Shi
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
More information about the vtkusers
mailing list