This library allows you to quickly and easily implement cellular automata calculations in your processing applets. The results from the library are accurate and have been validated against results from matematica.
You can download the library from http://www.fadarch.com/ca/index.html
Monday, December 31, 2007
Sunday, December 30, 2007
Wednesday, October 24, 2007
Wednesday, October 10, 2007
Matrix Library is now available for download on processing.org
You can now download the matrix math library directly from the processing website.
http://processing.org/reference/libraries/index.html
http://processing.org/reference/libraries/index.html
Sunday, September 30, 2007
Processing Matrix Library
The MatrixMath library will let you perform a number of different matrix operations in the processing development environment. For more information about processing go to processing.org
Source Code
download v1.1
I have set up website for the library with complete documentation
http://pmatrix.blogspot.com/
Source Code
download v1.1
I have set up website for the library with complete documentation
http://pmatrix.blogspot.com/
Saturday, September 29, 2007
CSFEM Feedback V7 0.1.7
This script is intended to work with CSFEM. An existing structural analysis plug in for Maya.
The script provides a framework for working with the output from CSFEM in a more productive and generative way.
The plug-in allows you to edit and select members based on a variety of criteria output from the analysis.
Monday, September 10, 2007
PointToMesh alpha1
This is kind of a messy script but it was the first mel script I ever wrote... one of these days I'll fix it up. The script will use a particle field to create a polygon mesh.
Friday, September 7, 2007
Hemostasis:(processing scripts)
Click these links to view the interactive applet:
Flocking Version (NEW)
Hemostasis V1
HemoStasis V2
Hemostasis:(processing scripts)
These two processing scripts were written by Francis Bitonti and Brian Osborn
Click these links to view the interactive applet:
Hemostasis V1
HemoStasis V2
<
Flocking Version (NEW)
Hemostasis V1
HemoStasis V2
Hemostasis:(processing scripts)
These two processing scripts were written by Francis Bitonti and Brian Osborn
Click these links to view the interactive applet:
Hemostasis V1
HemoStasis V2
<
/*
written by Francis Bitonti and Brian Osborn
Latest Update: 09102007
*/
//We will borrow a pre-built particle system from Traer physics library and the will use the pdf library for export
import traer.physics.*;
import processing.pdf.*;
//setup for pdf recording functions (snapshot on key command)
boolean recording;
PGraphicsPDF pdf;
//positons for lines
float[] posA;
float[] posB;
//we will use this variable to determine the size of the opening of the cut
float[] heal;
//we will use this variable to determine the attraction (collagen level) of the opening of the cut
float[] col;
//Set "cut" particles as attractor
Particle[] cut;
//set "platelet" particles as array
Particle[] platelets;
//set "redBloodCells" particles as array
Particle[] redBloodCells;
Attraction[][] pull;
//Establish number of particles in each system
ParticleSystem physics;
int gridSizePlatelet = 100;
int gridSizeCut = 20;
int gridSizeRedBloodCell = 100;
float[] x;
float[] y,yA;
void setup(){
size(600,300);
background(255);
frameRate(60);
smooth();
ellipseMode(CENTER);
//noCursor();
//declare floats x,y, and yA
x = new float[gridSizePlatelet];
y = new float[gridSizePlatelet];
yA = new float[gridSizePlatelet];
heal = new float[gridSizeCut];
col = new float[gridSizeCut];
for(int i= 0; i < gridSizeCut; i++){
heal[i] = 10;
col[i] = 10000;
}
posA = new float[gridSizePlatelet];
posB = new float[gridSizePlatelet];
for (int plateletNumber = 0; plateletNumber x[plateletNumber] = random(0,width);
y[plateletNumber] = random(0,height);
yA[plateletNumber] = random((height/2)-100,(height/2)+100);
}
//call physics library and set up the cut, platelet, and redBloodCells particles systems
physics = new ParticleSystem(0,1);
pull = new Attraction[gridSizeCut][gridSizePlatelet];
cut = new Particle[gridSizeCut];
for(int cutNumber = 0; cutNumber < gridSizeCut; cutNumber ++){
cut[cutNumber] = physics.makeParticle();
cut[cutNumber].makeFixed();
}
platelets = new Particle[gridSizePlatelet];
redBloodCells = new Particle[gridSizeRedBloodCell];
// draw platelets (set mass)
for(int i = 0; i < gridSizePlatelet; i++){
platelets[i] = physics.makeParticle(1,x[i],y[i],0.0);
}
for (int cutAttraction = 0; cutAttraction < gridSizeCut; cutAttraction ++){
for (int plateletAttraction = 0; plateletAttraction < gridSizePlatelet; plateletAttraction ++){
//this is an important setting
pull[cutAttraction][plateletAttraction] = physics.makeAttraction(cut[cutAttraction], platelets[plateletAttraction], 10000, 40);
}
}
for (int wound = 0; wound < gridSizePlatelet; wound ++){
for (int woundSub = 0; woundSub < gridSizePlatelet; woundSub ++){
physics.makeAttraction(platelets[wound],platelets[woundSub],-50,1);
}
}
}
void draw(){
for(int lineN = 0; lineN < gridSizePlatelet; lineN++){
posA[lineN] = platelets[lineN].position().x();
posB[lineN] = platelets[lineN].position().y();
}
//controls the fade
stroke(0,0,0);
//controles the fade
fill(255,255,255,5);
rect(0,0,width,height);
physics.tick();
for(int lineN = 0; lineN < gridSizePlatelet; lineN++){
if(platelets[lineN].velocity().x() > 10 || platelets[lineN].velocity().y() > 10){
stroke (236,0,140);
line(platelets[lineN].position().x(),platelets[lineN].position().y(),posA[lineN],posB[lineN]);
}
}
stroke(0,0,0,128);
fill(0,0,0,128);
//draw ellipses at platelets
for(int j = 0; j < gridSizePlatelet; j++){
ellipse( platelets[j].position().x(),platelets[j].position().y(), .7, .7);
}
//draw ellipses at red blood cells
for(int k = 0; k < gridSizeRedBloodCell; k++){
if(platelets[k].velocity().x() > 10 || platelets[k].velocity().y() > 10){
fill(236,0,140);
ellipse( platelets[k].position().x(),platelets[k].position().y(), 3, 3);
}
}
//find out if the cuts are being healed
for (int cutAttraction = 0; cutAttraction < gridSizeCut; cutAttraction ++){
for (int plateletAttraction = 0; plateletAttraction < gridSizePlatelet; plateletAttraction ++){
if(platelets[plateletAttraction].position().x() < cut[cutAttraction].position().x() + 50 && platelets[plateletAttraction].position().y() < cut[cutAttraction].position().y() + 50 && platelets[plateletAttraction].position().x() > cut[cutAttraction].position().x() - 50 && platelets[plateletAttraction].position().y() > cut[cutAttraction].position().y() - 50){
heal[cutAttraction] = heal[cutAttraction] - 0.001;
}
if(heal[cutAttraction] < 0){
heal[cutAttraction] = 0;
for (int plateletAttraction2 = 0; plateletAttraction2 < gridSizePlatelet; plateletAttraction2 ++){
pull[cutAttraction][plateletAttraction2].setMinimumDistance(0);
pull[cutAttraction][plateletAttraction2].setStrength(0);
}
}
}
//draw the cut ellipses; size and color based on state in healing process
for (int cutLocation = 0; cutLocation < gridSizeCut; cutLocation ++){
cut[cutLocation].moveTo(x[cutLocation], yA[cutLocation], 0);
stroke (400-(25.5*heal[cutLocation]),0,140);
fill(255);
ellipse(cut[cutLocation].position().x(), cut[cutLocation].position().y(), heal[cutLocation], heal[cutLocation]);
}
}
}
//this is for relocating each individual cut in real time
void keyPressed() {
if (key == '0') {
x[0] = mouseX;
yA[0] = mouseY;
}
if (key == '1') {
x[1] = mouseX;
yA[1] = mouseY;
}
if (key == '2') {
x[2] = mouseX;
yA[2] = mouseY;
}
if (key == '3') {
x[3] = mouseX;
yA[3] = mouseY;
}
if (key == '4') {
x[4] = mouseX;
yA[4] = mouseY;
}
if (key == '5') {
x[5] = mouseX;
yA[5] = mouseY;
}
if (key == '6') {
x[6] = mouseX;
yA[6] = mouseY;
}
if (key == '7') {
x[7] = mouseX;
yA[7] = mouseY;
}
if (key == '8') {
x[8] = mouseX;
yA[8] = mouseY;
}
if (key == '9') {
x[9] = mouseX;
yA[9] = mouseY;
}
if (key == '0' && key == 'q') {
x[10] = mouseX;
yA[10] = mouseY;
}
if (key == '1' && key == 'q') {
x[11] = mouseX;
yA[11] = mouseY;
}
if (key == '2' && key == 'q') {
x[12] = mouseX;
yA[12] = mouseY;
}
if (key == '3' && key == 'q') {
x[13] = mouseX;
yA[13] = mouseY;
}
if (key == '4' && key == 'q') {
x[14] = mouseX;
yA[14] = mouseY;
}
if (key == '5' && key == 'q') {
x[15] = mouseX;
yA[15] = mouseY;
}
if (key == '6' && key == 'q') {
x[16] = mouseX;
yA[16] = mouseY;
}
if (key == '7' && key == 'q') {
x[17] = mouseX;
yA[17] = mouseY;
}
if (key == '8' && key == 'q') {
x[18] = mouseX;
yA[18] = mouseY;
}
if (key == '9' && key == 'q') {
x[19] = mouseX;
yA[19] = mouseY;
}
if (key == 'w') {
stroke(0,0,0);
fill(255,255,255,255);
rect(0,0,width,height);
}
if (key == 'e'){
// draw platelets
for(int i = 0; i < gridSizePlatelet; i++){
platelets[i] = physics.makeParticle(1,x[i],y[i],0.0);
}
for (int cutAttraction = 0; cutAttraction < gridSizeCut; cutAttraction ++){
for (int plateletAttraction = 0; plateletAttraction < gridSizePlatelet; plateletAttraction ++){
//this is an important setting
physics.makeAttraction(cut[cutAttraction], platelets[plateletAttraction], 10000, 40);
}
}
for (int wound = 0; wound < gridSizePlatelet; wound ++){
for (int woundSub = 0; woundSub < gridSizePlatelet; woundSub ++){
physics.makeAttraction(platelets[wound],platelets[woundSub],-50,1);
}
}
}
//This is for the record on keypress function
if (key == 'a') {
if (recording) {
endRecord();
println("Recording stopped.");
recording = false;
}
else {
beginRecord(PDF, "frame-####.pdf");
println("Recording started.");
recording = true;
}
}
else if (key == 's') {
if (recording) {
endRecord();
}
exit();
}
if (key == 'z') {
// pull[0].setMinimumDistance(500);
// pull[1].setMinimumDistance(500);
// pull[2].setMinimumDistance(500);
println("reset Distance");
println(physics.getAttraction(1));
for (int cutAttraction = 0; cutAttraction < gridSizeCut; cutAttraction ++){
for (int plateletAttraction = 0; plateletAttraction < gridSizePlatelet; plateletAttraction ++){
pull[cutAttraction][plateletAttraction].setStrength(-1000);
}
}
}
if (key == 'x') {
println("reset Distance");
println(physics.getAttraction(1));
for (int cutAttraction = 0; cutAttraction < gridSizeCut; cutAttraction ++){
for (int plateletAttraction = 0; plateletAttraction < gridSizePlatelet; plateletAttraction ++){
pull[cutAttraction][plateletAttraction].setStrength(10000);
}
}
}
if (key == 'c') {
println("reset Distance");
println(physics.getAttraction(1));
for (int cutAttraction = 0; cutAttraction < gridSizeCut; cutAttraction ++){
for (int plateletAttraction = 0; plateletAttraction < gridSizePlatelet; plateletAttraction ++){
pull[cutAttraction][plateletAttraction].setMinimumDistance(80);
}
}
}
if (key == 'v') {
println("reset Distance");
println(physics.getAttraction(1));
for (int cutAttraction = 0; cutAttraction < gridSizeCut; cutAttraction ++){
for (int plateletAttraction = 0; plateletAttraction < gridSizePlatelet; plateletAttraction ++){
pull[cutAttraction][plateletAttraction].setMinimumDistance(40);
}
}
}
if (key == 'r') {
// draw platelets (set mass)
for(int i = 0; i < gridSizePlatelet; i++){
platelets[i].moveTo(x[i],y[i],0.0);
}
}
}
Thursday, September 6, 2007
Script/INE (Universal Garden)
I created this image and a series of diagrams for the Script/INE exhibition at the F.U.E.L Gallery in
There where a number of scripts developed to make this project possible. However, I have posed the two scripts that I feel are the “engine” of the project. You can download all the tools I developed from the link on the upper right hand corner of this page under the download my scripts heading.
int $loopA;
int $loopB;
$loopB = 0;
$loopA = 0;
int $blindDataArray[];
string $dataArray[];
int $data;
$data = 0;
int $typeCheck;
$typeCheck = 0;
int $size;
int $type;
$type = 7;
int $oneC;
$oneC = 0;
int $zeroC;
$zeroC = 0;
int $last;
$last = 0;
int $add2;
$add2 = 0;
int $add;
$add = 0;
//string $FEM_selected[] = `ls -sl`;
//$femSize=size($FEM_selected);
string $dataArray2[];
int $size2;
select -r Mesh ;
ConvertSelectionToFaces;
$dataArray2 = `ls -sl -fl`;
$size2 = size($dataArray2);
select -cl ;
while($loopA < $size2){ select -r Mesh.f[$loopA] ; // select -r Mesh.f[0]; $blindTest2 = `polyQueryBlindData -showComp`; print ($blindTest2[0]+"\n"); print ($blindTest2[1]); $blindConv2 = $blindTest2[1]; $typeCheck = $blindConv2; if($typeCheck == 1){ print"one\n"; $type = 1; } if($typeCheck == 0){ print"Zero\n"; $type = 0; } ConvertSelectionToEdges; ConvertSelectionToFaces; $dataArray = `ls -sl -fl`; $size = size($dataArray); print($size + "\n"); select -cl ; while($loopB < (size($dataArray))){ select -r $dataArray[$loopB] ; $blindTest = `polyQueryBlindData -showComp`; print ($blindTest[0]+"\n"); print ($blindTest[1]); $blindConv = $blindTest[1]; $blindDataArray[$loopB] = $blindConv; $last = $blindDataArray[$loopB]; if($last == 0){ $zeroC = $zeroC + 1; } if($last == 1){ $oneC = $oneC + 1; } $loopB = $loopB + 1; } if($type = 1 && $oneC <> 3){
select -r Mesh.f[$loopA] ;
print("death\n");
polyBlindData -id 0 -associationType "face" -longDataName "number" -doubleData 0.0;
}
if($type = 1 && $oneC == 2 || $oneC == 3){
select -r Mesh.f[$loopA] ;
print("dance\n");
polyBlindData -id 0 -associationType "face" -longDataName "number" -doubleData 1.0;
$blindTest = `polyQueryBlindData -showComp`;
print ($blindTest[0]+"\n");
print ($blindTest[3]);
$blindConv = $blindTest[3];
$add2 = $blindConv;
$add = $add2 + 1;
polyBlindData -id 1 -associationType "face" -longDataName "numberA" -doubleData $add;
}
if($type = 0 && $oneC == 3){
select -r Mesh.f[$loopA] ;
print("birth\n");
polyBlindData -id 0 -associationType "face" -longDataName "number" -doubleData 1.0;
$blindTest = `polyQueryBlindData -showComp`;
print ($blindTest[0]+"\n");
print ($blindTest[3]);
$blindConv = $blindTest[3];
$add2 = $blindConv;
$add = $add2 + 1;
polyBlindData -id 1 -associationType "face" -longDataName "numberA" -doubleData $add;
}
print($oneC + "\n");
print($zeroC + "\n");
$oneC = 0;
$add = 0;
$add2 = 0;
$zeroC = 0;
clear($dataArray);
print("\n");
print("\n");
$loopA = $loopA + 1;
$loopB = 0;
}
global proc twirlSprout(){
float $ran;
int $out;
int $randCont;
$randCount = 0;
int $evalu[];
int $masterCount;
matrix $matr[22] [22];
int $rotChoiceX;
int $rotChoiceY;
int $rotChoiceZ;
float $rotX;
float $rotY;
float $rotZ;
int $i;
int $scalChoiceX;
int $scalChoiceY;
int $scalChoiceZ;
float $scalX;
float $scalY;
float $scalZ;
int $randPrint;
int $sproutLoop;
float $temp[];
int $q;
int $w;
while ($randCount<22){ ran =" rand(0,1);" out =" 1;"> 0.5){
$evalu[$randCount] = 0;
$out = 0;
}
$randCount = $randCount + 1;
}
$randPrint = 0;
while($randPrint < randprint =" $randPrint" evalu =" {1," rev =" 14;" x =" 0;" j =" 0;" j =" 0;" mastercount =" 0;" check =" $j" check =" 0;" j =" $j" mastercount =" $masterCount" x =" $x" j =" 0;" i =" 0;" q =" 0;" w =" 0;" w =" 0;" w =" $w" q =" $q" sproutloop =" 0;" rotchoicex =" $matr[2]" rotchoicey =" $matr[2]" rotchoicez =" $matr[2]" scalchoicex =" $matr[2]" scalchoicey =" $matr[2]" scalchoicez =" $matr[2]" rotchoicex ="="" rotx =" -20;" scalx =" 0.9;" rotchoicex ="="" rotx =" 0;" scalx =" 1.01;" rotchoicey ="="" roty =" -20;" scaly =" 0.9;" rotchoicey ="="" roty =" 0;" scaly =" 1.01;" rotchoicez ="="" rotz =" -20;" scalz =" 1.01;" rotchoicez ="="" rotz =" 0;" scalz =" 0.9;" tempselection =" `ls" sproutloop =" $sproutLoop" rotchoicex =" $matr[2]" rotchoicey =" $matr[2]" rotchoicez =" $matr[2]" scalchoicex =" $matr[2]" scalchoicey =" $matr[2]" scalchoicez =" $matr[2]" rotchoicex ="="" rotx =" 20;" scalx =" 0.9;" rotchoicex ="="" rotx =" 0;" scalx =" 1.01;" rotchoicey ="="" roty =" 20;" scaly =" 0.9;" rotchoicey ="="" roty =" 0;" scaly =" 1.01;" rotchoicez ="="" rotz =" 20;" scalz =" 1.01;" rotchoicez ="="" rotz =" 0;" scalz =" 0.9;" tempselection =" `ls" sproutloop =" $sproutLoop" selco =" 0;" dataarray =" `ls" size =" size($dataArray);" selco =" $selCo">
Subscribe to:
Posts (Atom)