added support for "pre_" and "post_" variations
This commit is contained in:
parent
52d4041512
commit
f2c7a7c1c5
@ -63,7 +63,7 @@ type
|
|||||||
rings_dx,
|
rings_dx,
|
||||||
fan_dx, fan_dx2,
|
fan_dx, fan_dx2,
|
||||||
cosine_var2,
|
cosine_var2,
|
||||||
polar_vpi: double;
|
polar_vpi, disc_vpi: double;
|
||||||
|
|
||||||
gauss_rnd: array [0..3] of double;
|
gauss_rnd: array [0..3] of double;
|
||||||
gauss_N: integer;
|
gauss_N: integer;
|
||||||
@ -122,7 +122,6 @@ type
|
|||||||
procedure NextPoint(var px, py, pc: double); overload;
|
procedure NextPoint(var px, py, pc: double); overload;
|
||||||
procedure NextPoint(var CPpoint: TCPpoint); overload;
|
procedure NextPoint(var CPpoint: TCPpoint); overload;
|
||||||
procedure NextPointTo(var CPpoint, ToPoint: TCPpoint);
|
procedure NextPointTo(var CPpoint, ToPoint: TCPpoint);
|
||||||
// procedure NextPoint(var px, py, pz, pc: double); overload;
|
|
||||||
procedure NextPointXY(var px, py: double);
|
procedure NextPointXY(var px, py: double);
|
||||||
procedure NextPoint2C(var p: T2CPoint);
|
procedure NextPoint2C(var p: T2CPoint);
|
||||||
|
|
||||||
@ -145,7 +144,7 @@ type
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
SysUtils, Math;
|
SysUtils, Math, StrUtils;
|
||||||
|
|
||||||
const
|
const
|
||||||
EPS: double = 1E-300;
|
EPS: double = 1E-300;
|
||||||
@ -245,8 +244,27 @@ begin
|
|||||||
Inc(FNrFunctions);
|
Inc(FNrFunctions);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// Pre- variations
|
||||||
|
for i := 0 to NrVar - 1 do begin
|
||||||
|
if (vars[i] <> 0.0) and (LeftStr(Varnames(i), 4) = 'pre_') then begin
|
||||||
|
FCalcFunctionList[FNrFunctions] := FFunctionList[i];
|
||||||
|
Inc(FNrFunctions);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// Normal variations
|
||||||
for i := 0 to NrVar - 1 do begin
|
for i := 0 to NrVar - 1 do begin
|
||||||
if (vars[i] <> 0.0) then begin
|
if (vars[i] <> 0.0) then begin
|
||||||
|
if (LeftStr(Varnames(i), 4) = 'pre_') or (LeftStr(Varnames(i), 5) = 'post_') then continue;
|
||||||
|
|
||||||
|
FCalcFunctionList[FNrFunctions] := FFunctionList[i];
|
||||||
|
Inc(FNrFunctions);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// Post- variations
|
||||||
|
for i := 0 to NrVar - 1 do begin
|
||||||
|
if (vars[i] <> 0.0) and (LeftStr(Varnames(i), 5) = 'post_') then begin
|
||||||
FCalcFunctionList[FNrFunctions] := FFunctionList[i];
|
FCalcFunctionList[FNrFunctions] := FFunctionList[i];
|
||||||
Inc(FNrFunctions);
|
Inc(FNrFunctions);
|
||||||
end;
|
end;
|
||||||
@ -262,6 +280,7 @@ begin
|
|||||||
cosine_var2 := vars[20]/2;
|
cosine_var2 := vars[20]/2;
|
||||||
|
|
||||||
polar_vpi := vars[5]/pi;
|
polar_vpi := vars[5]/pi;
|
||||||
|
disc_vpi := vars[8]/pi;
|
||||||
|
|
||||||
gauss_rnd[0] := random;
|
gauss_rnd[0] := random;
|
||||||
gauss_rnd[1] := random;
|
gauss_rnd[1] := random;
|
||||||
@ -697,16 +716,17 @@ var
|
|||||||
r, sinr, cosr: double;
|
r, sinr, cosr: double;
|
||||||
begin
|
begin
|
||||||
SinCos(PI * sqrt(sqr(FTx) + sqr(FTy)), sinr, cosr);
|
SinCos(PI * sqrt(sqr(FTx) + sqr(FTy)), sinr, cosr);
|
||||||
r := vars[8] * FAngle / PI;
|
r := disc_vpi * FAngle; //r := vars[8] * FAngle / PI;
|
||||||
FPx := FPx + sinr * r;
|
FPx := FPx + sinr * r;
|
||||||
FPy := FPy + cosr * r;
|
FPy := FPy + cosr * r;
|
||||||
{$else}
|
{$else}
|
||||||
asm
|
asm
|
||||||
mov edx, [eax + vars]
|
fld qword ptr [eax + disc_vpi]
|
||||||
fld qword ptr [edx + 8*8]
|
// mov edx, [eax + vars]
|
||||||
|
// fld qword ptr [edx + 8*8]
|
||||||
fmul qword ptr [eax + FAngle]
|
fmul qword ptr [eax + FAngle]
|
||||||
fldpi
|
// fldpi
|
||||||
fdivp st(1), st
|
// fdivp st(1), st
|
||||||
fld qword ptr [eax + FTx]
|
fld qword ptr [eax + FTx]
|
||||||
fmul st, st
|
fmul st, st
|
||||||
fld qword ptr [eax + FTy]
|
fld qword ptr [eax + FTy]
|
||||||
@ -990,17 +1010,6 @@ end;
|
|||||||
//--15--///////////////////////////////////////////////////////////////////////
|
//--15--///////////////////////////////////////////////////////////////////////
|
||||||
procedure TXForm.Waves;
|
procedure TXForm.Waves;
|
||||||
{$ifndef _ASM_}
|
{$ifndef _ASM_}
|
||||||
{
|
|
||||||
var
|
|
||||||
dx,dy,nx,ny: double;
|
|
||||||
begin
|
|
||||||
dx := c20;
|
|
||||||
dy := c21;
|
|
||||||
nx := FTx + c10 * sin(FTy / ((dx * dx) + EPS));
|
|
||||||
ny := FTy + c11 * sin(FTx / ((dy * dy) + EPS));
|
|
||||||
FPx := FPx + vars[15] * nx;
|
|
||||||
FPy := FPy + vars[15] * ny;
|
|
||||||
}
|
|
||||||
begin
|
begin
|
||||||
//FPx := FPx + vars[15] * (FTx + c10 * sin(FTy / (sqr(c20) + EPS)));
|
//FPx := FPx + vars[15] * (FTx + c10 * sin(FTy / (sqr(c20) + EPS)));
|
||||||
//FPy := FPy + vars[15] * (FTy + c11 * sin(FTx / (sqr(c21) + EPS)));
|
//FPy := FPy + vars[15] * (FTy + c11 * sin(FTx / (sqr(c21) + EPS)));
|
||||||
|
@ -15,6 +15,7 @@ function GetNrRegisteredVariations: integer;
|
|||||||
function GetRegisteredVariation(const Index: integer): TBaseVariationClass;
|
function GetRegisteredVariation(const Index: integer): TBaseVariationClass;
|
||||||
function GetNrVariableNames: integer;
|
function GetNrVariableNames: integer;
|
||||||
function GetVariableNameAt(const Index: integer): string;
|
function GetVariableNameAt(const Index: integer): string;
|
||||||
|
function GetVariationIndex(const str: string): integer;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -72,6 +73,16 @@ begin
|
|||||||
Result := TBaseVariationClass(VariationList[Index - NRLOCVAR]).GetName;
|
Result := TBaseVariationClass(VariationList[Index - NRLOCVAR]).GetName;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
function GetVariationIndex(const str: string): integer;
|
||||||
|
var
|
||||||
|
i: integer;
|
||||||
|
begin
|
||||||
|
i := NRVAR-1;
|
||||||
|
while (i >= 0) and (Varnames(i) <> str) do Dec(i);
|
||||||
|
Result := i;
|
||||||
|
end;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
procedure RegisterVariation(Variation: TBaseVariationClass);
|
procedure RegisterVariation(Variation: TBaseVariationClass);
|
||||||
var
|
var
|
||||||
|
Loading…
Reference in New Issue
Block a user