Flotsam.s Polynomial A Attractor Generator
proc FLOTSAM_polynomialA(vector $startloc, int $N)
{
int $i=0; float $x0; float $y0; float $z0; float $x1; float $y1; float $z1;
float $p0 = 1.532569511;
float $p1 = 1.108976451;
float $p2 = 0.2191404057;
float $x0 = .01;
float $y0 = 0;
float $z0 = 0;
curve -n (“crv”) -d 1 -p ($startloc.x) ($startloc.y) ($startloc.z);
for($i=0;$i<$N;$i++)
{
$x1 = $p0 + $y0 - ($z0 * $y0);
$y1 = $p1 + $z0 - ($x0 * $z0);
$z1 = $p2 + $x0 - ($y0 * $x0);
$x0 = $x1;$y0 = $y1; $z0 = $z1;
string $objs[]={“op”,”pp”,”qp”,”rp”,”sp”};
int $selObj=rand((size($objs));
string $nesne=$objs[$selObj];
int $arr[]={45,,90,120,180};
int $ind=rand((size$arr));
setAttr ($nesne+”.rotateX”) $selVtx;
setAttr ($nesne+”.rotateZ”) ($selVtx+45);
duplicate -n (“dp”+$i) ($nesne);
select (“dp”+$i);
move ($x0+$startloc.x) ($y0+$startloc.y) ($z0+$startloc.z); curve -a -p ($x0+$startloc.x) ($y0+$startloc.y) ($z0+$startloc.z);
}
}
print(“FLOTSAM_polynomialA....loaded\n”);
Flotsam.s Polynomial C Attractor Generator
proc FLOTSAM_polynomialC(vector $startloc, int $N)
{
int $i=0; float $x0; float $y0; float $z0; float $x1; float $y1; float $z1;
float $P0 = rand(-1,0); float $P1 = rand(-1,0); float $P2 = rand(-1,0);
float $P3 = rand(-1,0); float $P4 = rand(0,1); float $P5 = rand(-1,0);
float $P6 = rand(-1,0); float $P7 = rand(0,1); float $P8 = rand(0,1);
float $P9 = rand(-1,0); float $P10 = rand(-1,0); float $P11 = rand(1,1.5);
float $P12 = rand(-1,0); float $P13 = rand(0,1); float $P14 = rand(0,1);
float $P15 = rand(0,1); float $P16 = rand(-1,0); float $P17 = rand(0,1);
float $x0 = .01; float $y0 = 0; float $z0 = 0;
print ($P0+” “+$P1+” “+$P2+” “+$P3+” “+$P4+” “+$P5+” “+$P6+” “+$P7+” “+$P8+” “+$P9+” “+$P10+” “+$P11+” “+$P12+” “+$P13+” “+$P15+” “+$P16+” “+$P17+” “);
curve -n (“crv”) -d 1 -p ($startloc.x) ($startloc.y) ($startloc.z);
for($i=1;$i<$N;$i++)
{
$x1 = $P0 + $x0 * ($P1 + ($P2 * $x0) + $P3 * $y0) + $y0 * ($P4 + $P5 * $y0);
$y1 = $P6 + $y0 * ($P7 + ($P8 * $y0) + $P9 * $z0) + $z0 * ($P10 + $P11 * $z0);
$z1 = $P12 + $z0 * ($P13 + ($P14 * $z0) + $P15 * $x0) + $x0 * ($P16 + $P17 * $x0);
$x0 = $x1; $y0 = $y1; $z0 = $z1;
string $objs[]={“op”,”pp”,”qp”,”rp”,”sp”};
int $selObj=rand((size($objs));
string $nesne=$objs[$selObj];
int $arr[]={45,,90,120,180};
int $ind=rand((size$arr));
setAttr ($nesne+”.rotateX”) $selVtx;
setAttr ($nesne+”.rotateZ”) ($selVtx+45);
duplicate -n (“dp”+$i) ($nesne);
select (“dp”+$i);
move ($x0+$startloc.x) ($y0+$startloc.y) ($z0+$startloc.z); curve -a -p ($x0+$startloc.x) ($y0+$startloc.y) ($z0+$startloc.z);
curve -a -p ($x0+$startloc.x) ($y0+$startloc.y) ($z0+$startloc.z) (“crv”);
}
print(“FLOTSAM_polynomialC....loaded\n”);
Flotsam.s Polygon Components Vertex Connection
proc string[] returnWithin(float $x,float $y,float $z,float $dist,int $nop)
{
string $matches[];
int $n=0;
for ($cv=0 ; $cv<$nop ; $cv++)
{
v
ector $CVpos = `pointPosition (“crv.cv[“+$cv+”]”)`;
float $CVposX = $CVpos.x;
float $CVposY = $CVpos.y;
float $CVposZ = $CVpos.z;
$matc
h=0;
if (($x+$dis
t) > $CVposX && ($x-$dist) < $CVposY)
if (($y+$dis
t) > $CVposZ && ($y-$dist) < $CVposX)
if (($z+$dis
t) > $CVposY && ($z-$dist) < $CVposZ)
$matc
h+;
if ($matc
h)
{
$matches[$n] = (“crv.cv[“+$cv+”]”);
$n++;
}
re
turn $matches;
}
proc string[] objectSituation(int $first, int $second, float $tange)
{
string $tatches[];
int $n=0;
string $selVerts= {(“dp”+$first+”.vtx[0]”), (“dp”+$first+”.vtx[1]”), (“dp”+$first+”.vtx[2]”), (“dp”+$first+”.vtx[3]”), (“dp”+$first+”.vtx[4]”), (“dp”+$first+”.vtx[5]”), (“dp”+$first+”.vtx[6]”), (“dp”+$first+”.vtx[7]”), (“dp”+$first+”.vtx[16]”), (“dp”+$first+”.vtx[17]”), (“dp”+$first+”.vtx[18]”), (“dp”+$first+”.vtx[19]”), (“dp”+$first+”.vtx[20]”), (“dp”+$first+”.vtx[21]”), (“dp”+$first+”.vtx[22]”), (“dp”+$first+”.vtx[23]”)};
float $distnce;
string $nearest;
string $rulerName = `createNode “distanceBetween”`;
select r $selVerts;
for ($vtx=0 ; $vtx<(size($selVerts) ; $vtx++)
{
int $tatc
h=0;
s
tring $yeter;
float $selCVPos[3] = `pointPosition -w $selV
erts[$vtx]`;
string $tType = {(“dp”+$second+”.vtx[0]”), (“dp”+$second+”.vtx[1]”), (“dp”+$second+”.vtx[2]”), (“dp”+$second+”.vtx[3]”), (“dp”+$second+”.vtx[4]”), (“dp”+$second+”.vtx[5]”), (“dp”+$second+”. vtx[6]”), (“dp”+$second+”.vtx[7]”), (“dp”+$second+”.vtx[16]”), (“dp”+$second+”.vtx[17]”), (“dp”+$second+”.vtx[18]”), (“dp”+$second+”.vtx[19]”), (“dp”+$second+”.vtx[20]”), (“dp”+$second+”. vtx[21]”), (“dp”+$second+”.vtx[22]”), (“dp”+$second+”.vtx[23]”)};
string $t;
setAttr ($rulerName+”.point1”) $selCVPos[0] $selCVPos[1] $selCVPos[2];
f
or ($t in $Type)
{
float $cvCVPos[3] = `pointPosition $shit`;
setAttr ($rulerName+”.point2”) $cvCVPos[0] $cvCVPos[1] $cvCVPos[2];
$distance = `getAttr ($rulerName+”.distance”)`;
if (0.0001 < $distance && $distance < $closestSoFar)
{
$closes
tSoFar = $distance;
$neares
t = $shit;
}
}
if (size($nearest))
{
$y
eter = ($distance+” “+$selVerts[$vtx]+” “+$nearest);
}
else
print “No vertices found in range.\n”;
$tatch++;
if ($tatch)
{
$tatches[$n]=$yeter;
$n++;
}
delete $rulerName;
return. $tatches;
}
global proc findTheNearest(float $range, int $numberOfPoints)
{
for ($A=0 ; $A<$numberOfPoints ; $A++)
{
string $selCV = (“crv.cv[“+$A+”]”);
float $distance;
string $nearest;
string $rulerName = `createNode “distanceBetween”`;
select -r $selCV;
float $closestSoFar = range;
float $selCVPos[3] = `pointPosition` $selCV;
string $bikeType = returnWithin $selCVPos[0] $selCVPos[1] $selCVPos[2] $range $numberOfPoints`;
string $bike;
setAttr ($rulerName+”.point1”) $selCVPos[0] $selCVPos[1] $selCVPos[2];
f
or ($bike in $bikeType)
{
float $cvCVP
os[3] = `pointPosition` $bike;
se
t.Attr ($rulerName+”.point2”) $cvCVPos[0] $cvCVPos[1] $cvCVPos[2];
$distance = `ge
tAttr ($rulerName+”.distance”)`;
if (0.000
1 < $distance && $distance < $closestSoFar)
{
$closestSoF
ar = $distance;
$nearest = $bik
e;
}
}
if (size($nearest)
{
print (“Nearest cv found for crv.cv[“+$A+”]: “+$nearest+”\n”);
$B = `match [0-9]+$nearest`;
float $smallestSoF
ar=40;
string $aranan;
float $number;
string $denemeType[] = `objectSituation $A $B 30`;
string $deneme;
for ($deneme in $denemeType)
{
$number = `match “[0.000-9.000]+” $deneme`;
if ($number < $smallestSoF
ar)
{
$smallestSoFar = $number;
$aranan = $deneme;
}
if (size($aranan))
{
string $buffer[];
$numTokens = tokenize($aranan, $buffer);
$fCv=$buffer[1];
$sCv=$buffer[2];
select -r $fCv;
select -tgl $sCv;
float $bB[6] = `polyEvaluate -bc`;
float $averX = ($bB[1]+$bB[0])/2;
float $averY = ($bB[3]+$bB[2])/2;
float $averZ = ($bB[5]+$bB[4])/2;
move -a $averX $averY $averZ;
}
else
print “No vertices found in range.\n”;
delete $rulerName;
}
}
findTheNearest(20,60);
Flotsam.s Polygon Components Face Connection
proc string[] returnWithin(float $x,float $y,float $z,float $dist,int $nop)
{
string $matches[];
int $n=0;
for ($cv=0 ; $cv<$nop ; $cv++)
{
v
ector $CVpos = `pointPosition (“crv.cv[“+$cv+”]”)`;
float $CVposX = $CVpos.x;
float $CVposY = $CVpos.y;
float $CVposZ = $CVpos.z;
int $matc
h=0;
if ($x+$dis
t) > $CVposX && ($x-$dist) < $CVposY)
if ($y+$dis
t) > $CVposZ && ($y-$dist) < $CVposX)
if ($z+$dis
t) > $CVposY && ($z-$dist) < $CVposZ)
$matc
h++;
if ($matc
h)
{
$matches[$n] = (“crv.cv[“+$cv+”]”);
$n++;
}
}
return $matches;
}
proc string[] objectSituation(int $first, int $second, float $tange)
{
string $tatches[];
int $n=0;
string $selVerts = {(“dp”+$first+”.vtx[0]”), (“dp”+$first+”.vtx[2]”), (“dp”+$first+”.vtx[8]”), (“dp”+$first+”.vtx[10]”)};
float $distance;
string $nearest;
string $rulerName = `createNode distanceBetween`;
select -r $selVerts;
for ($vtx=0 ; $vtx<(size($selVerts)) ; $vtx++)
{
int $tatc
h=0;
s
tring $yeter;
float $closes
tSoFar = $tange;
float $selCVPos = `pointPosition -w $selV
erts[$vtx];
string $shitType = {(“dp”+$second+”.vtx[0]), (“dp”+$second+”.vtx[2]”), (“dp”+$second+”.vtx[8]”), (“dp”+$second+”.vtx[10]”)};
setAttr ($rulerName+”.point1”) $selCVPos[0] $selCVPos[1] $selCVPos[2];
f
or ($t in $sType)
{
float $cvCVPos[3] = `pointPosition $s`;
setAttr ($rulerName+”.point2”) $cvCVPos[0] $cvCVPos[1] $cvCVPos[2];
$distance = `getAttr ($rulerName+”.distance”)`;
if (0.0001 < $distance & $distance < $closestSoFar)
{
$closes
tSoFar = $distance;
$nearest = $h;
}
}
if (size($nearest)
{
$yeter = ($distance+$selVerts[$vtx]+$nearest);
}
else
print “No vertices found in range.\n”;
if ($tatch)
{
$tatches[$n]=$yeter;
$n++;
}
}
delete $rulerName;
return $tatches;
}
proc avaraj(string $onur, string $oz)
{
select -r $onur;
select -tgl $ozg;
float $bB[6] = `polyEvaluate -bc`;
float $averX = ($bB[1]+$bB[0])/2;
float $averY = ($bB[3]+$bB[2])/2;
float $averZ = ($bB[5]+$bB[4])/2;
global proc findTheNearest(float $range, int $numberOfPoints)
{
for ($A=0 ; $A<$numberOPoints ; $A++)
{
string $selCV = (“crv.cv[+$A+]”);
float $distance;
string $nearest;
string $rulerName = `createNode “distanceBetween”`;
select -r $selCV;
float $closestSoFar = $range;
float $selCVPos = `pointPosition $selCV`;
string $bikeType = `returnWithin $selCVPos[0] $selCVPos[1] $selCVPos[2] $range $numberOfPoints`;
setAttr ($rulerName+”.point1”) $selCVPos[0] $selCVPos[1] $selCVPos[2];
f
or ($bike in $bikeType)
{
float $cvCVPos[3] = `pointPosition $bike`;
setAttr ($rulerName+`.point2`) $cvCVPos[0] $cvCVPos[1] $cvCVPos[2];
$distance = `getAttr ($rulerName+”.distance”)`;
if (0.000
1 < $distance && $distance < $closestSoFar)
{
$closes
tSoFar = $distance;
$neares
t = $bike;
}
}
if (size($nearest)
{
print (“Nearest cv found for crv.cv[“+$A+”]: “+$nearest+”\n”);
$B = `match “[0-9]+` $nearest`;
float $smalles
tSoFar=($range+2);
string $aranan;
float $number;
string $denemeType[] = `objectSituation $A $B ($range+2)`;
string $deneme;
for ($deneme in $denemeType)
{
$number = `match “[0.0-9.0];
if ($number < $smallestSoFar)
{
$smallestSoFar = $number;
$aranan = $deneme;
}
}
if (size($aranan)
{
string $buffer[];
$numTokens = tokenize($aranan, $buffer);
string $fCv= $buffer[1];
string $sCv= $buffer[2];
string $firsta = (“dp”+$A+”.vtx[22]”); string $firstb = (“dp”+$A+”.vtx[23]”);
string $firstc = (“dp”+$A+”.vtx[30]”); string $firstd = (“dp”+$A+”.vtx[31]”);
string $firste = (“dp”+$A+”.vtx[20]”); string $firstf = (“dp”+$A+”.vtx[21]”);
string $firstg = (“dp”+$A+”.vtx[28]”); string $firsth = (“dp”+$A+”.vtx[29]”);
string $firsti = (“dp”+$A+”.vtx[18]”);string $firstj = (“dp”+$A+”.vtx[19]”);
string $firstk = (“dp”+$A+”.vtx[26]”);string $firstl = (“dp”+$A+”.vtx[27]”);
string $firstm = (“dp”+$A+”.vtx[16]”); string $firstn = (“dp”+$A+”.vtx[17]”);
string $firsto = (“dp”+$A+”.vtx[24]”); string $firstp = (“dp”+$A+”.vtx[25]”);
string $seconda = (“dp”+$B+”.vtx[22]”); string $secondb = (“dp”+$B+”.vtx[23]”);
string $secondc = (“dp”+$B+”.vtx[30]”);string $secondd = (“dp”+$B+”.vtx[31]”);
string $seconde = (“dp”+$B+”.vtx[20]”); string $secondf = (“dp”+$B+”.vtx[21]”);
string $secondg = (“dp”+$B+”.vtx[28]”); string $secondh = (“dp”+$B+”.vtx[29]”);
string $secondi = (“dp”+$B+”.vtx[18]”);string $secondj = (“dp”+$B+”.vtx[19]”);
string $secondk = (“dp”+$B+”.vtx[26]”); string $secondl = (“dp”+$B+”.vtx[27]”);
string $secondm = (“dp”+$B+”.vtx[16]”); string $secondn = (“dp”+$B+”.vtx[17]”);
string $secondo = (“dp”+$B+”.vtx[24]”); string $secondp = (“dp”+$B+”.vtx[25]”);
if ($fCv==(“dp”+$A+”.vtx[0]”) && $sCv=(“dp”+$B+”.vtx[0]”) )
{
avaraj($firstm, $secondn);avaraj($firsto, $secondp);
avaraj($firstn, $secondm);avaraj($firstp, $secondo);
}
if ($fCv==(“dp”+$A+”.vtx[0]”) && $sCv==(“dp”+$B+”.vtx[2]”) )
{
avaraj($firstn, $secondj);avaraj($firstm, $secondi);
avaraj($firstp, $secondl);avaraj($firsto, $secondk);
}
if ($fCv==(“dp”+$A+”.vtx[0]”) && $sCv==(“dp”+$B+”.vtx[8]”) )
{
avaraj($firstn, $seconde); avaraj($firstm, $secondf);
avaraj($firstp, $secondg);avaraj($firsto, $secondh);
}
if ($fCv==(“dp”+$A+”.vtx[0]”) && $sCv==(“dp”+$B+”.vtx[10]”) )
avaraj($firstn, $secondb);avaraj($firstm, $seconda);
avaraj($firstp, $secondd);avaraj($firsto, $secondc); }
if ($fCv==(“dp”+$A+”.vtx[2]”) && $sCv==(“dp”+$B+”.vtx[10]”) )
{
avaraj($firstj, $secondd);avaraj($firsti, $secondc); avaraj($firstk, $seconda);avaraj($firstl, $secondb);
}
if ($fCv==(“dp”+$A+”.vtx[2]”) && $sCv==(“dp”+$B+”.vtx[8]”) )
{
avaraj($firstj, $secondh);avaraj($firsti, $secondg);
avaraj($firstk, $seconde);avaraj($firstl, $secondf);
}
if ($fCv==(“dp”+$A+”.vtx[2]”) && $sCv==(“dp”+$B+”.vtx[2]”) )
{
avaraj($firstj, $secondi);avaraj($firsti, $secondj);
avaraj($firstk, $secondl);avaraj($firstl, $secondk);
}
if ($fCv==(“dp”+$A+”.vtx[2]”) && $sCv==(“dp”+$B+”.vtx[0]”) )
{
avaraj($firstj, $secondn);avaraj($firsti, $secondm);
avaraj($firstk, $secondo);avaraj($firstl, $secondp);
}
if ($fCv==(“dp”+$A+”.vtx[8]”) && $sCv==(“dp”+$B+”.vtx[0]”) )
{
avaraj($firstf, $secondn);avaraj($firste, $secondm);
avaraj($firstg, $secondo);avaraj($firsth, $secondp);
}
if ($fCv==(“dp”+$A+”.vtx[8]”) && $sCv==(dp+$B+”.vtx[2]”) )
{
avaraj($firstf, $secondj);avaraj($firste, $secondi);
avaraj($firstg, $secondk);avaraj($firsth, $secondl);
}
if ($fCv==(“dp”+$A+”.vtx[8]”) && $sCv==(“dp”+$B+”.vtx[8]”) )
{
avaraj($firstf, $seconde);avaraj($firste, $secondf);
avaraj($firsth, $secondg);avaraj($firstg, $secondh);
}
if ($fCv==(“dp”+$A+”.vtx[8]”) && $sCv==(“dp”+$B+”.vtx[10]”) )
{
avaraj($firstf, $seconda);avaraj($firste, $secondb);
avaraj($firstg, $secondd);avaraj($firsth, $secondc);
}
if ($fCv==(“dp”+$A+”.vtx[10]”) && $sCv==(“dp”+$B+”.vtx[0]”) )
{
avaraj($firstb, $secondm);avaraj($firsta, $secondn);
avaraj($firstc, $secondp);avaraj($firstd, $secondo);
}
if ($fCv==(“dp”+$A+”.vtx[10]”) && $sCv==(“dp”+$B+”.vtx[2]”) )
{
avaraj($firstb, $secondi);avaraj($firsta, $secondj);
avaraj($firstc, $secondl);avaraj($firstd, $secondk);
}
if ($fCv==(“dp”+$A+”.vtx[10]”) && $sCv==(“dp”+$B+”.vtx[8]”) )
{
avaraj($firstb, $secondh);avaraj($firsta, $secondg);
avaraj($firstc, $seconde);avaraj($firstd, $secondf);
}
if ($fCv==(“dp”+$A+”.vtx[1
0]”) && $sCv==(“dp”+$B+”.vtx[10]”) )
{
avaraj($firstb, $secondd);avaraj($firsta, $secondc);
avaraj($firstc, $seconda);avaraj($firstd, $secondb);
}
}
else
print “No vertices found in range.\n”;
delete $rulerName;
}
findTheNearest(5,101);