favourite variations added,

"symmetry" renamed to "color_speed" (almost...)
This commit is contained in:
zueuk 2009-04-20 08:04:34 +00:00
parent cd8484c518
commit 30d649f150

View File

@ -231,7 +231,7 @@ begin
VarPossible := false; VarPossible := false;
for j := 0 to NRVAR - 1 do begin for j := 0 to NRVAR - 1 do begin
VarPossible := VarPossible or Variations[j]; VarPossible := VarPossible or RandomVariations[j];
end; end;
for i := 0 to cp.NumXForms - 1 do begin for i := 0 to cp.NumXForms - 1 do begin
@ -241,11 +241,11 @@ begin
if VarPossible then begin if VarPossible then begin
repeat repeat
a := random(NRVAR); a := random(NRVAR);
until Variations[a]; until RandomVariations[a];
repeat repeat
b := random(NRVAR); b := random(NRVAR);
until Variations[b]; until RandomVariations[b];
end else begin end else begin
a := 0; a := 0;
b := 0; b := 0;
@ -368,7 +368,7 @@ var
begin begin
t := cp.NumXForms; t := cp.NumXForms;
for i := 0 to t - 1 do for i := 0 to t - 1 do
cp.xform[i].density := 1.0 / t; cp.xform[i].weight := 0.5;
end; end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -379,12 +379,12 @@ var
begin begin
td := 0.0; td := 0.0;
for i := 0 to cp.NumXForms - 1 do for i := 0 to cp.NumXForms - 1 do
td := td + cp.xform[i].Density; td := td + cp.xform[i].weight;
if (td < 0.001) then if (td < 0.001) then
EqualizeWeights(cp) EqualizeWeights(cp)
else else
for i := 0 to cp.NumXForms - 1 do for i := 0 to cp.NumXForms - 1 do
cp.xform[i].Density := cp.xform[i].Density / td; cp.xform[i].weight := cp.xform[i].weight / td;
end; end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -397,12 +397,12 @@ begin
total_area := 0.0; total_area := 0.0;
for i := 0 to t - 1 do for i := 0 to t - 1 do
begin begin
cp1.xform[i].Density := triangle_area(Triangles[i]); cp1.xform[i].weight := triangle_area(Triangles[i]);
total_area := total_area + cp1.xform[i].Density; total_area := total_area + cp1.xform[i].weight;
end; end;
for i := 0 to t - 1 do for i := 0 to t - 1 do
begin begin
cp1.xform[i].Density := cp1.xform[i].Density / total_area; cp1.xform[i].weight := cp1.xform[i].weight / total_area;
end; end;
NormalizeWeights(cp1); NormalizeWeights(cp1);
end; end;
@ -414,7 +414,7 @@ var
i: integer; i: integer;
begin begin
for i := 0 to Transforms - 1 do for i := 0 to Transforms - 1 do
cp1.xform[i].Density := random; cp1.xform[i].weight := random;
NormalizeWeights(cp1); NormalizeWeights(cp1);
end; end;
@ -472,7 +472,7 @@ begin
Result.xform[i].c[2, 0] := 0; Result.xform[i].c[2, 0] := 0;
Result.xform[i].c[2, 1] := 0; Result.xform[i].c[2, 1] := 0;
Result.xform[i].color := 0; Result.xform[i].color := 0;
Result.xform[i].symmetry := 0; Result.xform[i].color_speed := 0;
Result.xform[i].vars[0] := 1; Result.xform[i].vars[0] := 1;
for j := 1 to NRVAR - 1 do for j := 1 to NRVAR - 1 do
Result.xform[i].vars[j] := 0; Result.xform[i].vars[j] := 0;
@ -512,16 +512,16 @@ begin
Result.xform[i].c[2][1] := random * 2 - 1; Result.xform[i].c[2][1] := random * 2 - 1;
end; end;
for i := 0 to 100-1 do //NXFORMS - 1 do for i := 0 to 100-1 do //NXFORMS - 1 do
Result.xform[i].density := 0; Result.xform[i].weight := 0;
for i := 0 to Transforms - 1 do for i := 0 to Transforms - 1 do
Result.xform[i].density := 1 / Transforms; Result.xform[i].weight := 1 / Transforms;
SetVariation(Result); SetVariation(Result);
end; end;
9: begin 9: begin
for i := 0 to 100-1 do //NXFORMS - 1 do for i := 0 to 100-1 do //NXFORMS - 1 do
Result.xform[i].density := 0; Result.xform[i].weight := 0;
for i := 0 to Transforms - 1 do for i := 0 to Transforms - 1 do
Result.xform[i].density := 1 / Transforms; Result.xform[i].weight := 1 / Transforms;
end; end;
end; // case end; // case
Result.TrianglesFromCp(Triangles); Result.TrianglesFromCp(Triangles);
@ -536,7 +536,7 @@ begin
end; end;
for i := 0 to Transforms - 1 do for i := 0 to Transforms - 1 do
Result.xform[i].color := i / (transforms - 1); Result.xform[i].color := i / (transforms - 1);
if Result.xform[0].density = 1 then if Result.xform[0].weight = 1 then
Continue; Continue;
case SymmetryType of case SymmetryType of
{ Bilateral } { Bilateral }
@ -554,7 +554,7 @@ begin
end; end;
if skip then if skip then
continue; continue;
until not Result.BlowsUP(5000) and (Result.xform[0].density <> 0); until not Result.BlowsUP(5000) and (Result.xform[0].weight <> 0);
RandomGradient(SourceCP, Result); RandomGradient(SourceCP, Result);
@ -578,7 +578,7 @@ begin
Result.URl := SheepURL; Result.URl := SheepURL;
Result.xform[Result.NumXForms].Clear; Result.xform[Result.NumXForms].Clear;
Result.xform[Result.NumXForms].symmetry := 1; Result.xform[Result.NumXForms].color_speed := 1;
end; end;
end. end.