*** empty log message ***
This commit is contained in:
parent
ed60c2daf7
commit
48c5d52c6f
@ -15,11 +15,11 @@ const
|
|||||||
type
|
type
|
||||||
TVariationJuliaScope = class(TBaseVariation)
|
TVariationJuliaScope = class(TBaseVariation)
|
||||||
private
|
private
|
||||||
N: integer;
|
power: integer;
|
||||||
c: double;
|
distortion: double;
|
||||||
|
|
||||||
rN: integer;
|
rN: integer;
|
||||||
cn: double;
|
invDistPower: double;
|
||||||
|
|
||||||
procedure CalcPower1;
|
procedure CalcPower1;
|
||||||
procedure CalcPowerMinus1;
|
procedure CalcPowerMinus1;
|
||||||
@ -54,24 +54,24 @@ uses
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
constructor TVariationJuliaScope.Create;
|
constructor TVariationJuliaScope.Create;
|
||||||
begin
|
begin
|
||||||
N := random(5) + 2;
|
power := random(5) + 2;
|
||||||
c := 1.0;
|
distortion := 1.0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TVariationJuliaScope.Prepare;
|
procedure TVariationJuliaScope.Prepare;
|
||||||
begin
|
begin
|
||||||
rN := abs(N);
|
rN := abs(power);
|
||||||
cn := c / N / 2;
|
invDistPower := distortion / power / 2;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
procedure TVariationJuliaScope.GetCalcFunction(var f: TCalcFunction);
|
procedure TVariationJuliaScope.GetCalcFunction(var f: TCalcFunction);
|
||||||
begin
|
begin
|
||||||
if c = 1 then begin
|
if distortion = 1 then begin
|
||||||
if N = 2 then f := CalcPower2
|
if power = 2 then f := CalcPower2
|
||||||
else if N = -2 then f := CalcPowerMinus2
|
else if power = -2 then f := CalcPowerMinus2
|
||||||
else if N = 1 then f := CalcPower1
|
else if power = 1 then f := CalcPower1
|
||||||
else if N = -1 then f := CalcPowerMinus1
|
else if power = -1 then f := CalcPowerMinus1
|
||||||
else f := CalcFunction;
|
else f := CalcFunction;
|
||||||
end
|
end
|
||||||
else f := CalcFunction;
|
else f := CalcFunction;
|
||||||
@ -87,17 +87,17 @@ var
|
|||||||
begin
|
begin
|
||||||
rnd := random(rN);
|
rnd := random(rN);
|
||||||
if (rnd and 1) = 0 then
|
if (rnd and 1) = 0 then
|
||||||
sincos( (2*pi*rnd + arctan2(FTy^, FTx^)) / N, sina, cosa)
|
sincos( (2*pi*rnd + arctan2(FTy^, FTx^)) / power, sina, cosa)
|
||||||
else
|
else
|
||||||
sincos( (2*pi*rnd - arctan2(FTy^, FTx^)) / N, sina, cosa);
|
sincos( (2*pi*rnd - arctan2(FTy^, FTx^)) / power, sina, cosa);
|
||||||
r := vvar * Math.Power(sqr(FTx^) + sqr(FTy^), cn);
|
r := vvar * Math.Power(sqr(FTx^) + sqr(FTy^), invDistPower);
|
||||||
FPx^ := FPx^ + r * cosa;
|
FPx^ := FPx^ + r * cosa;
|
||||||
FPy^ := FPy^ + r * sina;
|
FPy^ := FPy^ + r * sina;
|
||||||
{$else}
|
{$else}
|
||||||
asm
|
asm
|
||||||
mov edx, [eax + FTy]
|
mov edx, [eax + FTy]
|
||||||
fld qword ptr [edx]
|
fld qword ptr [edx]
|
||||||
fld qword ptr [eax + cn]
|
fld qword ptr [eax + invDistPower]
|
||||||
mov edx, [eax + FTx]
|
mov edx, [eax + FTx]
|
||||||
fld qword ptr [edx]
|
fld qword ptr [edx]
|
||||||
fld st(2)
|
fld st(2)
|
||||||
@ -118,7 +118,7 @@ asm
|
|||||||
fimul dword ptr [esp]
|
fimul dword ptr [esp]
|
||||||
add esp, 4
|
add esp, 4
|
||||||
faddp
|
faddp
|
||||||
fidiv dword ptr [ecx + N]
|
fidiv dword ptr [ecx + power]
|
||||||
|
|
||||||
fxch st(3)
|
fxch st(3)
|
||||||
fmul st, st
|
fmul st, st
|
||||||
@ -384,13 +384,13 @@ function TVariationJuliaScope.SetVariable(const Name: string; var value: double)
|
|||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
if Name = var_n_name then begin
|
if Name = var_n_name then begin
|
||||||
N := Round(Value);
|
power := Round(Value);
|
||||||
if N = 0 then N := 1;
|
if power = 0 then power := 1;
|
||||||
Value := N;
|
Value := power;
|
||||||
Result := True;
|
Result := True;
|
||||||
end
|
end
|
||||||
else if Name = var_c_name then begin
|
else if Name = var_c_name then begin
|
||||||
c := value;
|
distortion := value;
|
||||||
Result := True;
|
Result := True;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -399,12 +399,12 @@ function TVariationJuliaScope.ResetVariable(const Name: string): boolean;
|
|||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
if Name = var_n_name then begin
|
if Name = var_n_name then begin
|
||||||
if N = 2 then N := -2
|
if power = 2 then power := -2
|
||||||
else N := 2;
|
else power := 2;
|
||||||
Result := True;
|
Result := True;
|
||||||
end
|
end
|
||||||
else if Name = var_c_name then begin
|
else if Name = var_c_name then begin
|
||||||
c := 1;
|
distortion := 1;
|
||||||
Result := True;
|
Result := True;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -420,11 +420,11 @@ function TVariationJuliaScope.GetVariable(const Name: string; var value: double)
|
|||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
if Name = var_n_name then begin
|
if Name = var_n_name then begin
|
||||||
Value := N;
|
Value := power;
|
||||||
Result := true;
|
Result := true;
|
||||||
end
|
end
|
||||||
else if Name = var_c_name then begin
|
else if Name = var_c_name then begin
|
||||||
Value := c;
|
Value := distortion;
|
||||||
Result := true;
|
Result := true;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user