MatLab program file plot in Python ?

My first post here. Hello.

What is the syntax for Python matrix transformations ? I’ve been using an “.m” file from MatLab. It makes a plot that looks like this (the “cup” in the second part of the animation) …

http://www.goldenmean.info/predictions/grailani3.gif

Here is the .m file.

Here is the basic line plot used in the animation …

Line[{{0.007+0.039Cos[a±8.800],0.067±0.004Cos[a±8.800],0.039Sin[a±8.800]},{0.007+0.044Cos[a±8.400],0.076±0.004Cos[a±8.400],0.044Sin[a±8.400]}}]

It’s basically repeated recursively to create the shapes in the animation.

I tried using Math Viz to recreate the plot but I don’t know the correct Python syntax. The following screen shot shows some Python entries into the Math Viz add-on.

[ATTACH=CONFIG]146934[/ATTACH]

Am I barking up the right tree here ? It looks like Python should be able to reproduce what’s in the .m file.

I made some progress with this … see this page on my website. I have converted the syntax to Blender Python but so far I’m just getting straight lines plotted in the Blender 3D window.http://blenderscripting.blogspot.com/2011/05/blender-25-python-bezier…

I just need some guidance on how to actually plot the golden mean helix that is described in the MATLAB program file. Do I use curves ? OR Bezier curves ? Or maybe NURBS ?

Any help appreciated.

With mathviz the idea, from what I can tell after using it for a few days, is that it allows you to visually see the effects of transformations using [‘Euler’, ‘Matrix’, ‘Quaternion’, ‘Vector’, (…), ‘geometry’ ]. I don’t think its strength will be psychedelic stuff you are trying to do. With mathviz, the line command can take a list of Vectors.


line = [Vector(1), Vector(2), Vector(3), ......(Vector(N))]

you can probably take it from there :slight_smile: something like this. run this in a fresh mathutils Viz session


empty_list = []
b = 0.04
for i in range(280):
    a = i*b
    empty_list.append(Vector((  0.007 + 0.039 * cos( a + -8.800 ), 
                                0.067 + -0.004 * cos( a + -8.800), 
                                0.039 * sin( a + -8.800))))

Also you can refresh that blogpost, I updated it with more information towards the end (you might want to set the curve type to ‘CARDINAL’. I haven’t figured out how to get that to display anything other than point data yet.

Thanks so much ! Yes, well that is exactly it. The code I have at the moment is only capable of plotting straight lines as far as I understand this. The “.m” file I have was meant for an old browser plugin LiveGraphics3D for showing Mathematica output in the browser (it’s NOT for MATLAB, my bad). However the .m file is full of Mathematica “Line” statements that are just that … directives to DRAW LINES. So I’m somewhat confused here as to how what I have could ever draw CURVES. Maybe it never did ?