Cellular Automata Experiment: 02
Intialize
Defines System Name for file export later
In[86]:=
Import raster image, get RGB vector list and stripping the Mathematica Graphics data.
In[138]:=
Acceleration Field
Wrap vectors in function named 'vector' so it will work with the Cellular Automata function. The Cellular Automata function utilizes a ListCorrelate while workings and the vector list causes errors. Later this 'vector' function will return the vector list unchanged.
In[63]:=
Acceleration
The Acceleration function takes a 2D list of symbols represeting 3D vectors and outputs a new symbol of the sum of the cross products of the vectors in the Von Neuman neighborhood times the time enveloped by a Sin curve. This will give an every increasing magintude to the acceleration that will increase in cycles.
In[64]:=
Define the intial conditions of the Cellular Automata inculding the number of time steps.
In[65]:=
Run the Cellular Automat
In[68]:=
Velocity Field
Velocity
Takes the acceleration field and a 2D list of 3D vectors as the initial velocity and compiles a velocity field at each time step by adding the acceleration at that time step to the previous time step's velocity.
In[69]:=
Produce still initial velocity and calculate velocity field.
In[70]:=
Surfaces
SurfaceField
Similiar to the Velocity function. Given the velocity field and a 2D list of 3D vectors as the positions of the vertices of the surface, the function compiles a series of coordinates at each time step by moving each point by the velocity of that point at each time step.
In[72]:=
In[73]:=
Visualization
In[75]:=
Plots of X axis coordinates
In[76]:=
Plots of Y axis coordinates
In[77]:=
Plots of Z axis coordinates
In[78]:=
Velocity vectors at points on transformed surfaces.
In[89]:=
Out[89]=
Output Surfaces
melEncoding
Requires a 2D List of 3D vectors and integer number for labeling purposes. Begin formatting array of vectors for export by converting to a string and replacing ','s with a space. Initialize counters. 'i' for CV's in u direction. 'j' for CV's in v direction. 'd' gives size of image. Then move through lists and replace characters with mel code to select the surface and move the CV according to the SurfaceArray vectors. Finally add mel code header that creates the nurbs suface. Return String of mel code that creates nurbsPlane and moves CV's to locations in 2D list.
In[80]:=
melSurfaceCompile
Takes the list of surface coordinates and produces one surface at each time step.
In[81]:=
In[82]:=
Export strings into .mel file.
In[83]:=
Out[83]=
In[90]:=
Out[90]=
Created by Mathematica (October 23, 2006) |