fixed buggy ring variation... again! :-(
This commit is contained in:
parent
f5af5a80ba
commit
b4104e8185
@ -38,6 +38,8 @@ type
|
|||||||
// CalculateLength: boolean;
|
// CalculateLength: boolean;
|
||||||
CalculateSinCos: boolean;
|
CalculateSinCos: boolean;
|
||||||
|
|
||||||
|
PostTransformEnabled: boolean;
|
||||||
|
|
||||||
FRegVariations: array of TBaseVariation;
|
FRegVariations: array of TBaseVariation;
|
||||||
|
|
||||||
procedure Linear; // var[0]
|
procedure Linear; // var[0]
|
||||||
@ -78,12 +80,13 @@ type
|
|||||||
public
|
public
|
||||||
vars: array of double; // normalized interp coefs between variations
|
vars: array of double; // normalized interp coefs between variations
|
||||||
c: array[0..2, 0..1] of double; // the coefs to the affine part of the function
|
c: array[0..2, 0..1] of double; // the coefs to the affine part of the function
|
||||||
// p: array[0..2, 0..1] of double; // the coefs to the affine part of the function
|
p: array[0..2, 0..1] of double; // post-transform coefs!
|
||||||
density: double; // prob is this function is chosen. 0 - 1
|
density: double; // prob is this function is chosen. 0 - 1
|
||||||
color: double; // color coord for this function. 0 - 1
|
color: double; // color coord for this function. 0 - 1
|
||||||
color2: double; // Second color coord for this function. 0 - 1
|
color2: double; // Second color coord for this function. 0 - 1
|
||||||
symmetry: double;
|
symmetry: double;
|
||||||
c00, c01, c10, c11, c20, c21: double;
|
c00, c01, c10, c11, c20, c21: double;
|
||||||
|
p00, p01, p10, p11, p20, p21: double;
|
||||||
|
|
||||||
// nx,ny,x,y: double;
|
// nx,ny,x,y: double;
|
||||||
// script: TatPascalScripter;
|
// script: TatPascalScripter;
|
||||||
@ -145,6 +148,13 @@ begin
|
|||||||
c[1, 1] := 1;
|
c[1, 1] := 1;
|
||||||
c[2, 0] := 0;
|
c[2, 0] := 0;
|
||||||
c[2, 1] := 0;
|
c[2, 1] := 0;
|
||||||
|
|
||||||
|
p[0, 0] := 1;
|
||||||
|
p[0, 1] := 0;
|
||||||
|
p[1, 0] := 0;
|
||||||
|
p[1, 1] := 1;
|
||||||
|
p[2, 0] := 0;
|
||||||
|
p[2, 1] := 0;
|
||||||
Symmetry := 0;
|
Symmetry := 0;
|
||||||
|
|
||||||
AddRegVariations;
|
AddRegVariations;
|
||||||
@ -168,6 +178,17 @@ begin
|
|||||||
c20 := c[2][0];
|
c20 := c[2][0];
|
||||||
c21 := c[2][1];
|
c21 := c[2][1];
|
||||||
|
|
||||||
|
if (p[0,0]<>1) or (p[0,1]<>0) or(p[1,0]<>0) or (p[1,1]<>1) or (p[2,0]<>0) or (p[2,1]<>0) then
|
||||||
|
begin
|
||||||
|
p00 := p[0][0];
|
||||||
|
p01 := p[0][1];
|
||||||
|
p10 := p[1][0];
|
||||||
|
p11 := p[1][1];
|
||||||
|
p20 := p[2][0];
|
||||||
|
p21 := p[2][1];
|
||||||
|
PostTransformEnabled := true;
|
||||||
|
end;
|
||||||
|
|
||||||
FNrFunctions := 0;
|
FNrFunctions := 0;
|
||||||
|
|
||||||
for i := 0 to High(FRegVariations) do begin
|
for i := 0 to High(FRegVariations) do begin
|
||||||
@ -319,11 +340,10 @@ end;
|
|||||||
//--7--////////////////////////////////////////////////////////////////////////
|
//--7--////////////////////////////////////////////////////////////////////////
|
||||||
procedure TXForm.Heart;
|
procedure TXForm.Heart;
|
||||||
var
|
var
|
||||||
r: double;
|
r, sinr, cosr: double;
|
||||||
sinr, cosr: double;
|
|
||||||
begin
|
begin
|
||||||
r := sqrt(sqr(FTx) + sqr(FTy));
|
r := sqrt(sqr(FTx) + sqr(FTy));
|
||||||
Sincos(r * FAngle, sinr, cosr);
|
Sincos(r*FAngle, sinr, cosr);
|
||||||
r := r * vars[7];
|
r := r * vars[7];
|
||||||
FPx := FPx + r * sinr;
|
FPx := FPx + r * sinr;
|
||||||
FPy := FPy - r * cosr;
|
FPy := FPy - r * cosr;
|
||||||
@ -560,7 +580,7 @@ begin
|
|||||||
// FPy := FPy + vars[21] * r * sinr;
|
// FPy := FPy + vars[21] * r * sinr;
|
||||||
r := sqrt(sqr(ftx) + sqr(fty));
|
r := sqrt(sqr(ftx) + sqr(fty));
|
||||||
r := vars[21] * (
|
r := vars[21] * (
|
||||||
2 * r + dx * (System.Int(r/(2 * dx) + 0.5) * 2 - r)
|
2 * r - dx * (System.Int((r/dx + 1)/2) * 2 + r)
|
||||||
);
|
);
|
||||||
|
|
||||||
FPx := FPx + r * FCosA;
|
FPx := FPx + r * FCosA;
|
||||||
@ -710,9 +730,14 @@ begin
|
|||||||
for i := 0 to FNrFunctions - 1 do
|
for i := 0 to FNrFunctions - 1 do
|
||||||
FCalcFunctionList[i];
|
FCalcFunctionList[i];
|
||||||
|
|
||||||
px := FPx;
|
if PostTransformEnabled then begin
|
||||||
py := FPy;
|
px := p00 * FPx + p10 * FPy + p20;
|
||||||
|
py := p01 * FPx + p11 * FPy + p21;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
px := FPx;
|
||||||
|
py := FPy;
|
||||||
|
end;
|
||||||
// px := p[0,0] * FPx + p[1,0] * FPy + p[2,0];
|
// px := p[0,0] * FPx + p[1,0] * FPy + p[2,0];
|
||||||
// py := p[0,1] * FPx + p[1,1] * FPy + p[2,1];
|
// py := p[0,1] * FPx + p[1,1] * FPy + p[2,1];
|
||||||
end;
|
end;
|
||||||
@ -756,8 +781,14 @@ begin
|
|||||||
for i:= 0 to FNrFunctions-1 do
|
for i:= 0 to FNrFunctions-1 do
|
||||||
FFunctionList[i];
|
FFunctionList[i];
|
||||||
|
|
||||||
CPpoint.x := FPx;
|
if PostTransformEnabled then begin
|
||||||
CPpoint.y := FPy;
|
CPpoint.x := p00 * FPx + p10 * FPy + p20;
|
||||||
|
CPpoint.y := p01 * FPx + p11 * FPy + p21;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
CPpoint.x := FPx;
|
||||||
|
CPpoint.y := FPy;
|
||||||
|
end;
|
||||||
// CPpoint.x := p[0,0] * FPx + p[1,0] * FPy + p[2,0];
|
// CPpoint.x := p[0,0] * FPx + p[1,0] * FPy + p[2,0];
|
||||||
// CPpoint.y := p[0,1] * FPx + p[1,1] * FPy + p[2,1];
|
// CPpoint.y := p[0,1] * FPx + p[1,1] * FPy + p[2,1];
|
||||||
end;
|
end;
|
||||||
@ -876,8 +907,16 @@ begin
|
|||||||
for i:= 0 to FNrFunctions-1 do
|
for i:= 0 to FNrFunctions-1 do
|
||||||
FFunctionList[i];
|
FFunctionList[i];
|
||||||
|
|
||||||
px := FPx;
|
// px := FPx;
|
||||||
py := FPy;
|
// py := FPy;
|
||||||
|
if PostTransformEnabled then begin
|
||||||
|
px := p00 * FPx + p10 * FPy + p20;
|
||||||
|
py := p01 * FPx + p11 * FPy + p21;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
px := FPx;
|
||||||
|
py := FPy;
|
||||||
|
end;
|
||||||
// px := p[0,0] * FPx + p[1,0] * FPy + p[2,0];
|
// px := p[0,0] * FPx + p[1,0] * FPy + p[2,0];
|
||||||
// py := p[0,1] * FPx + p[1,1] * FPy + p[2,1];
|
// py := p[0,1] * FPx + p[1,1] * FPy + p[2,1];
|
||||||
end;
|
end;
|
||||||
@ -914,8 +953,16 @@ begin
|
|||||||
for i:= 0 to FNrFunctions-1 do
|
for i:= 0 to FNrFunctions-1 do
|
||||||
FFunctionList[i];
|
FFunctionList[i];
|
||||||
|
|
||||||
px := FPx;
|
// px := FPx;
|
||||||
py := FPy;
|
// py := FPy;
|
||||||
|
if PostTransformEnabled then begin
|
||||||
|
px := p00 * FPx + p10 * FPy + p20;
|
||||||
|
py := p01 * FPx + p11 * FPy + p21;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
px := FPx;
|
||||||
|
py := FPy;
|
||||||
|
end;
|
||||||
// px := p[0,0] * FPx + p[1,0] * FPy + p[2,0];
|
// px := p[0,0] * FPx + p[1,0] * FPy + p[2,0];
|
||||||
// py := p[0,1] * FPx + p[1,1] * FPy + p[2,1];
|
// py := p[0,1] * FPx + p[1,1] * FPy + p[2,1];
|
||||||
end;
|
end;
|
||||||
@ -1132,6 +1179,7 @@ begin
|
|||||||
vars[i] := XForm.vars[i];
|
vars[i] := XForm.vars[i];
|
||||||
|
|
||||||
c := Xform.c;
|
c := Xform.c;
|
||||||
|
p := Xform.p;
|
||||||
density := XForm.density;
|
density := XForm.density;
|
||||||
color := XForm.color;
|
color := XForm.color;
|
||||||
color2 := XForm.color2;
|
color2 := XForm.color2;
|
||||||
@ -1160,7 +1208,8 @@ begin
|
|||||||
Result := Result + varnames(i) + format('="%g" ', [vars[i]]);
|
Result := Result + varnames(i) + format('="%g" ', [vars[i]]);
|
||||||
end;
|
end;
|
||||||
Result := Result + Format('coefs="%g %g %g %g %g %g" ', [c[0,0], c[0,1], c[1,0], c[1,1], c[2,0], c[2,1]]);
|
Result := Result + Format('coefs="%g %g %g %g %g %g" ', [c[0,0], c[0,1], c[1,0], c[1,1], c[2,0], c[2,1]]);
|
||||||
// Result := Result + Format('post="%g %g %g %g %g %g" ', [p[0,0], p[0,1], p[1,0], p[1,1], p[2,0], p[2,1]]);
|
if (p[0,0]<>1) or (p[0,1]<>0) or(p[1,0]<>0) or (p[1,1]<>1) or (p[2,0]<>0) or (p[2,1]<>0) then
|
||||||
|
Result := Result + Format('post="%g %g %g %g %g %g" ', [p[0,0], p[0,1], p[1,0], p[1,1], p[2,0], p[2,1]]);
|
||||||
|
|
||||||
for i := 0 to High(FRegVariations) do begin
|
for i := 0 to High(FRegVariations) do begin
|
||||||
if vars[i+NRLOCVAR] <> 0 then
|
if vars[i+NRLOCVAR] <> 0 then
|
||||||
|
Loading…
Reference in New Issue
Block a user