 # Changing double circular helix

Hi Everyone!

I have now been able to use Matplotlib on Window XP platfrom! Thanks for thiose who helped me to get Enthought Edition installed and working!

I have no idea how to do what I have wanted to do for several years. I will try to describe the plot I need.

I need to be able to include this plot in a Wikki.

A point on a small circle with radius r0, is spiralling around (orthogonally) in a larger circle of radius r1, with these two radii related by r0/r1 = alpha. The smaller circle sweeps around the r1 radius to create a path, with the point (on r1) locus describing a torroid coil in the surface of the ring torus.

This describes the plot when the torus is at-rest, but when the ring torus is in linear motion, both r0 and r1 change dimensions together, (keeping the same r0/r1 = alpha ratio), to create an increasing or decreasing spiralling circular helix, that is a fuction of the mass energy created by this motion. The point on the r0 circle is “like a snake chasing its tail?”

When the torus is at-rest, the toroid path is closed, but in-motion, the torroid is open and becomes an increasing or decreasing spiral. This path will collapse back to a larger size if the energy is decreasing, and shrink to a smaller size if the energy is increasing.

If the at-rest motion plot can be created ( I know that I can’t do this plot by myself), then an animation of the ring torus figure moving through space to create a spiral would help in visualizing this figure. If this animation can slow down or speed up this would be great…

Can anyone help me to create this plot?

Thanks for any help!

Hubert fitch

Hmmm interesting ....

It's hard to follow your text description, but I think what you're
describing is at least a 3D visualisation, so matplotlib isn't ideal for
the task. Can you put this into equations? I'm not clear if your at-rest
plot should be a "trajectory" for a point moving round the torus

If you're willing to learn a new toolkit, this is a good task for VTK
(www.vtk.org). It's included in the enthought python distribution. The
problem here is that you almost certainly need to buy the user-guide
and/or the VTK text book to learn how to use it. VTK is very powerful,
but rather complex to learn.

Maybe this is a good task for VPython (http://www.vpython.org/ ). I've
never used this myself, but if looks well suited to this kind of dynamic
visualisation and is less intimidating than VTK (although it's built on
VTK I think).

Well below is a script to render a "coil" in 3D. It's too much work for
me to figure out the vector/matrix algebra to calculate the trajectory
you describe, but hopefully you get the idea: replace my 'trajectory'
function with whatever is appropriate for what you want. Maybe this will
get you started.

HTH
Bryan

···

On Fri, 2006-10-13 at 13:59 -0400, Hubert Fitch wrote:

Hi Everyone!

I have now been able to use Matplotlib on Window XP platfrom! Thanks
for thiose who helped me to get Enthought Edition installed and
working!

I have no idea how to do what I have wanted to do for several years. I
will try to describe the plot I need.
I need to be able to include this plot in a Wikki.

A point on a small circle with radius r0, is spiralling around
(orthogonally) in a larger circle of radius r1, with these two radii
related by r0/r1 = alpha. The smaller circle sweeps around the r1
radius to create a path, with the point (on r1) locus describing a
torroid coil in the surface of the ring torus.

This describes the plot when the torus is at-rest, but when the ring
torus is in linear motion, both r0 and r1 change dimensions together,
(keeping the same r0/r1 = alpha ratio), to create an increasing or
decreasing spiralling circular helix, that is a fuction of the mass
energy created by this motion. The point on the r0 circle is "like a
snake chasing its tail?"

When the torus is at-rest, the toroid path is closed, but in-motion,
the torroid is open and becomes an increasing or decreasing spiral.
This path will collapse back to a larger size if the energy is
decreasing, and shrink to a smaller size if the energy is increasing.

If the at-rest motion plot can be created ( I know that I can't do
this plot by myself), then an animation of the ring torus figure
moving through space to create a spiral would help in visualizing this
figure. If this animation can slow down or speed up this would be
great..

-----------------------------------------------------------------------

"""
Draws a coil in 3D.

Mouse click to rotate the view.
Hit 'u' to start the animation (kill the program to stop it!)
"""

import vtk
import math
import time

offset = 0.0 #I'm going to use this to 'animate' the figure

def trajectory(t):
"""
returns 3D positions, as a function of one parameter, t
"""
global offset
r1 = 1.0
r0 = 0.2
omega=5.0
z = r1*math.sin(omega*t+offset)
y = r1*math.cos(omega*t+offset)
x = 0.5*t
return (x,y,z)

s = vtk.vtkProgrammableSource()
def Execute():
"""The Execute method to be called by the source object"""
#make a range of parameter values
tVals = numpy.arange(0,2*math.pi,0.05)
#convert these to positions
positions = [trajectory(t) for t in tVals]

#construct a VTK polydata object: a single poly-line 'cell'
dataset = s.GetPolyDataOutput()
points = vtk.vtkPoints()
cells = vtk.vtkCellArray()
cells.InsertNextCell(len(positions))
for p in positions:
id = points.InsertNextPoint(*p)
cells.InsertCellPoint(id)
dataset.SetPoints(points)
dataset.SetLines(cells)
return dataset
s.SetExecuteMethod(Execute)

#convert (poly)lines to a tube
t = vtk.vtkTubeFilter()
t.SetInput(s.GetOutput())
t.SetNumberOfSides(10)

#make surface normals, so it renders smooth
n = vtk.vtkPolyDataNormals()
n.SetInput(t.GetOutput())

#boiler-plate VTK stuff....
m=vtk.vtkPolyDataMapper()
m.SetInput(n.GetOutput())

a=vtk.vtkActor()
a.SetMapper(m)

ren = vtk.vtkRenderer()

renwin = vtk.vtkRenderWindow()

iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renwin)

#add a simple animation routine, activated by the 'u' keypress
def Animate(obj, evt):
global offset
while 1: #need to kill the program to quit
offset += 0.1
s.Modified()
renwin.Render()
time.sleep(0.05)
iren.Initialize()
iren.Start()

Can anyone help me to create this plot?

Thanks for any help!

Hubert fitch

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier