Initial commit
This commit is contained in:
325
Variations/varAffine3D.pas
Normal file
325
Variations/varAffine3D.pas
Normal file
@ -0,0 +1,325 @@
|
||||
{ Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina }
|
||||
|
||||
unit varAffine3D;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationAffine3D = class(TBaseVariation)
|
||||
private
|
||||
affine3D_a00, affine3D_a01, affine3D_a02,
|
||||
affine3D_a10, affine3D_a11, affine3D_a12,
|
||||
affine3D_a20, affine3D_a21, affine3D_a22,
|
||||
affine3D_bx, affine3D_by, affine3D_bz: double;
|
||||
x0, y0, z0: double;
|
||||
affine3D_mode: byte;
|
||||
procedure CalcPre;
|
||||
procedure CalcPost;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationAffine3D.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
case affine3D_mode of
|
||||
0: f := CalcPre;
|
||||
1: f := CalcFunction;
|
||||
else f := CalcPost;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TVariationAffine3D.CalcPre;
|
||||
var x, y, z, dn: double;
|
||||
begin
|
||||
x := affine3D_a00 * FTx^ - affine3D_a01 * FTy^ + affine3D_a02 * FTz^ + affine3D_bx;
|
||||
y := -(affine3D_a10 * FTx^ - affine3D_a11 * FTy^ + affine3D_a12 * FTz^ + affine3D_by);
|
||||
z := affine3D_a20 * FTx^ - affine3D_a21 * FTy^ + affine3D_a22 * FTz^ + affine3D_bz;
|
||||
|
||||
FTx^ := VVAR * x;
|
||||
FTy^ := VVAR * y;
|
||||
FTz^ := VVAR * z;
|
||||
|
||||
dn := hypot(x - x0, y - y0, z - z0);
|
||||
if (dn <> 0) then color^ := abs(cos(hypot(x - x0, y - y0) / dn))
|
||||
else color^ := 0;
|
||||
end;
|
||||
|
||||
procedure TVariationAffine3D.CalcFunction;
|
||||
var x, y, z, dn: double;
|
||||
begin
|
||||
|
||||
x := affine3D_a00 * FTx^ - affine3D_a01 * FTy^ + affine3D_a02 * FTz^ + affine3D_bx;
|
||||
y := -(affine3D_a10 * FTx^ - affine3D_a11 * FTy^ + affine3D_a12 * FTz^ + affine3D_by);
|
||||
z := affine3D_a20 * FTx^ - affine3D_a21 * FTy^ + affine3D_a22 * FTz^ + affine3D_bz;
|
||||
|
||||
FPx^ := FPx^ + VVAR * x;
|
||||
FPy^ := FPy^ + VVAR * y;
|
||||
FPz^ := FPz^ + VVAR * z;
|
||||
|
||||
dn := hypot(x - x0, y - y0, z - z0);
|
||||
if (dn <> 0) then color^ := abs(cos(hypot(x - x0, y - y0) / dn))
|
||||
else color^ := 0;
|
||||
end;
|
||||
|
||||
procedure TVariationAffine3D.CalcPost;
|
||||
var x, y, z, dn: double;
|
||||
begin
|
||||
|
||||
x := affine3D_a00 * FPx^ - affine3D_a01 * FPy^ + affine3D_a02 * FPz^ + affine3D_bx;
|
||||
y := -(affine3D_a10 * FPx^ - affine3D_a11 * FPy^ + affine3D_a12 * FPz^ + affine3D_by);
|
||||
z := affine3D_a20 * FPx^ - affine3D_a21 * FPy^ + affine3D_a22 * FPz^ + affine3D_bz;
|
||||
|
||||
FPx^ := VVAR * x;
|
||||
FPy^ := VVAR * y;
|
||||
FPz^ := VVAR * z;
|
||||
|
||||
dn := hypot(x - x0, y - y0, z - z0);
|
||||
if (dn <> 0) then color^ := abs(cos(hypot(x - x0, y - y0) / dn))
|
||||
else color^ := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationAffine3D.Create;
|
||||
begin
|
||||
affine3D_a00 := 1; affine3D_a01 := 0; affine3D_a02 := 0;
|
||||
affine3D_a10 := 0; affine3D_a11 := 1; affine3D_a12 := 0;
|
||||
affine3D_a20 := 0; affine3D_a21 := 0; affine3D_a22 := 1;
|
||||
affine3D_bx := 0; affine3D_by := 0; affine3D_bz := 0;
|
||||
x0 := 0; y0 := 0; z0 := 0;
|
||||
affine3D_mode := 1; // order of applying
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationAffine3D.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationAffine3D.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationAffine3D.GetName: string;
|
||||
begin
|
||||
Result := 'affine3D';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationAffine3D.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'affine3D_a00';
|
||||
1: Result := 'affine3D_a01';
|
||||
2: Result := 'affine3D_a02';
|
||||
3: Result := 'affine3D_a10';
|
||||
4: Result := 'affine3D_a11';
|
||||
5: Result := 'affine3D_a12';
|
||||
6: Result := 'affine3D_a20';
|
||||
7: Result := 'affine3D_a21';
|
||||
8: Result := 'affine3D_a22';
|
||||
9: Result := 'affine3D_bx';
|
||||
10: Result := 'affine3D_by';
|
||||
11: Result := 'affine3D_bz';
|
||||
12: Result := 'affine3D_dc_x0';
|
||||
13: Result := 'affine3D_dc_y0';
|
||||
14: Result := 'affine3D_dc_z0';
|
||||
15: Result := 'affine3D_mode';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationAffine3D.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'affine3D_a00' then begin
|
||||
affine3D_a00 := Value;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_a01' then begin
|
||||
affine3D_a01 := Value;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_a02' then begin
|
||||
affine3D_a02 := Value;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_a10' then begin
|
||||
affine3D_a10 := Value;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_a11' then begin
|
||||
affine3D_a11 := Value;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_a12' then begin
|
||||
affine3D_a12 := Value;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_a20' then begin
|
||||
affine3D_a20 := Value;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_a21' then begin
|
||||
affine3D_a21 := Value;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_a22' then begin
|
||||
affine3D_a22 := Value;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_bx' then begin
|
||||
affine3D_bx := Value;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_by' then begin
|
||||
affine3D_by := Value;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_bz' then begin
|
||||
affine3D_bz := Value;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_dc_x0' then begin
|
||||
x0 := Value;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_dc_y0' then begin
|
||||
y0 := Value;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_dc_z0' then begin
|
||||
z0 := Value;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_mode' then begin
|
||||
if (Value < 0) then Value := 0;
|
||||
if (Value > 2) then Value := 2;
|
||||
affine3D_mode := Round(Value);
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
function TVariationAffine3D.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'affine3D_a00' then begin
|
||||
affine3D_a00 := 1;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_a01' then begin
|
||||
affine3D_a01 := 0;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_a02' then begin
|
||||
affine3D_a02 := 0;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_a10' then begin
|
||||
affine3D_a10 := 0;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_a11' then begin
|
||||
affine3D_a11 := 1;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_a12' then begin
|
||||
affine3D_a12 := 0;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_a20' then begin
|
||||
affine3D_a20 := 0;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_a21' then begin
|
||||
affine3D_a21:= 0;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_a22' then begin
|
||||
affine3D_a22 := 1;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_bx' then begin
|
||||
affine3D_bx := 0;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_by' then begin
|
||||
affine3D_by := 0;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_bz' then begin
|
||||
affine3D_bz := 0;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_dc_x0' then begin
|
||||
x0 := 0;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_dc_y0' then begin
|
||||
y0 := 0;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_dc_z0' then begin
|
||||
z0 := 0;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_mode' then begin
|
||||
affine3D_mode := 1;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationAffine3D.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 16
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationAffine3D.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'affine3D_a00' then begin
|
||||
Value := affine3D_a00;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_a01' then begin
|
||||
Value := affine3D_a01;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_a02' then begin
|
||||
Value := affine3D_a02;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_a10' then begin
|
||||
Value := affine3D_a10;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_a11' then begin
|
||||
Value := affine3D_a11;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_a12' then begin
|
||||
Value := affine3D_a12;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_a20' then begin
|
||||
Value := affine3D_a20;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_a21' then begin
|
||||
Value := affine3D_a21;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_a22' then begin
|
||||
Value := affine3D_a22;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_bx' then begin
|
||||
Value := affine3D_bx;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_by' then begin
|
||||
Value := affine3D_by;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_bz' then begin
|
||||
Value := affine3D_bz;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_dc_x0' then begin
|
||||
Value:= x0;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_dc_y0' then begin
|
||||
Value := y0;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_dc_z0' then begin
|
||||
Value := z0;
|
||||
Result := True;
|
||||
end else if Name = 'affine3D_mode' then begin
|
||||
Value := affine3D_mode;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationAffine3D), true, true);
|
||||
end.
|
||||
119
Variations/varArch.pas
Normal file
119
Variations/varArch.pas
Normal file
@ -0,0 +1,119 @@
|
||||
{ Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina }
|
||||
|
||||
unit varArch;
|
||||
|
||||
interface
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
const
|
||||
sweight = 'Z_arch_weight';
|
||||
|
||||
type
|
||||
TVariationArch = class(TBaseVariation)
|
||||
private
|
||||
vpi, weight: double;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
////////////////////////
|
||||
procedure TVariationArch.Prepare;
|
||||
begin
|
||||
vpi := pi * weight; // arch behavior
|
||||
end;
|
||||
|
||||
procedure TVariationArch.CalcFunction;
|
||||
var
|
||||
sinr, cosr: double;
|
||||
begin
|
||||
SinCos(random * vpi, sinr, cosr);
|
||||
if cosr = 0 then exit;
|
||||
|
||||
FPx^ := FPx^ + vvar * sinr;
|
||||
FPy^ := FPy^ + sqr(sinr) / cosr * vvar;
|
||||
end;
|
||||
|
||||
constructor TVariationArch.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
weight := 1;
|
||||
end;
|
||||
|
||||
class function TVariationArch.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationArch.Create;
|
||||
end;
|
||||
|
||||
class function TVariationArch.GetName: string;
|
||||
begin
|
||||
Result := 'Z_arch';
|
||||
end;
|
||||
|
||||
{ ////////////////////////////////////////////////////////////////////// }
|
||||
|
||||
function TVariationArch.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := sweight;
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationArch.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 1;
|
||||
end;
|
||||
|
||||
function TVariationArch.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = sweight then begin
|
||||
Value := weight;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationArch.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = sweight then begin
|
||||
weight := Value;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationArch.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = sweight then begin
|
||||
weight := 1;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ ///////////////////////////////////////////////////////////////////////////// }
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationArch), false, false);
|
||||
|
||||
end.
|
||||
176
Variations/varAuger.pas
Normal file
176
Variations/varAuger.pas
Normal file
@ -0,0 +1,176 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varAuger;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationAuger = class(TBaseVariation)
|
||||
private
|
||||
auger_freq, auger_weight, auger_scale, auger_sym: double;
|
||||
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationAuger.Prepare;
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure TVariationAuger.CalcFunction;
|
||||
var x, y, s, t, dx, dy: double;
|
||||
begin
|
||||
x := FTx^;
|
||||
y := FTy^;
|
||||
|
||||
s := sin(auger_freq * x);
|
||||
t := sin(auger_freq * y);
|
||||
|
||||
dx := x + auger_weight * (0.5 * auger_scale * t + abs(x) * t);
|
||||
dy := y + auger_weight * (0.5 * auger_scale * s + abs(y) * s);
|
||||
|
||||
FPx^ := FPx^ + VVAR * (x + auger_sym * (dx - x));
|
||||
FPy^ := FPy^ + VVAR * dy;
|
||||
FPz^ := FPz^ + VVAR * FTz^;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationAuger.Create;
|
||||
begin
|
||||
auger_freq := 5; auger_weight := 0.5;
|
||||
auger_scale := 0.1; auger_sym := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationAuger.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationAuger.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationAuger.GetName: string;
|
||||
begin
|
||||
Result := 'auger';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationAuger.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'auger_freq';
|
||||
1: Result := 'auger_weight';
|
||||
2: Result := 'auger_scale';
|
||||
3: Result := 'auger_sym';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationAuger.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'auger_freq' then begin
|
||||
auger_freq := Value;
|
||||
Result := True;
|
||||
end else if Name = 'auger_weight' then begin
|
||||
auger_weight := Value;
|
||||
Result := True;
|
||||
end else if Name = 'auger_scale' then begin
|
||||
auger_scale := Value;
|
||||
Result := True;
|
||||
end else if Name = 'auger_sym' then begin
|
||||
auger_sym := Value;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
function TVariationAuger.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'auger_freq' then begin
|
||||
auger_freq := 5;
|
||||
Result := True;
|
||||
end else if Name = 'auger_weight' then begin
|
||||
auger_weight := 0.5;
|
||||
Result := True;
|
||||
end else if Name = 'auger_scale' then begin
|
||||
auger_scale := 0.1;
|
||||
Result := True;
|
||||
end else if Name = 'auger_sym' then begin
|
||||
auger_sym := 0;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationAuger.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 4
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationAuger.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'auger_freq' then begin
|
||||
Value := auger_freq;
|
||||
Result := True;
|
||||
end else if Name = 'auger_weight' then begin
|
||||
Value := auger_weight;
|
||||
Result := True;
|
||||
end else if Name = 'auger_scale' then begin
|
||||
Value := auger_scale;
|
||||
Result := True;
|
||||
end else if Name = 'auger_sym' then begin
|
||||
Value := auger_sym;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationAuger), true, false);
|
||||
end.
|
||||
152
Variations/varBent2.pas
Normal file
152
Variations/varBent2.pas
Normal file
@ -0,0 +1,152 @@
|
||||
{ Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina }
|
||||
|
||||
unit varBent2;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationBent2 = class(TBaseVariation)
|
||||
private
|
||||
b2x, b2y, b2z, vvarx, vvary, vvarz: double;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationBent2 }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationBent2.Prepare;
|
||||
begin
|
||||
vvarx := vvar * b2x;
|
||||
vvary := vvar * b2y;
|
||||
vvarz := vvar * b2z;
|
||||
end;
|
||||
|
||||
procedure TVariationBent2.CalcFunction;
|
||||
begin
|
||||
if(FTx^ < 0.0) then
|
||||
FPx^ := FPx^ + vvarx * FTx^
|
||||
else
|
||||
FPx^ := FPx^ + vvar * FTx^;
|
||||
if (FTy^ < 0) then
|
||||
FPy^ := FPy^ + vvary * FTy^
|
||||
else
|
||||
FPy^ := FPy^ + vvar * FTy^;
|
||||
// AV: added 3D-support
|
||||
if (FTz^ < 0) then
|
||||
FPz^ := FPz^ + vvarz * FTz^
|
||||
else
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationBent2.GetName: string;
|
||||
begin
|
||||
Result := 'bent2';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationBent2.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'bent2_x';
|
||||
1: Result := 'bent2_y';
|
||||
2: Result := 'bent2_z';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationBent2.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 3;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationBent2.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'bent2_x' then begin
|
||||
b2x := Value;
|
||||
Result := True;
|
||||
end else if Name = 'bent2_y' then begin
|
||||
b2y := Value;
|
||||
Result := True;
|
||||
end else if Name = 'bent2_z' then begin
|
||||
b2z := Value;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationBent2.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'bent2_x' then begin
|
||||
b2x := 1;
|
||||
Result := True;
|
||||
end else if Name = 'bent2_y' then begin
|
||||
b2y := 1;
|
||||
Result := True;
|
||||
end else if Name = 'bent2_z' then begin
|
||||
b2z := 1;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationBent2.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'bent2_x' then begin
|
||||
Value := b2x;
|
||||
Result := True;
|
||||
end else if Name = 'bent2_y' then begin
|
||||
Value := b2y;
|
||||
Result := True;
|
||||
end else if Name = 'bent2_z' then begin
|
||||
Value := b2z;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationBent2.Create;
|
||||
begin
|
||||
b2x := 2;
|
||||
b2y := 0.5;
|
||||
b2z := 1;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationBent2.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationBent2.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationBent2), true, false);
|
||||
end.
|
||||
163
Variations/varBipolar.pas
Normal file
163
Variations/varBipolar.pas
Normal file
@ -0,0 +1,163 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varBipolar;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationBipolar = class(TBaseVariation)
|
||||
private
|
||||
bipolar_shift, v_4, v, s: double;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationBipolar.Prepare;
|
||||
begin
|
||||
v_4 := VVAR * 0.15915494309189533576888376337251; // AV: 1/(2*PI)
|
||||
v := VVAR * 0.636619772367581343075535053490061; // AV: 2/PI
|
||||
s := -1.57079632679489661923 * (bipolar_shift); // AV: -PI/2
|
||||
end;
|
||||
|
||||
procedure TVariationBipolar.CalcFunction;
|
||||
var x2y2, y, t, x2, f, g : double;
|
||||
begin
|
||||
x2y2 := sqr(FTx^) + sqr(FTy^);
|
||||
y := 0.5 * ArcTan2(2.0 * FTy^, x2y2 - 1.0) + (s);
|
||||
|
||||
if (y > 1.57079632679489661923) then
|
||||
y := -1.57079632679489661923 + fmod(y + 1.57079632679489661923, PI)
|
||||
else if (y < -1.57079632679489661923) then
|
||||
y := 1.57079632679489661923 - fmod(1.57079632679489661923 - y, PI);
|
||||
|
||||
t := x2y2 + 1.0;
|
||||
x2 := 2.0 * FTx^;
|
||||
|
||||
f := t + x2;
|
||||
g := t - x2;
|
||||
|
||||
if (g = 0) or (f/g <= 0) then
|
||||
Exit;
|
||||
|
||||
FPx^ := FPx^ + (v_4) * Ln((t+x2) / (t-x2));
|
||||
FPy^ := FPy^ + (v) * y;
|
||||
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationBipolar.Create;
|
||||
begin
|
||||
bipolar_shift := 0;
|
||||
v_4 := 0;
|
||||
v := 0;
|
||||
s := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationBipolar.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationBipolar.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationBipolar.GetName: string;
|
||||
begin
|
||||
Result := 'bipolar';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationBipolar.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'bipolar_shift';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationBipolar.SetVariable(const Name: string; var value: double): boolean;
|
||||
var temp: double;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'bipolar_shift' then begin
|
||||
temp := frac(0.5 * (value + 1.0));
|
||||
value := 2.0 * temp - 1.0;
|
||||
bipolar_shift := Value;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
function TVariationBipolar.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'bipolar_shift' then begin
|
||||
bipolar_shift := 0;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationBipolar.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 1
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationBipolar.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'bipolar_shift' then begin
|
||||
Value := bipolar_shift;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationBipolar), true, false);
|
||||
end.
|
||||
61
Variations/varBlade.pas
Normal file
61
Variations/varBlade.pas
Normal file
@ -0,0 +1,61 @@
|
||||
{ Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina }
|
||||
|
||||
unit varBlade;
|
||||
|
||||
interface
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationBlade = class(TBaseVariation)
|
||||
private
|
||||
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
////////////////////////
|
||||
|
||||
procedure TVariationBlade.CalcFunction;
|
||||
var
|
||||
r, sinr, cosr: double;
|
||||
begin
|
||||
r := sqrt(sqr(FTx^) + sqr(FTy^)) * vvar;
|
||||
SinCos(r * random, sinr, cosr);
|
||||
r := vvar * FTx^;
|
||||
FPx^ := FPx^ + r * (cosr + sinr);
|
||||
FPy^ := FPy^ + r * (cosr - sinr);
|
||||
// AV: added real 3D support
|
||||
FPz^ := FPz^ + vvar * FTy^ * (sinr - cosr);
|
||||
end;
|
||||
|
||||
constructor TVariationBlade.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
end;
|
||||
|
||||
class function TVariationBlade.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationBlade.Create;
|
||||
end;
|
||||
|
||||
class function TVariationBlade.GetName: string;
|
||||
begin
|
||||
Result := 'blade';
|
||||
end;
|
||||
|
||||
//////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationBlade), true, false);
|
||||
|
||||
end.
|
||||
131
Variations/varBlob.pas
Normal file
131
Variations/varBlob.pas
Normal file
@ -0,0 +1,131 @@
|
||||
{ Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina }
|
||||
|
||||
unit varBlob;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationBlob = class(TBaseVariation)
|
||||
private
|
||||
FLow, FHigh, FWaves: double;
|
||||
VLow, VHeight: double;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationBlob }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationBlob.Prepare;
|
||||
begin
|
||||
VHeight := vvar * (FHigh - FLow) / 2;
|
||||
VLow := vvar * FLow + VHeight;
|
||||
end;
|
||||
|
||||
procedure TVariationBlob.CalcFunction;
|
||||
var
|
||||
r : double;
|
||||
begin
|
||||
r := VLow + VHeight * sin(FWaves * arctan2(FTx^, FTy^));
|
||||
|
||||
FPx^ := FPx^ + r * FTx^;
|
||||
FPy^ := FPy^ + r * FTy^;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationBlob.GetName: string;
|
||||
begin
|
||||
Result := 'blob';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationBlob.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'blob_low';
|
||||
1: Result := 'blob_high';
|
||||
2: Result := 'blob_waves';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationBlob.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 3;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationBlob.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'blob_low' then begin
|
||||
FLow := Value;
|
||||
Result := True;
|
||||
end else if Name = 'blob_high' then begin
|
||||
FHigh := Value;
|
||||
Result := True;
|
||||
end else if Name = 'blob_waves' then begin
|
||||
// Value := Round(Value);
|
||||
FWaves := Value;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationBlob.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'blob_low' then begin
|
||||
Value := FLow;
|
||||
Result := True;
|
||||
end else if Name = 'blob_high' then begin
|
||||
Value := FHigh;
|
||||
Result := True;
|
||||
end else if Name = 'blob_waves' then begin
|
||||
Value := FWaves;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationBlob.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
|
||||
FWaves := Round(2 + 5 * Random);
|
||||
FLow := 0.2 + 0.5 * random;
|
||||
FHigh := 0.8 + 0.4 * random;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationBlob.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationBlob.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationBlob), false, false);
|
||||
end.
|
||||
154
Variations/varBlurCircle.pas
Normal file
154
Variations/varBlurCircle.pas
Normal file
@ -0,0 +1,154 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varBlurCircle;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationBlurCircle = class(TBaseVariation)
|
||||
private
|
||||
PI_4, hole: double;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationBlurCircle.Prepare;
|
||||
begin
|
||||
//VVAR4_PI := VVAR * 4.0 / PI; // AV: it's useless
|
||||
PI_4 := PI / 4.0;
|
||||
end;
|
||||
|
||||
procedure TVariationBlurCircle.CalcFunction;
|
||||
var
|
||||
x, y, absx, absy, side, perimeter, r, sina, cosa: double;
|
||||
begin
|
||||
x := 2.0 * random - 1.0;
|
||||
y := 2.0 * random - 1.0;
|
||||
|
||||
absx := abs(x); //if absx < 0 then absx := absx * -1.0;
|
||||
absy := abs(y); //if absy < 0 then absy := absy * -1.0;
|
||||
|
||||
if (absx >= absy) then
|
||||
begin
|
||||
if (x >= absy) then
|
||||
perimeter := absx + y
|
||||
else perimeter := 5.0 * absx - y;
|
||||
side := absx;
|
||||
end else
|
||||
begin
|
||||
if (y >= absx) then
|
||||
perimeter := 3.0 * absy - x
|
||||
else perimeter := 7.0 * absy + x;
|
||||
side := absy;
|
||||
end;
|
||||
|
||||
r := VVAR * (side + hole);
|
||||
SinCos(PI_4 * perimeter / side - PI_4, sina, cosa);
|
||||
|
||||
FPx^ := FPx^ + r * cosa;
|
||||
FPy^ := FPy^ + r * sina;
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
end;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationBlurCircle.Create;
|
||||
begin
|
||||
hole := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationBlurCircle.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationBlurCircle.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationBlurCircle.GetName: string;
|
||||
begin
|
||||
Result := 'blur_circle';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationBlurCircle.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'blur_circle_hole';
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationBlurCircle.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'blur_circle_hole' then begin
|
||||
hole := Value;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationBlurCircle.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 1;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationBlurCircle.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'blur_circle_hole' then begin
|
||||
Value := hole;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationBlurCircle), true, false);
|
||||
end.
|
||||
153
Variations/varBlurPixelize.pas
Normal file
153
Variations/varBlurPixelize.pas
Normal file
@ -0,0 +1,153 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varBlurPixelize;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationBlurPixelize = class(TBaseVariation)
|
||||
private
|
||||
blur_pixelize_size, blur_pixelize_scale: double;
|
||||
inv_size, v: double;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationBlurPixelize.Prepare;
|
||||
begin
|
||||
inv_size := 1.0 / blur_pixelize_size;
|
||||
v := vvar * blur_pixelize_size;
|
||||
end;
|
||||
|
||||
procedure TVariationBlurPixelize.CalcFunction;
|
||||
var x, y: double;
|
||||
begin
|
||||
x := floor(FTx^*(inv_size));
|
||||
y := floor(FTy^*(inv_size));
|
||||
|
||||
FPx^ := FPx^ + (v) * (x + (blur_pixelize_scale) * (random - 0.5) + 0.5);
|
||||
FPy^ := FPy^ + (v) * (y + (blur_pixelize_scale) * (random - 0.5) + 0.5);
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationBlurPixelize.Create;
|
||||
begin
|
||||
blur_pixelize_size := 0.1;
|
||||
blur_pixelize_scale := 1;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationBlurPixelize.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationBlurPixelize.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationBlurPixelize.GetName: string;
|
||||
begin
|
||||
Result := 'blur_pixelize';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationBlurPixelize.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'blur_pixelize_size';
|
||||
1: Result := 'blur_pixelize_scale';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationBlurPixelize.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'blur_pixelize_size' then begin
|
||||
if (value < 1e-6) then value := 1e-6;
|
||||
blur_pixelize_size := Value;
|
||||
Result := True;
|
||||
end else if Name = 'blur_pixelize_scale' then begin
|
||||
blur_pixelize_scale := Value;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
function TVariationBlurPixelize.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'blur_pixelize_size' then begin
|
||||
blur_pixelize_size := 0.1;
|
||||
Result := True;
|
||||
end else if Name = 'blur_pixelize_scale' then begin
|
||||
blur_pixelize_size := 1;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationBlurPixelize.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 2
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationBlurPixelize.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'blur_pixelize_size' then begin
|
||||
Value := blur_pixelize_size;
|
||||
Result := True;
|
||||
end else if Name = 'blur_pixelize_scale' then begin
|
||||
Value := blur_pixelize_scale;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationBlurPixelize), true, false);
|
||||
end.
|
||||
144
Variations/varBlurZoom.pas
Normal file
144
Variations/varBlurZoom.pas
Normal file
@ -0,0 +1,144 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varBlurZoom;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationBlurZoom = class(TBaseVariation)
|
||||
private
|
||||
blur_zoom_length, blur_zoom_x, blur_zoom_y: double;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationBlurZoom.Prepare;
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure TVariationBlurZoom.CalcFunction;
|
||||
var z: double;
|
||||
begin
|
||||
|
||||
z := 1.0 + blur_zoom_length * random;
|
||||
FPx^ := FPx^ + vvar * ((FTx^ - blur_zoom_x) * z + blur_zoom_x);
|
||||
FPy^ := FPy^ + vvar * ((FTy^ - blur_zoom_y) * z - blur_zoom_y);
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationBlurZoom.Create;
|
||||
begin
|
||||
blur_zoom_length := 0;
|
||||
blur_zoom_x := 0;
|
||||
blur_zoom_y := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationBlurZoom.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationBlurZoom.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationBlurZoom.GetName: string;
|
||||
begin
|
||||
Result := 'blur_zoom';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationBlurZoom.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'blur_zoom_length';
|
||||
1: Result := 'blur_zoom_x';
|
||||
2: Result := 'blur_zoom_y';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationBlurZoom.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'blur_zoom_length' then begin
|
||||
blur_zoom_length := Value;
|
||||
Result := True;
|
||||
end else if Name = 'blur_zoom_x' then begin
|
||||
blur_zoom_y := Value;
|
||||
Result := True;
|
||||
end else if Name = 'blur_zoom_y' then begin
|
||||
blur_zoom_y := Value;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationBlurZoom.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 3
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationBlurZoom.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'blur_zoom_length' then begin
|
||||
Value := blur_zoom_length;
|
||||
Result := True;
|
||||
end else if Name = 'blur_zoom_x' then begin
|
||||
Value := blur_zoom_x;
|
||||
Result := True;
|
||||
end else if Name = 'blur_zoom_y' then begin
|
||||
Value := blur_zoom_y;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationBlurZoom), true, false);
|
||||
end.
|
||||
188
Variations/varBoarders2.pas
Normal file
188
Variations/varBoarders2.pas
Normal file
@ -0,0 +1,188 @@
|
||||
{ Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina }
|
||||
|
||||
unit varBoarders2;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
const
|
||||
sb2c = 'boarders2_c';
|
||||
sleft = 'boarders2_left';
|
||||
sright = 'boarders2_right';
|
||||
eps: double = 1e-30;
|
||||
type
|
||||
TVariationBoarders2 = class(TBaseVariation)
|
||||
private
|
||||
b2c, left, right, cc, cl, cr: double;
|
||||
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationBoarders2 }
|
||||
|
||||
//////////////////////////////////////////
|
||||
procedure TVariationBoarders2.Prepare;
|
||||
begin
|
||||
cc := abs(b2c);
|
||||
cl := cc * abs(left);
|
||||
cr := cc + (cc * abs(right));
|
||||
end;
|
||||
|
||||
//////////////////////////////////////////
|
||||
procedure TVariationBoarders2.CalcFunction;
|
||||
var
|
||||
roundX, roundY, offsetX, offsetY: double;
|
||||
begin
|
||||
roundX := round(FTx^);
|
||||
roundY := round(FTy^);
|
||||
offsetX := FTx^ - roundX;
|
||||
offsetY := FTy^ - roundY;
|
||||
|
||||
if (random >= cr) then
|
||||
begin
|
||||
FPx^ := FPx^ + VVAR * (offsetX * cc + roundX);
|
||||
FPy^ := FPy^ + VVAR * (offsetY * cc + roundY);
|
||||
end
|
||||
else begin
|
||||
if (abs(offsetX) >= abs(offsetY)) then
|
||||
begin
|
||||
if(offsetX >= 0.0) then
|
||||
begin
|
||||
FPx^ := FPx^ + VVAR * (offsetX * cc + roundX + cl);
|
||||
FPy^ := FPy^ + VVAR * (offsetY * cc + roundY + cl * offsetY / offsetX);
|
||||
end
|
||||
else begin
|
||||
FPx^ := FPx^ + VVAR * (offsetX * cc + roundX - cl);
|
||||
FPy^ := FPy^ + VVAR * (offsetY * cc + roundY - cl * offsetY / offsetX);
|
||||
end;
|
||||
end
|
||||
else begin
|
||||
if(offsetY >= 0.0) then
|
||||
begin
|
||||
FPy^ := FPy^ + VVAR * (offsetY * cc + roundY + cl);
|
||||
FPx^ := FPx^ + VVAR * (offsetX * cc + roundX + offsetX / offsetY * cl);
|
||||
end
|
||||
else begin
|
||||
FPy^ := FPy^ + VVAR * (offsetY * cc + roundY - cl);
|
||||
FPx^ := FPx^ + VVAR * (offsetX * cc + roundX - offsetX / offsetY * cl);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
constructor TVariationBoarders2.Create;
|
||||
begin
|
||||
b2c := 0.5;
|
||||
left := 0.5;
|
||||
right := 0.5;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationBoarders2.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationBoarders2.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationBoarders2.GetName: string;
|
||||
begin
|
||||
Result := 'boarders2';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationBoarders2.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index of
|
||||
0: Result := sb2c;
|
||||
1: Result := sleft;
|
||||
2: Result := sright;
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationBoarders2.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = sb2c then begin
|
||||
if abs(value) = 0 then value := eps;
|
||||
b2c := value;
|
||||
Result := True;
|
||||
end else if Name = sleft then begin
|
||||
if abs(value) = 0 then value := eps;
|
||||
left := Value;
|
||||
Result := True;
|
||||
end else if Name = sright then begin
|
||||
if abs(value) = 0 then value := eps;
|
||||
right := Value;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationBoarders2.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = sb2c then begin
|
||||
b2c := 0.5;
|
||||
Result := True;
|
||||
end else if Name = sleft then begin
|
||||
left := 0.5;
|
||||
Result := True;
|
||||
end else if Name = sright then begin
|
||||
right := 0.5;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
function TVariationBoarders2.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 3;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationBoarders2.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = sb2c then begin
|
||||
Value := b2c;
|
||||
Result := True;
|
||||
end else if Name = sleft then begin
|
||||
Value := left;
|
||||
Result := True;
|
||||
end else if Name = sright then begin
|
||||
Value := right;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationBoarders2), false, false);
|
||||
end.
|
||||
160
Variations/varButterfly.pas
Normal file
160
Variations/varButterfly.pas
Normal file
@ -0,0 +1,160 @@
|
||||
{ Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina }
|
||||
|
||||
unit varButterfly;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationButterfly = class(TBaseVariation)
|
||||
const
|
||||
str_sx: string = 'butterfly_scale_negX';
|
||||
str_sy: string = 'butterfly_scale_negY';
|
||||
str_sz: string = 'butterfly_3D_shift';
|
||||
private
|
||||
sx, sy, sz, vpi: double;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationButterfly }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
procedure TVariationButterfly.Prepare;
|
||||
begin
|
||||
vpi := vvar * 4.0 / sqrt(3.0 * pi);
|
||||
end;
|
||||
|
||||
procedure TVariationButterfly.CalcFunction;
|
||||
var r, y2: double;
|
||||
begin
|
||||
y2 := FTy^ * 2.0;
|
||||
r := vpi * sqrt(abs(FTy^ * FTx^)/(sqr(FTx^) + sqr(y2) + 1E-20));
|
||||
|
||||
if (FTy^ < 0) then begin
|
||||
FPx^ := FPx^ + FTx^ * r;
|
||||
FPy^ := FPy^ + r * y2;
|
||||
end else begin
|
||||
FPx^ := FPx^ + sx * FTx^ * r;
|
||||
FPy^ := FPy^ + sy * r * y2;
|
||||
end;
|
||||
|
||||
if (sz <> 0) then
|
||||
FPz^ := FPz^ + sz * r * abs(FTx^); //* Hypot(FTx^, FTy^);
|
||||
end;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationButterfly.Create;
|
||||
begin
|
||||
sx := 1;
|
||||
sy := 1;
|
||||
sz := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationButterfly.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationButterfly.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationButterfly.GetName: string;
|
||||
begin
|
||||
Result := 'butterfly';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationButterfly.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := str_sx;
|
||||
1: Result := str_sy;
|
||||
2: Result := str_sz;
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationButterfly.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = str_sx then begin
|
||||
if (value < 0) then value := abs(value);
|
||||
sx := Value;
|
||||
Result := True;
|
||||
end else if Name = str_sy then begin
|
||||
if (value < 0) then value := abs(value);
|
||||
sy := Value;
|
||||
Result := True;
|
||||
end else if Name = str_sz then begin
|
||||
if (value < -0.1) then value := -0.1;
|
||||
sz := Value;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationButterfly.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = str_sx then begin
|
||||
sx := 1;
|
||||
Result := True;
|
||||
end else if Name = str_sy then begin
|
||||
sy := 1;
|
||||
Result := True;
|
||||
end else if Name = str_sz then begin
|
||||
sz := 0;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationButterfly.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 3;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationButterfly.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = str_sx then begin
|
||||
Value := sx;
|
||||
Result := True;
|
||||
end else if Name = str_sy then begin
|
||||
Value := sy;
|
||||
Result := True;
|
||||
end else if Name = str_sz then begin
|
||||
Value := sz;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationButterfly), true, false);
|
||||
end.
|
||||
238
Variations/varBwraps.pas
Normal file
238
Variations/varBwraps.pas
Normal file
@ -0,0 +1,238 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varBwraps;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationBwraps = class(TBaseVariation)
|
||||
private
|
||||
bwraps_cellsize, bwraps_space, bwraps_gain,
|
||||
bwraps_inner_twist, bwraps_outer_twist,
|
||||
g2, r2, rfactor: double;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationBwraps.Prepare;
|
||||
var
|
||||
max_bubble, radius: double;
|
||||
begin
|
||||
radius := 0.5 * (bwraps_cellsize / (1.0 + sqr(bwraps_space)));
|
||||
g2 := sqr(bwraps_gain) / (radius + 1e-6) + 1e-6;
|
||||
max_bubble := g2 * radius;
|
||||
|
||||
if (max_bubble > 2.0) then max_bubble := 1.0
|
||||
else max_bubble := max_bubble * (1.0 / (sqr(max_bubble)/4.0 + 1.0));
|
||||
|
||||
r2 := sqr(radius);
|
||||
rfactor := radius / max_bubble;
|
||||
end;
|
||||
|
||||
procedure TVariationBwraps.CalcFunction;
|
||||
var
|
||||
Vx, Vy,
|
||||
Cx, Cy,
|
||||
Lx, Ly,
|
||||
r, theta, s, c : double;
|
||||
begin
|
||||
Vx := FTx^;
|
||||
Vy := FTy^;
|
||||
|
||||
if (bwraps_cellsize = 0.0) then
|
||||
begin
|
||||
FPx^ := FPx^ + VVAR * FTx^;
|
||||
FPy^ := FPy^ + VVAR * FTy^;
|
||||
FPz^ := FPz^ + VVAR * FTz^;
|
||||
end else
|
||||
begin
|
||||
Cx := (floor(Vx / bwraps_cellsize) + 0.5) * bwraps_cellsize;
|
||||
Cy := (floor(Vy / bwraps_cellsize) + 0.5) * bwraps_cellsize;
|
||||
|
||||
Lx := Vx - Cx;
|
||||
Ly := Vy - Cy;
|
||||
|
||||
if ((sqr(Lx) + sqr(Ly)) > r2) then
|
||||
begin
|
||||
FPx^ := FPx^ + VVAR * FTx^;
|
||||
FPy^ := FPy^ + VVAR * FTy^;
|
||||
FPz^ := FPz^ + VVAR * FTz^;
|
||||
end else
|
||||
begin
|
||||
Lx := Lx * g2;
|
||||
Ly := Ly * g2;
|
||||
|
||||
r := rfactor / ((sqr(Lx) + sqr(Ly)) / 4.0 + 1);
|
||||
|
||||
Lx := Lx * r;
|
||||
Ly := Ly * r;
|
||||
|
||||
r := (sqr(Lx) + sqr(Ly)) / r2;
|
||||
theta := bwraps_inner_twist * (1.0 - r) + bwraps_outer_twist * r;
|
||||
SinCos(theta, s, c);
|
||||
|
||||
Vx := Cx + c * Lx + s * Ly;
|
||||
Vy := Cy - s * Lx + c * Ly;
|
||||
|
||||
FPx^ := FPx^ + VVAR * Vx;
|
||||
FPy^ := FPy^ + VVAR * Vy;
|
||||
FPz^ := FPz^ + VVAR * FTz^;
|
||||
end;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationBwraps.Create;
|
||||
begin
|
||||
bwraps_cellsize := 1;
|
||||
bwraps_space := 0;
|
||||
bwraps_gain := 1;
|
||||
bwraps_inner_twist := 0;
|
||||
bwraps_outer_twist := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationBwraps.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationBwraps.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationBwraps.GetName: string;
|
||||
begin
|
||||
Result := 'bwraps';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationBwraps.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'bwraps_cellsize';
|
||||
1: Result := 'bwraps_space';
|
||||
2: Result := 'bwraps_gain';
|
||||
3: Result := 'bwraps_inner_twist';
|
||||
4: Result := 'bwraps_outer_twist';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationBwraps.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'bwraps_cellsize' then begin
|
||||
bwraps_cellsize := Value;
|
||||
Result := True;
|
||||
end else if Name = 'bwraps_space' then begin
|
||||
bwraps_space := Value;
|
||||
Result := True;
|
||||
end else if Name = 'bwraps_gain' then begin
|
||||
bwraps_gain := Value;
|
||||
Result := True;
|
||||
end else if Name = 'bwraps_inner_twist' then begin
|
||||
bwraps_inner_twist := Value;
|
||||
Result := True;
|
||||
end else if Name = 'bwraps_outer_twist' then begin
|
||||
bwraps_outer_twist := Value;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
function TVariationBwraps.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'bwraps_cellsize' then begin
|
||||
bwraps_cellsize := 1;
|
||||
Result := True;
|
||||
end else if Name = 'bwraps_space' then begin
|
||||
bwraps_space := 0;
|
||||
Result := True;
|
||||
end else if Name = 'bwraps_gain' then begin
|
||||
bwraps_gain := 1;
|
||||
Result := True;
|
||||
end else if Name = 'bwraps_inner_twist' then begin
|
||||
bwraps_inner_twist := 0;
|
||||
Result := True;
|
||||
end else if Name = 'bwraps_outer_twist' then begin
|
||||
bwraps_outer_twist := 0;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationBwraps.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 5
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationBwraps.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'bwraps_cellsize' then begin
|
||||
if Value = 0 then Value := 1e-6;
|
||||
Value := bwraps_cellsize;
|
||||
Result := True;
|
||||
end else if Name = 'bwraps_space' then begin
|
||||
Value := bwraps_space;
|
||||
Result := True;
|
||||
end else if Name = 'bwraps_gain' then begin
|
||||
Value := bwraps_gain;
|
||||
Result := True;
|
||||
end else if Name = 'bwraps_inner_twist' then begin
|
||||
Value := bwraps_inner_twist;
|
||||
Result := True;
|
||||
end else if Name = 'bwraps_outer_twist' then begin
|
||||
Value := bwraps_outer_twist;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationBwraps), true, false);
|
||||
end.
|
||||
233
Variations/varCircleCrop.pas
Normal file
233
Variations/varCircleCrop.pas
Normal file
@ -0,0 +1,233 @@
|
||||
{ Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina }
|
||||
|
||||
unit varCircleCrop;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationCircleCrop = class(TBaseVariation)
|
||||
|
||||
const
|
||||
sx : string = 'circlecrop_x';
|
||||
sy : string = 'circlecrop_y';
|
||||
sradius : string = 'circlecrop_radius';
|
||||
szero : string = 'circlecrop_zero';
|
||||
sarea : string = 'circlecrop_scatter_area';
|
||||
srewrite: string = 'circlecrop_rewrite_xy'; // AV
|
||||
|
||||
private
|
||||
x0, y0, radius, scatter_area, ca: double;
|
||||
zero, rewrite: byte;
|
||||
resetpoint: boolean;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationCircleCrop }
|
||||
|
||||
//////////////////////////////////////////
|
||||
|
||||
procedure TVariationCircleCrop.Prepare;
|
||||
begin
|
||||
ca := max(-1.0, min(scatter_area, 1.0));
|
||||
resetpoint := (rewrite = 1);
|
||||
end;
|
||||
|
||||
procedure TVariationCircleCrop.CalcFunction;
|
||||
var
|
||||
x, y, rad, ang, rdc, sn, cn: double;
|
||||
begin
|
||||
x := FTx^ - x0;
|
||||
y := FTy^ - y0;
|
||||
rad := Hypot(x, y);
|
||||
|
||||
if resetpoint then
|
||||
begin
|
||||
FTx^ := x;
|
||||
FTy^ := y;
|
||||
end;
|
||||
|
||||
if (rad > radius) then
|
||||
begin
|
||||
if (zero = 1) then
|
||||
begin
|
||||
if resetpoint then
|
||||
begin
|
||||
FPx^ := 0;
|
||||
FPy^ := 0;
|
||||
end else
|
||||
begin
|
||||
FPx^ := FPx^;
|
||||
FPy^ := FPy^;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
ang := arctan2(y, x);
|
||||
SinCos(ang, sn, cn);
|
||||
rdc := radius + (random * 0.5 * ca);
|
||||
|
||||
FPx^ := FPx^ + vvar * rdc * cn + x0;
|
||||
FPy^ := FPy^ + vvar * rdc * sn + y0;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
FPx^ := FPx^ + vvar * x + x0;
|
||||
FPy^ := FPy^ + vvar * y + y0;
|
||||
end;
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
end;
|
||||
|
||||
constructor TVariationCircleCrop.Create;
|
||||
begin
|
||||
x0 := 0;
|
||||
y0 := 0;
|
||||
radius := 1;
|
||||
scatter_area := 0;
|
||||
zero := 0;
|
||||
rewrite := 1;
|
||||
end;
|
||||
|
||||
class function TVariationCircleCrop.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationCircleCrop.Create;
|
||||
end;
|
||||
|
||||
class function TVariationCircleCrop.GetName: string;
|
||||
begin
|
||||
Result := 'circlecrop';
|
||||
end;
|
||||
|
||||
function TVariationCircleCrop.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 6;
|
||||
end;
|
||||
|
||||
function TVariationCircleCrop.GetVariable(const Name: string;
|
||||
var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = sx then begin
|
||||
Value := x0;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sy then begin
|
||||
Value := y0;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sradius then begin
|
||||
Value := radius;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sarea then begin
|
||||
Value := scatter_area;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = szero then begin
|
||||
Value := zero;
|
||||
Result := True;
|
||||
end else if Name = srewrite then begin
|
||||
Value := rewrite;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationCircleCrop.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := sradius;
|
||||
1: Result := sx;
|
||||
2: Result := sy;
|
||||
3: Result := sarea;
|
||||
4: Result := szero;
|
||||
5: Result := srewrite;
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationCircleCrop.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = sx then begin
|
||||
x0 := 0;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sy then begin
|
||||
y0 := 0;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sradius then begin
|
||||
radius := 1;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sarea then begin
|
||||
scatter_area := 0;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = szero then begin
|
||||
zero := 0;
|
||||
Result := True;
|
||||
end else if Name = srewrite then begin
|
||||
rewrite := 1;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationCircleCrop.SetVariable(const Name: string;
|
||||
var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = sx then begin
|
||||
x0 := Value;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sy then begin
|
||||
y0 := Value;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sradius then begin
|
||||
radius := Value;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sarea then begin
|
||||
scatter_area := Value;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = szero then begin
|
||||
if Value < 0 then Value := 0;
|
||||
if Value > 1 then Value := 1;
|
||||
zero := Round(Value);
|
||||
Result := True;
|
||||
end else if Name = srewrite then begin
|
||||
if Value < 0 then Value := 0;
|
||||
if Value > 1 then Value := 1;
|
||||
rewrite := Round(Value);
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationCircleCrop), true, false);
|
||||
|
||||
end.
|
||||
151
Variations/varCirclize.pas
Normal file
151
Variations/varCirclize.pas
Normal file
@ -0,0 +1,151 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varCirclize;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationCirclize = class(TBaseVariation)
|
||||
private
|
||||
PI_4, hole: double;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationCirclize.Prepare;
|
||||
begin
|
||||
PI_4 := PI * 0.25;
|
||||
end;
|
||||
|
||||
procedure TVariationCirclize.CalcFunction;
|
||||
var
|
||||
absx, absy, side, perimeter, r, sina, cosa: double;
|
||||
begin
|
||||
|
||||
absx := abs(FTx^);
|
||||
absy := abs(FTy^);
|
||||
|
||||
if (absx >= absy) then
|
||||
begin
|
||||
if (FTx^ >= absy) then
|
||||
perimeter := absx + FTy^
|
||||
else perimeter := 5.0 * absx - FTy^;
|
||||
side := absx;
|
||||
end else
|
||||
begin
|
||||
if (FTy^ >= absx) then
|
||||
perimeter := 3.0 * absy - FTx^
|
||||
else perimeter := 7.0 * absy + FTx^;
|
||||
side := absy;
|
||||
end;
|
||||
|
||||
r := VVAR * (side + hole);
|
||||
SinCos(PI_4 * perimeter / side - PI_4, sina, cosa);
|
||||
|
||||
FPx^ := FPx^ + r * cosa;
|
||||
FPy^ := FPy^ + r * sina;
|
||||
//FPz^ := FPz^ + vvar * FTz^;
|
||||
end;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationCirclize.Create;
|
||||
begin
|
||||
hole := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationCirclize.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationCirclize.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationCirclize.GetName: string;
|
||||
begin
|
||||
Result := 'circlize2';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationCirclize.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'circlize2_hole';
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationCirclize.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'circlize2_hole' then begin
|
||||
hole := Value;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationCirclize.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 1;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationCirclize.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'circlize2_hole' then begin
|
||||
Value := hole;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationCirclize), false, false);
|
||||
end.
|
||||
137
Variations/varCosine.pas
Normal file
137
Variations/varCosine.pas
Normal file
@ -0,0 +1,137 @@
|
||||
{ Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina }
|
||||
|
||||
unit varCosine;
|
||||
|
||||
interface
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationCosine = class(TBaseVariation)
|
||||
private
|
||||
old: byte;
|
||||
procedure CalcPlugin;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure CalcFunction; override;
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
////////////////////////
|
||||
procedure TVariationCosine.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
if old = 1 then f := CalcFunction // Apo 2.09 version
|
||||
else f := CalcPlugin; // cosine.dll
|
||||
end;
|
||||
|
||||
procedure TVariationCosine.CalcFunction;
|
||||
var
|
||||
sinx, cosx, sinhy, coshy: double;
|
||||
begin
|
||||
SinCos(FTx^ * PI, sinx, cosx);
|
||||
if FTy^ = 0 then
|
||||
// sinh(0) = 0, cosh(0) = 1
|
||||
FPx^ := FPx^ + vvar * cosx
|
||||
else begin
|
||||
SinhCosh(FTy^, sinhy, coshy);
|
||||
FPx^ := FPx^ + vvar * cosx * coshy;
|
||||
FPy^ := FPy^ - vvar * sinx * sinhy;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TVariationCosine.CalcPlugin;
|
||||
var
|
||||
sinx, cosx, sinhy, coshy: double;
|
||||
begin
|
||||
SinCos(FTx^ * PI, sinx, cosx);
|
||||
if FTy^ = 0 then
|
||||
// sinh(0) = 0, cosh(0) = 1
|
||||
FPx^ := FPx^ + vvar * cosx
|
||||
else begin
|
||||
SinhCosh(FTy^, sinhy, coshy);
|
||||
FPx^ := FPx^ + vvar * cosx * coshy;
|
||||
FPy^ := FPy^ + vvar * sinx * sinhy;
|
||||
end;
|
||||
end;
|
||||
|
||||
constructor TVariationCosine.Create;
|
||||
begin
|
||||
old := 1;
|
||||
end;
|
||||
|
||||
class function TVariationCosine.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationCosine.Create;
|
||||
end;
|
||||
|
||||
class function TVariationCosine.GetName: string;
|
||||
begin
|
||||
Result := 'cosine';
|
||||
end;
|
||||
|
||||
function TVariationCosine.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 1;
|
||||
end;
|
||||
|
||||
function TVariationCosine.GetVariable(const Name: string;
|
||||
var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'cosine_old' then begin
|
||||
value := old;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationCosine.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index of
|
||||
0: Result := 'cosine_old';
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationCosine.SetVariable(const Name: string;
|
||||
var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'cosine_old' then begin
|
||||
if Value < 0 then Value := 0;
|
||||
if Value > 1 then Value := 1;
|
||||
old := Round(value);
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationCosine.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'cosine_old' then begin
|
||||
old := 1;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
//////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationCosine), false, false);
|
||||
|
||||
end.
|
||||
117
Variations/varCothSpiral.pas
Normal file
117
Variations/varCothSpiral.pas
Normal file
@ -0,0 +1,117 @@
|
||||
{
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
"Chaotica" Copyright (C) 2019 Glare Technologies Limited
|
||||
}
|
||||
|
||||
unit varCothSpiral;
|
||||
|
||||
interface
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationCothSpiral = class(TBaseVariation)
|
||||
private
|
||||
ta: double;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
////////////////////////
|
||||
|
||||
procedure TVariationCothSpiral.CalcFunction;
|
||||
var
|
||||
t, aux, sn, cn, snh, cnh: double;
|
||||
begin
|
||||
t := (random - 0.5) * 6.28318530717959;
|
||||
|
||||
SinCos(ta * t, sn, cn);
|
||||
SinhCosh(t, snh, cnh);
|
||||
|
||||
aux := (cn - cnh);
|
||||
if aux = 0 then aux := 1e-20;
|
||||
aux := vvar / aux;
|
||||
|
||||
FPx^ := FPx^ - snh * aux;
|
||||
FPy^ := FPy^ + sn * aux;
|
||||
end;
|
||||
|
||||
constructor TVariationCothSpiral.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
ta := 4;
|
||||
end;
|
||||
|
||||
class function TVariationCothSpiral.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationCothSpiral.Create;
|
||||
end;
|
||||
|
||||
class function TVariationCothSpiral.GetName: string;
|
||||
begin
|
||||
Result := 'coth_spiral';
|
||||
end;
|
||||
|
||||
function TVariationCothSpiral.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 1;
|
||||
end;
|
||||
|
||||
function TVariationCothSpiral.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'coth_spiral_a';
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationCothSpiral.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'coth_spiral_a' then begin
|
||||
Value := ta;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationCothSpiral.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'coth_spiral_a' then begin
|
||||
ta := Value;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationCothSpiral.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'coth_spiral_a' then begin
|
||||
ta := 4;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
//////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationCothSpiral), false, false);
|
||||
|
||||
end.
|
||||
192
Variations/varCpow3.pas
Normal file
192
Variations/varCpow3.pas
Normal file
@ -0,0 +1,192 @@
|
||||
{ Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina }
|
||||
|
||||
unit varCpow3;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
const
|
||||
sr = 'cpow3_r';
|
||||
sd = 'cpow3_d';
|
||||
sdivisor = 'cpow3_divisor';
|
||||
sspread = 'cpow3_spread';
|
||||
|
||||
type
|
||||
TVariationCpow3 = class(TBaseVariation)
|
||||
private
|
||||
r, d1, spread: double;
|
||||
divisor: integer;
|
||||
|
||||
ang, a2, d2, half_d, c2, half_c, coeff: double;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationCpow3 }
|
||||
|
||||
//////////////////////////////////////////
|
||||
procedure TVariationCpow3.Prepare;
|
||||
var ca, sa: double;
|
||||
begin
|
||||
ang := PI2 / divisor;
|
||||
if (d1 < 0) then
|
||||
a2 := arctan2(-ln(-d1) * r, PI2)
|
||||
else
|
||||
a2 := arctan2(ln(d1) * r, PI2);
|
||||
SinCos(a2, sa, ca);
|
||||
c2 := ca * r * ca / divisor;
|
||||
d2 := ca * r * sa / divisor;
|
||||
half_c := c2 * 0.5;
|
||||
half_d := d2 * 0.5;
|
||||
if (d2 = 0) then
|
||||
coeff := 0
|
||||
else
|
||||
coeff := -0.095 * spread / d2;
|
||||
end;
|
||||
|
||||
//////////////////////////////////////////
|
||||
procedure TVariationCpow3.CalcFunction;
|
||||
var t, sn, cn, r2, lnr2: double;
|
||||
begin
|
||||
t := arctan2(FTy^, FTx^);
|
||||
if (t < 0) then t := t + PI2;
|
||||
if (cos(t * 0.5) < (2 * random - 1)) then
|
||||
t := t - PI2;
|
||||
if (random < 0.5) then
|
||||
t := t + PI2 * round(ln(random) * coeff)
|
||||
else
|
||||
t := t - PI2 * round(ln(random) * coeff);
|
||||
lnr2 := ln(FTx^ * FTx^ + FTy^ * FTy^);
|
||||
r2 := vvar * exp(half_c * lnr2 - d2 * t);
|
||||
SinCos(c2 * t + half_d * lnr2 + ang * random(32767), sn, cn);
|
||||
|
||||
FPx^ := FPx^ + r2 * cn;
|
||||
FPy^ := FPy^ + r2 * sn;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
constructor TVariationCpow3.Create;
|
||||
begin
|
||||
r := 1;
|
||||
d1 := 1;
|
||||
divisor := 1;
|
||||
spread := 1;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationCpow3.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationCpow3.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationCpow3.GetName: string;
|
||||
begin
|
||||
Result := 'cpow3';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationCpow3.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index of
|
||||
0: Result := sr;
|
||||
1: Result := sd;
|
||||
2: Result := sdivisor;
|
||||
3: Result := sspread;
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationCpow3.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = sr then begin
|
||||
r := Value;
|
||||
Result := True;
|
||||
end else if Name = sd then begin
|
||||
if (Value = 0) then Value := 1;
|
||||
d1 := value;
|
||||
Result := True;
|
||||
end else if Name = sdivisor then begin
|
||||
if (Value = 0) then Value := 1;
|
||||
divisor := Round(Value);
|
||||
Result := True;
|
||||
end else if Name = sspread then begin
|
||||
spread := Value;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationCpow3.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = sr then begin
|
||||
r := 1;
|
||||
Result := True;
|
||||
end else if Name = sd then begin
|
||||
d1 := 1;
|
||||
Result := True;
|
||||
end else if Name = sspread then begin
|
||||
spread := 1;
|
||||
Result := True;
|
||||
end else if Name = sdivisor then begin
|
||||
divisor := 1;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
function TVariationCpow3.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 4;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationCpow3.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = sr then begin
|
||||
Value := r;
|
||||
Result := true;
|
||||
end
|
||||
else if Name = sd then begin
|
||||
Value := d1;
|
||||
Result := true;
|
||||
end else if Name = sspread then begin
|
||||
Value := spread;
|
||||
Result := true;
|
||||
end else if Name = sdivisor then begin
|
||||
Value := divisor;
|
||||
Result := true;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationCpow3), false, false);
|
||||
end.
|
||||
314
Variations/varCrop.pas
Normal file
314
Variations/varCrop.pas
Normal file
@ -0,0 +1,314 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varCrop;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationCrop = class(TBaseVariation)
|
||||
const
|
||||
n_x0 : string = 'crop_left';
|
||||
n_y0 : string = 'crop_top';
|
||||
n_x1 : string = 'crop_right';
|
||||
n_y1 : string = 'crop_bottom';
|
||||
n_s : string = 'crop_scatter_area';
|
||||
n_z : string = 'crop_zero';
|
||||
n : string = 'crop';
|
||||
n_z1 : string = 'crop_high'; // AV
|
||||
n_z0 : string = 'crop_low'; //AV
|
||||
n_3D : string = 'crop_use3D'; // AV
|
||||
private
|
||||
x0, y0, x1, y1, z0, z1, s, w, h, l: double;
|
||||
_x0, _y0, _x1, _y1, _z0, _z1: double;
|
||||
z, c3D: byte;
|
||||
|
||||
procedure Calc2D;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationCrop.Prepare;
|
||||
begin
|
||||
if (x0 < x1) then begin
|
||||
_x0 := x0;
|
||||
_x1 := x1;
|
||||
end else begin
|
||||
_x0 := x1;
|
||||
_x1 := x0;
|
||||
end;
|
||||
|
||||
if (y0 < y1) then begin
|
||||
_y0 := y0;
|
||||
_y1 := y1;
|
||||
end else begin
|
||||
_y0 := y1;
|
||||
_y1 := y0;
|
||||
end;
|
||||
|
||||
if (z0 < z1) then begin
|
||||
_z0 := z0;
|
||||
_z1 := z1;
|
||||
end else begin
|
||||
_z0 := z1;
|
||||
_z1 := z0;
|
||||
end;
|
||||
|
||||
w := (_x1 - _x0) * 0.5 * s;
|
||||
h := (_y1 - _y0) * 0.5 * s;
|
||||
l := (_z1 - _z0) * 0.5 * s;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
procedure TVariationCrop.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
if (c3D = 0) then f := Calc2D
|
||||
else f := CalcFunction;
|
||||
end;
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
procedure TVariationCrop.CalcFunction;
|
||||
var x, y, tz: double;
|
||||
begin
|
||||
x := FTx^;
|
||||
y := FTy^;
|
||||
tz := FTz^;
|
||||
|
||||
if ((x < _x0) or (x > _x1) or (y < _y0) or (y > _y1) or (tz < _z0) or (tz > _z1))
|
||||
and (z <> 0) then begin
|
||||
x := 0; y := 0; tz := 0;
|
||||
end else
|
||||
begin
|
||||
if x < _x0 then x := _x0 + random * w
|
||||
else if x > _x1 then x := _x1 - random * w;
|
||||
if y < _y0 then y := _y0 + random * h
|
||||
else if y > _y1 then y := _y1 - random * h;
|
||||
if tz < _z0 then tz := _z0 + random * l
|
||||
else if tz > _z1 then tz := _z1 - random * l;
|
||||
end;
|
||||
|
||||
FPx^ := FPx^ + VVAR * x;
|
||||
FPy^ := FPy^ + VVAR * y;
|
||||
FPz^ := FPz^ + VVAR * tz; // AV
|
||||
end;
|
||||
|
||||
procedure TVariationCrop.Calc2D;
|
||||
var x, y: double;
|
||||
begin
|
||||
x := FTx^;
|
||||
y := FTy^;
|
||||
|
||||
if ((x < _x0) or (x > _x1) or (y < _y0) or (y > _y1)) and (z <> 0) then begin
|
||||
x := 0; y := 0;
|
||||
end else
|
||||
begin
|
||||
if x < _x0 then x := _x0 + random * w
|
||||
else if x > _x1 then x := _x1 - random * w;
|
||||
if y < _y0 then y := _y0 + random * h
|
||||
else if y > _y1 then y := _y1 - random * h;
|
||||
end;
|
||||
|
||||
FPx^ := FPx^ + VVAR * x;
|
||||
FPy^ := FPy^ + VVAR * y;
|
||||
FPz^ := FPz^ + vvar * FTz^; // AV: for backward compatibility only
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationCrop.Create;
|
||||
begin
|
||||
x0 := -1; x1 := 1;
|
||||
y0 := -1; y1 := 1;
|
||||
z0 := -1; z1 := 1;
|
||||
c3D := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationCrop.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationCrop.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationCrop.GetName: string;
|
||||
begin
|
||||
Result := n;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationCrop.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := n_x0;
|
||||
1: Result := n_y0;
|
||||
2: Result := n_x1;
|
||||
3: Result := n_y1;
|
||||
4: Result := n_z0;
|
||||
5: Result := n_z1;
|
||||
6: Result := n_s;
|
||||
7: Result := n_z;
|
||||
8: Result := n_3D;
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationCrop.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = n_x0 then begin
|
||||
x0 := Value;
|
||||
Result := True;
|
||||
end else if Name = n_y0 then begin
|
||||
y0 := Value;
|
||||
Result := True;
|
||||
end else if Name = n_x1 then begin
|
||||
x1 := Value;
|
||||
Result := True;
|
||||
end else if Name = n_y1 then begin
|
||||
y1 := Value;
|
||||
Result := True;
|
||||
end else if Name = n_z0 then begin
|
||||
z0 := Value;
|
||||
Result := True;
|
||||
end else if Name = n_z1 then begin
|
||||
z1 := Value;
|
||||
Result := True;
|
||||
end else if Name = n_s then begin
|
||||
if (Value < -1) then Value := -1;
|
||||
if (Value > 1) then Value := 1;
|
||||
s := Value;
|
||||
Result := True;
|
||||
end else if Name = n_z then begin
|
||||
if (Value > 1) then Value := 1;
|
||||
if (Value < 0) then Value := 0;
|
||||
z := Round(Value);
|
||||
Result := True;
|
||||
end else if Name = n_3D then begin
|
||||
if (Value > 1) then Value := 1;
|
||||
if (Value < 0) then Value := 0;
|
||||
c3D := Round(Value);
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
function TVariationCrop.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = n_x0 then begin
|
||||
x0 := -1;
|
||||
Result := True;
|
||||
end else if Name = n_y0 then begin
|
||||
y0 := -1;
|
||||
Result := True;
|
||||
end else if Name = n_x1 then begin
|
||||
x1 := 1;
|
||||
Result := True;
|
||||
end else if Name = n_y1 then begin
|
||||
y1 := 1;
|
||||
Result := True;
|
||||
end else if Name = n_z0 then begin
|
||||
z0 := -1;
|
||||
Result := True;
|
||||
end else if Name = n_z1 then begin
|
||||
z1 := 1;
|
||||
Result := True;
|
||||
end else if Name = n_s then begin
|
||||
s := 0;
|
||||
Result := True;
|
||||
end else if Name = n_z then begin
|
||||
z := 0;
|
||||
Result := True;
|
||||
end else if Name = n_3D then begin
|
||||
c3D := 0;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationCrop.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 9
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationCrop.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = n_x0 then begin
|
||||
Value := x0;
|
||||
Result := True;
|
||||
end else if Name = n_y0 then begin
|
||||
Value := y0;
|
||||
Result := True;
|
||||
end else if Name = n_x1 then begin
|
||||
Value := x1;
|
||||
Result := True;
|
||||
end else if Name = n_y1 then begin
|
||||
Value := y1;
|
||||
Result := True;
|
||||
end else if Name = n_z0 then begin
|
||||
Value := z0;
|
||||
Result := True;
|
||||
end else if Name = n_z1 then begin
|
||||
Value := z1;
|
||||
Result := True;
|
||||
end else if Name = n_s then begin
|
||||
Value := s;
|
||||
Result := True;
|
||||
end else if Name = n_z then begin
|
||||
Value := z;
|
||||
Result := True;
|
||||
end else if Name = n_3D then begin
|
||||
Value := c3D;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationCrop), true, false);
|
||||
end.
|
||||
418
Variations/varCurl.pas
Normal file
418
Variations/varCurl.pas
Normal file
@ -0,0 +1,418 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varCurl;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
const
|
||||
variation_name = 'curl';
|
||||
num_vars = 2;
|
||||
var_c1_name='curl_c1';
|
||||
var_c2_name='curl_c2';
|
||||
|
||||
{$ifdef Apo7X64}
|
||||
{$else}
|
||||
{$define _ASM_}
|
||||
{$endif}
|
||||
|
||||
// z
|
||||
// The formula is: f(z) = ------------------- , where z = complex (x + i*y)
|
||||
// c2*(z^2) + c1*z + 1
|
||||
|
||||
type
|
||||
TVariationCurl = class(TBaseVariation)
|
||||
private
|
||||
c2, c1: double;
|
||||
|
||||
c2x2: double;
|
||||
|
||||
procedure CalcZeroC2;
|
||||
procedure CalcZeroC1;
|
||||
procedure CalcZeroC2C1;
|
||||
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
math;
|
||||
|
||||
// TVariationCurl
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationCurl.Create;
|
||||
begin
|
||||
// seriously?
|
||||
(*c1 := random;
|
||||
c2 := random;
|
||||
|
||||
case random(3) of
|
||||
0: c1 := 0;
|
||||
1: c2 := 0;
|
||||
{else: do nothing}
|
||||
end;*)
|
||||
c1 := 0;
|
||||
c2 := 0;
|
||||
end;
|
||||
|
||||
procedure TVariationCurl.Prepare;
|
||||
begin
|
||||
c2x2 := 2 * c2;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationCurl.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
if IsZero(c1) then begin
|
||||
if IsZero(c2) then
|
||||
f := CalcZeroC2C1
|
||||
else
|
||||
f := CalcZeroC1
|
||||
end
|
||||
else begin
|
||||
if IsZero(c2) then
|
||||
f := CalcZeroC2
|
||||
else
|
||||
f := CalcFunction
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationCurl.CalcFunction;
|
||||
{$ifndef _ASM_}
|
||||
var
|
||||
r: double;
|
||||
re, im: double;
|
||||
begin
|
||||
re := 1 + c1*FTx^ + c2*(sqr(FTx^) - sqr(FTy^));
|
||||
im := c1*FTy^ + c2x2*FTx^*FTy^;
|
||||
|
||||
r := vvar / (sqr(re) + sqr(im));
|
||||
|
||||
FPx^ := FPx^ + (FTx^*re + FTy^*im) * r;
|
||||
FPy^ := FPy^ + (FTy^*re - FTx^*im) * r;
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
{$else}
|
||||
asm
|
||||
mov edx, [eax + FTx]
|
||||
// AV: for Apo7X.15C compatibility
|
||||
fld qword ptr [eax + vvar]
|
||||
fmul qword ptr [edx + 32] // FTz
|
||||
fadd qword ptr [edx + 40] // FPz
|
||||
fstp qword ptr [edx + 40]
|
||||
// main code
|
||||
fld qword ptr [edx + 8] // FTy
|
||||
fld qword ptr [edx] // FTx
|
||||
fld st(1)
|
||||
fmul st, st(1)
|
||||
fmul qword ptr [eax + c2x2]
|
||||
fld st(2)
|
||||
fmul qword ptr [eax + c1]
|
||||
faddp
|
||||
fld st(2)
|
||||
fmul st, st
|
||||
fld st(2)
|
||||
fmul st, st
|
||||
fsubrp
|
||||
fmul qword ptr [eax + c2]
|
||||
fld1
|
||||
faddp
|
||||
fld st(2)
|
||||
fmul qword ptr [eax + c1]
|
||||
faddp
|
||||
|
||||
fld st(1)
|
||||
fmul st, st
|
||||
fld st(1)
|
||||
fmul st, st
|
||||
faddp
|
||||
fdivr qword ptr [eax + vvar]
|
||||
|
||||
fld st(3)
|
||||
fmul st, st(2)
|
||||
fld st(5)
|
||||
fmul st, st(4)
|
||||
faddp
|
||||
fmul st, st(1)
|
||||
fadd qword ptr [edx + 16] // FPx
|
||||
fstp qword ptr [edx + 16]
|
||||
|
||||
fxch st(4)
|
||||
fmulp
|
||||
fxch st(2)
|
||||
fmulp
|
||||
fsubp
|
||||
fmulp
|
||||
fadd qword ptr [edx + 24] // FPy
|
||||
fstp qword ptr [edx + 24]
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TVariationCurl.CalcZeroC2; // AV: Mobius case
|
||||
{$ifndef _ASM_}
|
||||
var
|
||||
r: double;
|
||||
re, im: double;
|
||||
begin
|
||||
re := 1 + c1*FTx^;
|
||||
im := c1*FTy^;
|
||||
|
||||
r := vvar / (sqr(re) + sqr(im));
|
||||
|
||||
FPx^ := FPx^ + (FTx^*re + FTy^*im) * r;
|
||||
FPy^ := FPy^ + (FTy^*re - FTx^*im) * r;
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
{$else}
|
||||
asm
|
||||
mov edx, [eax + FTx]
|
||||
// AV: for Apo7X.15C compatibility
|
||||
fld qword ptr [eax + vvar]
|
||||
fmul qword ptr [edx + 32] // FTz
|
||||
fadd qword ptr [edx + 40] // FPz
|
||||
fstp qword ptr [edx + 40]
|
||||
// main code
|
||||
fld qword ptr [edx + 8] // FTy
|
||||
fld qword ptr [edx] // FTx
|
||||
fld st(1)
|
||||
fld qword ptr [eax + c1]
|
||||
fmul st(1), st
|
||||
fmul st, st(2)
|
||||
fld1
|
||||
faddp
|
||||
|
||||
fld st(1)
|
||||
fmul st, st
|
||||
fld st(1)
|
||||
fmul st, st
|
||||
faddp
|
||||
fdivr qword ptr [eax + vvar]
|
||||
|
||||
fld st(3)
|
||||
fmul st, st(2)
|
||||
fld st(5)
|
||||
fmul st, st(4)
|
||||
faddp
|
||||
fmul st, st(1)
|
||||
fadd qword ptr [edx + 16] // FPx
|
||||
fstp qword ptr [edx + 16]
|
||||
|
||||
fxch st(4)
|
||||
fmulp
|
||||
fxch st(2)
|
||||
fmulp
|
||||
fsubp
|
||||
fmulp
|
||||
fadd qword ptr [edx + 24] // FPy
|
||||
fstp qword ptr [edx + 24]
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TVariationCurl.CalcZeroC1;
|
||||
{$ifndef _ASM_}
|
||||
var
|
||||
r: double;
|
||||
re, im: double;
|
||||
begin
|
||||
re := 1 + c2*(sqr(FTx^) - sqr(FTy^));
|
||||
im := c2x2*FTx^*FTy^;
|
||||
|
||||
r := vvar / (sqr(re) + sqr(im));
|
||||
|
||||
FPx^ := FPx^ + (FTx^*re + FTy^*im) * r;
|
||||
FPy^ := FPy^ + (FTy^*re - FTx^*im) * r;
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
{$else}
|
||||
asm
|
||||
mov edx, [eax + FTx]
|
||||
// AV: for Apo7X.15C compatibility
|
||||
fld qword ptr [eax + vvar]
|
||||
fmul qword ptr [edx + 32] // FTz
|
||||
fadd qword ptr [edx + 40] // FPz
|
||||
fstp qword ptr [edx + 40]
|
||||
// main code
|
||||
fld qword ptr [edx + 8] // FTy
|
||||
fld qword ptr [edx] // FTx
|
||||
fld st(1)
|
||||
fmul st, st(1)
|
||||
fmul qword ptr [eax + c2x2]
|
||||
fld st(2)
|
||||
fmul st, st
|
||||
fld st(2)
|
||||
fmul st, st
|
||||
fsubrp
|
||||
fmul qword ptr [eax + c2]
|
||||
fld1
|
||||
faddp
|
||||
|
||||
fld st(1)
|
||||
fmul st, st
|
||||
fld st(1)
|
||||
fmul st, st
|
||||
faddp
|
||||
fdivr qword ptr [eax + vvar]
|
||||
|
||||
fld st(3)
|
||||
fmul st, st(2)
|
||||
fld st(5)
|
||||
fmul st, st(4)
|
||||
faddp
|
||||
fmul st, st(1)
|
||||
fadd qword ptr [edx + 16] // FPx
|
||||
fstp qword ptr [edx + 16]
|
||||
|
||||
fxch st(4)
|
||||
fmulp
|
||||
fxch st(2)
|
||||
fmulp
|
||||
fsubp
|
||||
fmulp
|
||||
fadd qword ptr [edx + 24] // FPy
|
||||
fstp qword ptr [edx + 24]
|
||||
//fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TVariationCurl.CalcZeroC2C1; // AV: linear case
|
||||
{$ifndef _ASM_}
|
||||
var
|
||||
r: double;
|
||||
begin
|
||||
FPx^ := FPx^ + vvar * FTx^;
|
||||
FPy^ := FPy^ + vvar * FTy^;
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
{$else}
|
||||
asm
|
||||
fld qword ptr [eax + vvar]
|
||||
mov edx, [eax + FTx]
|
||||
fld qword ptr [edx] // FTx
|
||||
fmul st, st(1)
|
||||
fadd qword ptr [edx + 16] // FPx
|
||||
fstp qword ptr [edx + 16]
|
||||
|
||||
fld qword ptr [edx + 8] // FTy
|
||||
fmul st, st(1)
|
||||
fadd qword ptr [edx + 24] // FPy
|
||||
fstp qword ptr [edx + 24]
|
||||
|
||||
fmul qword ptr [edx + 32] // FTz
|
||||
fadd qword ptr [edx + 40] // FPz
|
||||
fstp qword ptr [edx + 40]
|
||||
//fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationCurl.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationCurl.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationCurl.GetName: string;
|
||||
begin
|
||||
Result := variation_name;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationCurl.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index of
|
||||
0: Result := var_c1_name;
|
||||
1: Result := var_c2_name;
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationCurl.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = var_c1_name then begin
|
||||
c1 := value;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = var_c2_name then begin
|
||||
c2 := value;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationCurl.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = var_c1_name then begin
|
||||
c1 := 0;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = var_c2_name then begin
|
||||
c2 := 0;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationCurl.GetNrVariables: integer;
|
||||
begin
|
||||
Result := num_vars;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationCurl.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = var_c1_name then begin
|
||||
value := c1;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = var_c2_name then begin
|
||||
value := c2;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationCurl), true, false);
|
||||
end.
|
||||
294
Variations/varCurl3D.pas
Normal file
294
Variations/varCurl3D.pas
Normal file
@ -0,0 +1,294 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varCurl3D;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
const
|
||||
variation_name = 'curl3D';
|
||||
num_vars = 3;
|
||||
var_cx_name = 'curl3D_cx';
|
||||
var_cy_name = 'curl3D_cy';
|
||||
var_cz_name = 'curl3D_cz';
|
||||
|
||||
type
|
||||
TVariationCurl3D = class(TBaseVariation)
|
||||
private
|
||||
cx, cy, cz: double;
|
||||
|
||||
cx2, cy2, cz2, c2,
|
||||
c2x, c2y, c2z: double;
|
||||
|
||||
procedure CalcCx;
|
||||
procedure CalcCy;
|
||||
procedure CalcCz;
|
||||
procedure CalcLinear;
|
||||
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
// TVariationCurl3D
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationCurl3D.Create;
|
||||
//var rnd: double;
|
||||
begin
|
||||
//rnd := 2*random - 1;
|
||||
|
||||
// which maniac made this??
|
||||
{case random(3) of
|
||||
0: cx := rnd;
|
||||
1: cy := rnd;
|
||||
2: cz := rnd;
|
||||
end;}
|
||||
cy := 0; cy := 0; cz := 0;
|
||||
end;
|
||||
|
||||
procedure TVariationCurl3D.Prepare;
|
||||
begin
|
||||
c2x := 2 * cx;
|
||||
c2y := 2 * cy;
|
||||
c2z := 2 * cz;
|
||||
|
||||
cx2 := sqr(cx);
|
||||
cy2 := sqr(cy);
|
||||
cz2 := sqr(cz);
|
||||
|
||||
c2 := cx2 + cy2 + cz2;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationCurl3D.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
{
|
||||
if IsZero(cx) and IsZero(cy) and IsZero(cz) then f := CalcLinear
|
||||
else
|
||||
if IsZero(cx) and IsZero(cy) then f := CalcCz
|
||||
else
|
||||
if IsZero(cy) and IsZero(cz) then f := CalcCx
|
||||
else
|
||||
if IsZero(cz) and IsZero(cx) then f := CalcCy
|
||||
else
|
||||
f := CalcFunction;
|
||||
}
|
||||
if IsZero(cx) then begin
|
||||
if IsZero(cy) then begin
|
||||
if IsZero(cz) then
|
||||
f := CalcLinear
|
||||
else
|
||||
f := CalcCz;
|
||||
end
|
||||
else begin
|
||||
if IsZero(cz) then
|
||||
f := CalcCy
|
||||
else
|
||||
f := CalcFunction;
|
||||
end
|
||||
end
|
||||
else begin
|
||||
if IsZero(cy) and IsZero(cz) then
|
||||
f := CalcCx
|
||||
else
|
||||
f := CalcFunction;
|
||||
end;
|
||||
|
||||
f := CalcFunction; // AV: always?
|
||||
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationCurl3D.CalcFunction;
|
||||
var
|
||||
r, r2: double;
|
||||
begin
|
||||
r2 := sqr(FTx^) + sqr(FTy^) + sqr(Ftz^);
|
||||
r := vvar / (r2*c2 + c2x*FTx^ - c2y*FTy^ + c2z*FTz^ + 1);
|
||||
|
||||
FPx^ := FPx^ + r * (FTx^ + cx*r2);
|
||||
FPy^ := FPy^ + r * (FTy^ - cy*r2);
|
||||
FPz^ := FPz^ + r * (FTz^ + cz*r2);
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationCurl3D.CalcCx;
|
||||
var
|
||||
x, r, r2: double;
|
||||
begin
|
||||
r2 := sqr(FTx^) + sqr(FTy^) + sqr(Ftz^);
|
||||
|
||||
r := vvar / (cx2*r2 + c2x*FTx^ + 1);
|
||||
|
||||
FPx^ := FPx^ + r * (FTx^ + cx*r2);
|
||||
FPy^ := FPy^ + r * FTy^;
|
||||
FPz^ := FPz^ + r * FTz^;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationCurl3D.CalcCy;
|
||||
var
|
||||
r, r2: double;
|
||||
begin
|
||||
r2 := sqr(FTx^) + sqr(FTy^) + sqr(Ftz^);
|
||||
|
||||
r := vvar / (cy2*r2 - c2y*FTy^ + 1);
|
||||
|
||||
FPx^ := FPx^ + r * FTx^;
|
||||
FPy^ := FPy^ + r * (FTy^ - cy*r2);
|
||||
FPz^ := FPz^ + r * FTz^;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationCurl3D.CalcCz;
|
||||
var
|
||||
r, r2: double;
|
||||
begin
|
||||
r2 := sqr(FTx^) + sqr(FTy^) + sqr(Ftz^);
|
||||
|
||||
r := vvar / (cz2*r2 + c2z*FTz^ + 1);
|
||||
|
||||
FPx^ := FPx^ + r * FTx^;
|
||||
FPy^ := FPy^ + r * FTy^;
|
||||
FPz^ := FPz^ + r * (FTz^ + cz*r2);
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationCurl3D.CalcLinear;
|
||||
var
|
||||
r: double;
|
||||
begin
|
||||
FPx^ := FPx^ + vvar * FTx^;
|
||||
FPy^ := FPy^ + vvar * FTy^;
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationCurl3D.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationCurl3D.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationCurl3D.GetName: string;
|
||||
begin
|
||||
Result := variation_name;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationCurl3D.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index of
|
||||
0: Result := var_cx_name;
|
||||
1: Result := var_cy_name;
|
||||
2: Result := var_cz_name;
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationCurl3D.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = var_cx_name then begin
|
||||
cx := value;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = var_cy_name then begin
|
||||
cy := value;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = var_cz_name then begin
|
||||
cz := value;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationCurl3D.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = var_cx_name then begin
|
||||
cx := 0;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = var_cy_name then begin
|
||||
cy := 0;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = var_cz_name then begin
|
||||
cz := 0;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationCurl3D.GetNrVariables: integer;
|
||||
begin
|
||||
Result := num_vars;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationCurl3D.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = var_cx_name then begin
|
||||
value := cx;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = var_cy_name then begin
|
||||
value := cy;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = var_cz_name then begin
|
||||
value := cz;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationCurl3D), true, false);
|
||||
end.
|
||||
256
Variations/varDCBubble.pas
Normal file
256
Variations/varDCBubble.pas
Normal file
@ -0,0 +1,256 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varDCBubble;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
{$ifndef Apo7X64}
|
||||
{$define _ASM_}
|
||||
{$endif}
|
||||
|
||||
type
|
||||
TVariationDCBubble = class(TBaseVariation)
|
||||
private
|
||||
centerx, centery, scale, bdcs, cden: double;
|
||||
style: byte;
|
||||
|
||||
procedure CalcBubble;
|
||||
procedure CalcNewStyle;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationDCBubble }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
procedure TVariationDCBubble.Prepare;
|
||||
begin
|
||||
if (scale = 0) then
|
||||
bdcs := 10E-6
|
||||
else
|
||||
bdcs := 1 / scale;
|
||||
cden := bdcs /(2 * pi);
|
||||
end;
|
||||
|
||||
procedure TVariationDCBubble.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
if style = 0 then
|
||||
f := CalcFunction
|
||||
else
|
||||
f := CalcNewStyle;
|
||||
end;
|
||||
|
||||
procedure TVariationDCBubble.CalcBubble;
|
||||
{$ifndef _ASM_}
|
||||
var
|
||||
r: double;
|
||||
begin
|
||||
r := (sqr(FTx^) + sqr(FTy^))/4 + 1;
|
||||
FPz^ := FPz^ + VVAR * (2 / r - 1); // AV: fixed inversion
|
||||
|
||||
r := VVAR / r;
|
||||
|
||||
FPx^ := FPx^ + r * FTx^;
|
||||
FPy^ := FPy^ + r * FTy^;
|
||||
{$else}
|
||||
asm // AV: added asm-code for speed
|
||||
mov edx, [eax + FTx]
|
||||
fld qword ptr [edx + 8]
|
||||
fld qword ptr [edx]
|
||||
fld st(1)
|
||||
fmul st, st
|
||||
fld st(1)
|
||||
fmul st, st
|
||||
faddp
|
||||
fld1
|
||||
fadd st, st
|
||||
fadd st, st
|
||||
fdivp st(1), st
|
||||
|
||||
fld qword ptr [eax + vvar]
|
||||
fld1
|
||||
fadd st(2), st
|
||||
fdivr st(2), st
|
||||
|
||||
fld st(2)
|
||||
fadd st, st
|
||||
fsubrp st(1), st
|
||||
fmul st, st(1)
|
||||
fadd qword ptr [edx + 40]
|
||||
fstp qword ptr [edx + 40]
|
||||
|
||||
fmulp
|
||||
|
||||
fmul st(2), st
|
||||
fmulp
|
||||
fadd qword ptr [edx + 16]
|
||||
fstp qword ptr [edx + 16]
|
||||
fadd qword ptr [edx + 24]
|
||||
fstp qword ptr [edx + 24]
|
||||
fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TVariationDCBubble.CalcFunction;
|
||||
begin
|
||||
CalcBubble;
|
||||
color^ := fmod(abs(bdcs * (sqr(FPx^ + centerx) + sqr(FPy^ + centery))), 1.0);
|
||||
end;
|
||||
|
||||
procedure TVariationDCBubble.CalcNewStyle;
|
||||
begin
|
||||
CalcBubble;
|
||||
color^ := fmod(abs(cden * arctan2(FPy^ + centery, FPx^ - centerx)), 1.0);
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationDCBubble.Create;
|
||||
begin
|
||||
centerx := 0;
|
||||
centery := 0;
|
||||
scale := 1.0;
|
||||
style := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationDCBubble.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationDCBubble.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationDCBubble.GetName: string;
|
||||
begin
|
||||
Result := 'dc_bubble';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationDCBubble.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'dc_bubble_centerx';
|
||||
1: Result := 'dc_bubble_centery';
|
||||
2: Result := 'dc_bubble_scale';
|
||||
3: Result := 'dc_bubble_style';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationDCBubble.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'dc_bubble_centerx' then begin
|
||||
centerx := Value;
|
||||
Result := True;
|
||||
end else if Name = 'dc_bubble_centery' then begin
|
||||
centery := Value;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = 'dc_bubble_scale' then begin
|
||||
scale := Value;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = 'dc_bubble_style' then begin
|
||||
if (Value < 0) then Value := 0;
|
||||
if (Value > 1) then Value := 1;
|
||||
style := Round(Value);
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
function TVariationDCBubble.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'dc_bubble_centerx' then begin
|
||||
centerx:= 0;
|
||||
Result := True;
|
||||
end else if Name = 'dc_bubble_centery' then begin
|
||||
centery := 0;
|
||||
Result := True;
|
||||
end else if Name = 'dc_bubble_scale' then begin
|
||||
scale := 1;
|
||||
Result := True;
|
||||
end else if Name = 'dc_bubble_style' then begin
|
||||
style := 0;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationDCBubble.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 4;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationDCBubble.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'dc_bubble_centerx' then begin
|
||||
Value := centerx;
|
||||
Result := True;
|
||||
end else if Name = 'dc_bubble_centery' then begin
|
||||
Value := centery;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = 'dc_bubble_scale' then begin
|
||||
Value := scale;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = 'dc_bubble_style' then begin
|
||||
Value := style;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationDCBubble), true, true);
|
||||
end.
|
||||
164
Variations/varDisc2.pas
Normal file
164
Variations/varDisc2.pas
Normal file
@ -0,0 +1,164 @@
|
||||
{ Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina }
|
||||
|
||||
unit varDisc2;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
{$ifdef Apo7X64}
|
||||
{$else}
|
||||
{$define _ASM_}
|
||||
{$endif}
|
||||
|
||||
type
|
||||
TVariationDisc2 = class(TBaseVariation)
|
||||
private
|
||||
rot, add, c, k, sinadd, cosadd: double;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationDisc2 }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationDisc2.Create;
|
||||
begin
|
||||
rot := random + 0.5;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationDisc2.Prepare;
|
||||
var t: double;
|
||||
begin
|
||||
c := vvar / PI;
|
||||
k := rot * PI;
|
||||
SinCos(add, sinadd, cosadd);
|
||||
cosadd := cosadd - 1;
|
||||
if (add > PI2) then begin
|
||||
t := 1 + add - PI2;
|
||||
cosadd := cosadd * t;
|
||||
sinadd := sinadd * t;
|
||||
end
|
||||
else if (add < -PI2) then begin
|
||||
t := 1 + add + PI2;
|
||||
cosadd := cosadd * t;
|
||||
sinadd := sinadd * t;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
procedure TVariationDisc2.CalcFunction;
|
||||
{$ifndef _ASM_}
|
||||
var
|
||||
r, sinr, cosr: extended;
|
||||
begin
|
||||
SinCos(k * (FTx^ + FTy^), sinr, cosr);
|
||||
r := c * arctan2(FTx^, FTy^);
|
||||
FPx^ := FPx^ + (sinr + cosadd) * r;
|
||||
FPy^ := FPy^ + (cosr + sinadd) * r;
|
||||
{$else}
|
||||
asm
|
||||
mov edx, [eax + FTx]
|
||||
fld qword ptr [edx]
|
||||
fld qword ptr [edx + 8]
|
||||
fpatan
|
||||
fmul qword ptr [eax + c]
|
||||
fld qword ptr [edx]
|
||||
fadd qword ptr [edx + 8]
|
||||
fmul qword ptr [eax + k]
|
||||
fsincos
|
||||
fadd qword ptr [eax + sinadd]
|
||||
fmul st, st(2)
|
||||
fadd qword ptr [edx + 24]
|
||||
fstp qword ptr [edx + 24]
|
||||
fadd qword ptr [eax + cosadd]
|
||||
fmulp
|
||||
fadd qword ptr [edx + 16]
|
||||
fstp qword ptr [edx + 16]
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationDisc2.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationDisc2.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationDisc2.GetName: string;
|
||||
begin
|
||||
Result := 'disc2';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationDisc2.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'disc2_rot';
|
||||
1: Result := 'disc2_twist';
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationDisc2.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'disc2_rot' then
|
||||
begin
|
||||
rot := Value;
|
||||
Result := True end
|
||||
else if Name = 'disc2_twist' then
|
||||
begin
|
||||
add := Value;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationDisc2.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 2;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationDisc2.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'disc2_rot' then
|
||||
begin
|
||||
Value := rot;
|
||||
Result := True end
|
||||
else if Name = 'disc2_twist' then
|
||||
begin
|
||||
Value := add;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationDisc2), false, false);
|
||||
end.
|
||||
132
Variations/varElliptic.pas
Normal file
132
Variations/varElliptic.pas
Normal file
@ -0,0 +1,132 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varElliptic;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationElliptic = class(TBaseVariation)
|
||||
private
|
||||
v: double;
|
||||
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
|
||||
|
||||
procedure CalcFunction; override;
|
||||
procedure Prepare; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationElliptic.Prepare;
|
||||
begin
|
||||
v := VVAR / (PI_2);
|
||||
end;
|
||||
|
||||
procedure TVariationElliptic.CalcFunction;
|
||||
function sqrt_safe(x: double): double;
|
||||
begin
|
||||
if x < 0.0 then Result := 0.0
|
||||
else Result := sqrt(x);
|
||||
end;
|
||||
var
|
||||
a, b, tmp, x2, xmax: double;
|
||||
begin
|
||||
tmp := sqr(FTy^) + sqr(FTx^) + 1.0;
|
||||
x2 := 2.0 * FTx^;
|
||||
xmax := 0.5 * (sqrt(tmp + x2) + sqrt(tmp - x2));
|
||||
|
||||
a := FTx^ / xmax;
|
||||
b := sqrt_safe(1.0 - sqr(a));
|
||||
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
FPx^ := FPx^ + v * ArcTan2(a, b);
|
||||
|
||||
if (FTy^ > 0) then FPy^ := FPy^ + v * Ln(xmax + sqrt_safe(xmax - 1.0))
|
||||
else FPy^ := FPy^ - v * Ln(xmax + sqrt_safe(xmax - 1.0))
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationElliptic.Create;
|
||||
begin
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationElliptic.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationElliptic.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationElliptic.GetName: string;
|
||||
begin
|
||||
Result := 'elliptic';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationElliptic.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
Result := '';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationElliptic.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationElliptic.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 0
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationElliptic.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationElliptic), true, false);
|
||||
end.
|
||||
202
Variations/varEpispiral.pas
Normal file
202
Variations/varEpispiral.pas
Normal file
@ -0,0 +1,202 @@
|
||||
{
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
}
|
||||
|
||||
unit varEpispiral;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
const
|
||||
EPS: double = 1E-6;
|
||||
type
|
||||
TVariationEpispiral = class(TBaseVariation)
|
||||
private
|
||||
n, thickness, holes : double;
|
||||
compatible : byte;
|
||||
procedure Calc7X;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure CalcFunction; override;
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override; // AV: for speed
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationEpispiral.Create;
|
||||
begin
|
||||
n := 6.0;
|
||||
thickness := 0.0;
|
||||
holes := 1.0;
|
||||
compatible := 1;
|
||||
end;
|
||||
|
||||
procedure TVariationEpispiral.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
if compatible = 1 then
|
||||
f := CalcFunction
|
||||
else
|
||||
f := Calc7X;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationEpispiral.CalcFunction;
|
||||
var
|
||||
t, theta, da: double;
|
||||
begin
|
||||
theta := arctan2(FTy^, FTx^);
|
||||
da := cos(n * theta);
|
||||
if (abs(da) < EPS) then da := EPS;
|
||||
da := 1/da;
|
||||
|
||||
// classic version
|
||||
if (abs(thickness) > EPS) then
|
||||
t := (random * thickness * da) - holes
|
||||
else
|
||||
t := da - holes;
|
||||
FPx^ := FPx^ + vvar * t * cos(theta);
|
||||
FPy^ := FPy^ + vvar * t * sin(theta);
|
||||
end;
|
||||
|
||||
procedure TVariationEpispiral.Calc7X;
|
||||
var
|
||||
t, theta, da: double;
|
||||
begin
|
||||
theta := arctan2(FTy^, FTx^);
|
||||
da := cos(n * theta);
|
||||
if (abs(da) < EPS) then da := EPS;
|
||||
da := 1/da;
|
||||
|
||||
// 7X.15D version
|
||||
t := (random * thickness * da) - holes;
|
||||
if (t = 0) then
|
||||
begin
|
||||
FPx^ := FPx^;
|
||||
FPy^ := FPy^;
|
||||
end
|
||||
else
|
||||
begin
|
||||
FPx^ := FPx^ + vvar * t * cos(theta);
|
||||
FPy^ := FPy^ + vvar * t * sin(theta);
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationEpispiral.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationEpispiral.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationEpispiral.GetName: string;
|
||||
begin
|
||||
Result := 'Epispiral';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationEpispiral.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'Epispiral_n';
|
||||
1: Result := 'Epispiral_thickness';
|
||||
2: Result := 'Epispiral_holes';
|
||||
3: Result := 'Epispiral_old';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationEpispiral.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'Epispiral_n' then begin
|
||||
n := Value;
|
||||
Result := True;
|
||||
end else if Name = 'Epispiral_thickness' then begin
|
||||
thickness := Value;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = 'Epispiral_holes' then begin
|
||||
holes := Value;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = 'Epispiral_old' then begin
|
||||
if (Value > 1) then Value := 1;
|
||||
if (Value < 0) then Value := 0;
|
||||
compatible := Round(Value);
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
function TVariationEpispiral.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'Epispiral_n' then begin
|
||||
n := 6.0;
|
||||
Result := True;
|
||||
end else if Name = 'Epispiral_thickness' then begin
|
||||
thickness := 0.0;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = 'Epispiral_holes' then begin
|
||||
holes := 0.0;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = 'Epispiral_old' then begin
|
||||
compatible := 1;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationEpispiral.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 4;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationEpispiral.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'Epispiral_n' then begin
|
||||
Value := n;
|
||||
Result := True;
|
||||
end else if Name = 'Epispiral_thickness' then begin
|
||||
Value := thickness;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = 'Epispiral_holes' then begin
|
||||
Value := holes;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = 'Epispiral_old' then begin
|
||||
Value := compatible;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationEpispiral), false, false);
|
||||
end.
|
||||
|
||||
147
Variations/varEscher.pas
Normal file
147
Variations/varEscher.pas
Normal file
@ -0,0 +1,147 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varEscher;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationEscher = class(TBaseVariation)
|
||||
private
|
||||
escher_beta, bc, bd: double;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationEscher.Prepare;
|
||||
begin
|
||||
sincos(escher_beta, bd, bc);
|
||||
bc := 0.5 * (1.0 + bc);
|
||||
bd := 0.5 * bd;
|
||||
end;
|
||||
|
||||
procedure TVariationEscher.CalcFunction;
|
||||
var sn, cs, ang, lnr, m : double;
|
||||
begin
|
||||
ang := arctan2(FTy^, FTx^); // Angular polar dimension
|
||||
lnr := 0.5 * ln(FTx^*FTx^ + FTy^*FTy^); // Natural logarithm of the radial polar dimension.
|
||||
|
||||
m := VVAR * exp(bc * lnr - bd * ang);
|
||||
|
||||
sincos(bc * ang + bd * lnr, sn, cs);
|
||||
|
||||
FPx^ := FPx^ + m * cs;
|
||||
FPy^ := FPy^ + m * sn;
|
||||
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationEscher.Create;
|
||||
begin
|
||||
escher_beta := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationEscher.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationEscher.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationEscher.GetName: string;
|
||||
begin
|
||||
Result := 'escher';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationEscher.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'escher_beta';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationEscher.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'escher_beta' then begin
|
||||
value := frac((value + PI) / PI2) * PI2 - PI; // AV: added 2*pi precalc
|
||||
escher_beta := Value;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
function TVariationEscher.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'escher_beta' then begin
|
||||
escher_beta := 0;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationEscher.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 1
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationEscher.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'escher_beta' then begin
|
||||
Value := escher_beta;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationEscher), true, false);
|
||||
end.
|
||||
141
Variations/varEx.pas
Normal file
141
Variations/varEx.pas
Normal file
@ -0,0 +1,141 @@
|
||||
{ Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina }
|
||||
|
||||
unit varEx;
|
||||
|
||||
interface
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationEx = class(TBaseVariation)
|
||||
private
|
||||
old: byte;
|
||||
procedure CalcPlugin;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure CalcFunction; override;
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
////////////////////////
|
||||
procedure TVariationEx.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
if old = 1 then f := CalcFunction
|
||||
else f := CalcPlugin;
|
||||
end;
|
||||
|
||||
procedure TVariationEx.CalcFunction;
|
||||
var
|
||||
r: double;
|
||||
n0, n1, m0, m1: double;
|
||||
FAngle: double;
|
||||
begin
|
||||
FAngle := arctan2(FTx^, FTy^);
|
||||
r := sqrt(sqr(FTx^) + sqr(FTy^));
|
||||
n0 := sin(FAngle + r);
|
||||
n1 := cos(FAngle - r);
|
||||
m0 := sqr(n0) * n0;
|
||||
m1 := sqr(n1) * n1;
|
||||
r := r * vvar;
|
||||
FPx^ := FPx^ + r * (m0 + m1);
|
||||
FPy^ := FPy^ + r * (m0 - m1);
|
||||
end;
|
||||
|
||||
procedure TVariationEx.CalcPlugin;
|
||||
var
|
||||
r: double;
|
||||
n0, n1, m0, m1: double;
|
||||
FAngle: double;
|
||||
begin
|
||||
FAngle := arctan2(FTy^, FTx^);
|
||||
r := sqrt(sqr(FTx^) + sqr(FTy^));
|
||||
n0 := sin(FAngle + r);
|
||||
n1 := cos(FAngle - r);
|
||||
m0 := sqr(n0) * n0;
|
||||
m1 := sqr(n1) * n1;
|
||||
r := r * vvar;
|
||||
FPx^ := FPx^ + r * (m0 + m1);
|
||||
FPy^ := FPy^ + r * (m0 - m1);
|
||||
end;
|
||||
|
||||
constructor TVariationEx.Create;
|
||||
begin
|
||||
old := 1;
|
||||
end;
|
||||
|
||||
class function TVariationEx.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationEx.Create;
|
||||
end;
|
||||
|
||||
class function TVariationEx.GetName: string;
|
||||
begin
|
||||
Result := 'ex';
|
||||
end;
|
||||
|
||||
function TVariationEx.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 1;
|
||||
end;
|
||||
|
||||
function TVariationEx.GetVariable(const Name: string;
|
||||
var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'ex_old' then begin
|
||||
value := old;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationEx.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index of
|
||||
0: Result := 'ex_old';
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationEx.SetVariable(const Name: string;
|
||||
var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'ex_old' then begin
|
||||
if Value < 0 then Value := 0;
|
||||
if Value > 1 then Value := 1;
|
||||
old := Round(value);
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationEx.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'ex_old' then begin
|
||||
old := 1;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
//////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationEx), false, false);
|
||||
|
||||
end.
|
||||
98
Variations/varExponential.pas
Normal file
98
Variations/varExponential.pas
Normal file
@ -0,0 +1,98 @@
|
||||
{ Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina }
|
||||
|
||||
unit varExponential;
|
||||
|
||||
interface
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
{$ifdef Apo7X64}
|
||||
{$else}
|
||||
{$define _ASM_}
|
||||
{$endif}
|
||||
|
||||
type
|
||||
TVariationExponential = class(TBaseVariation)
|
||||
private
|
||||
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
////////////////////////
|
||||
|
||||
procedure TVariationExponential.CalcFunction;
|
||||
{$ifndef _ASM_}
|
||||
var
|
||||
vex: double;
|
||||
siny, cosy: double;
|
||||
begin
|
||||
SinCos(PI * FTy^, siny, cosy);
|
||||
vex := vvar * exp(FTx^ - 1);
|
||||
FPx^ := FPx^ + cosy * vex;
|
||||
FPy^ := FPy^ + siny * vex;
|
||||
{$else}
|
||||
asm
|
||||
mov edx, [eax + FTx]
|
||||
fld qword ptr [edx]
|
||||
fld1
|
||||
fsubp st(1), st
|
||||
// here goes exp(x) code from System.pas
|
||||
FLDL2E
|
||||
FMUL
|
||||
FLD ST(0)
|
||||
FRNDINT
|
||||
FSUB ST(1), ST
|
||||
FXCH ST(1)
|
||||
F2XM1
|
||||
FLD1
|
||||
FADD
|
||||
FSCALE
|
||||
FSTP ST(1)
|
||||
// -----
|
||||
fmul qword ptr [eax + vvar]
|
||||
fld qword ptr [edx + 8]
|
||||
fldpi
|
||||
fmulp
|
||||
fsincos
|
||||
fmul st, st(2)
|
||||
fadd qword ptr [edx + 16]
|
||||
fstp qword ptr [edx + 16]
|
||||
fmulp
|
||||
fadd qword ptr [edx + 24]
|
||||
fstp qword ptr [edx + 24]
|
||||
fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
constructor TVariationExponential.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
end;
|
||||
|
||||
class function TVariationExponential.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationExponential.Create;
|
||||
end;
|
||||
|
||||
class function TVariationExponential.GetName: string;
|
||||
begin
|
||||
Result := 'exponential';
|
||||
end;
|
||||
|
||||
//////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationExponential), false, false);
|
||||
|
||||
end.
|
||||
348
Variations/varFalloff2.pas
Normal file
348
Variations/varFalloff2.pas
Normal file
@ -0,0 +1,348 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varFalloff2;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationFalloff2 = class(TBaseVariation)
|
||||
const
|
||||
n_scatter : string = 'falloff2_scatter';
|
||||
n_mindist : string = 'falloff2_mindist';
|
||||
n_mul_x : string = 'falloff2_mul_x';
|
||||
n_mul_y : string = 'falloff2_mul_y';
|
||||
n_mul_z : string = 'falloff2_mul_z';
|
||||
n_mul_c : string = 'falloff2_mul_c';
|
||||
n_x0 : string = 'falloff2_x0';
|
||||
n_y0 : string = 'falloff2_y0';
|
||||
n_z0 : string = 'falloff2_z0';
|
||||
n_invert : string = 'falloff2_invert';
|
||||
n_blurtype : string = 'falloff2_type';
|
||||
|
||||
private
|
||||
rmax: double;
|
||||
x0, y0, z0: double;
|
||||
scatter, mindist: double;
|
||||
invert, blurtype: integer;
|
||||
mul_x, mul_y, mul_z, mul_c: double;
|
||||
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
procedure CalcFunctionRadial;
|
||||
procedure CalcFunctionGaussian;
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationFalloff2.Prepare;
|
||||
begin
|
||||
rmax := 0.04 * scatter;
|
||||
end;
|
||||
|
||||
procedure TVariationFalloff2.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
if blurtype = 1 then f := CalcFunctionRadial
|
||||
else if blurtype = 2 then f := CalcFunctionGaussian
|
||||
else f := CalcFunction;
|
||||
end;
|
||||
procedure TVariationFalloff2.CalcFunction;
|
||||
var
|
||||
in_x, in_y, in_z, d: double;
|
||||
begin
|
||||
in_x := FTx^;
|
||||
in_y := FTy^;
|
||||
in_z := FTz^;
|
||||
|
||||
d := sqrt(sqr(in_x - x0) + sqr(in_y - y0) + sqr(in_z - z0));
|
||||
if (invert <> 0) then d := 1 - d; if (d < 0) then d := 0;
|
||||
d := (d - mindist) * rmax; if (d < 0) then d := 0;
|
||||
|
||||
FPx^ := FPx^ + VVAR * (in_x + mul_x * random * d);
|
||||
FPy^ := FPy^ + VVAR * (in_y + mul_y * random * d);
|
||||
FPz^ := FPz^ + VVAR * (in_z + mul_z * random * d);
|
||||
color^ := Abs(Frac(color^ + mul_c * random * d));
|
||||
end;
|
||||
procedure TVariationFalloff2.CalcFunctionRadial;
|
||||
var
|
||||
in_x, in_y, in_z, d, r_in: double;
|
||||
sigma, phi, r, sins, coss, sinp, cosp: double;
|
||||
begin
|
||||
in_x := FTx^;
|
||||
in_y := FTy^;
|
||||
in_z := FTz^;
|
||||
|
||||
r_in := sqrt(sqr(in_x) + sqr(in_y) + sqr(in_z)) + 1e-6;
|
||||
d := sqrt(sqr(in_x - x0) + sqr(in_y - y0) + sqr(in_z - z0));
|
||||
if (invert <> 0) then d := 1 - d; if (d < 0) then d := 0;
|
||||
d := (d - mindist) * rmax; if (d < 0) then d := 0;
|
||||
|
||||
sigma := ArcSin(in_z / r_in) + mul_z * random * d;
|
||||
phi := ArcTan2(in_y, in_x) + mul_y * random * d;
|
||||
r := r_in + mul_x * random * d;
|
||||
|
||||
SinCos(sigma, sins, coss);
|
||||
SinCos(phi, sinp, cosp);
|
||||
|
||||
FPx^ := FPx^ + VVAR * (r * coss * cosp);
|
||||
FPy^ := FPy^ + VVAR * (r * coss * sinp);
|
||||
FPz^ := FPz^ + VVAR * (sins);
|
||||
color^ := Abs(Frac(color^ + mul_c * random * d));
|
||||
end;
|
||||
procedure TVariationFalloff2.CalcFunctionGaussian;
|
||||
var
|
||||
in_x, in_y, in_z, d: double;
|
||||
sigma, phi, r, sins, coss, sinp, cosp: double;
|
||||
begin
|
||||
in_x := FTx^;
|
||||
in_y := FTy^;
|
||||
in_z := FTz^;
|
||||
|
||||
d := sqrt(sqr(in_x - x0) + sqr(in_y - y0) + sqr(in_z - z0));
|
||||
if (invert <> 0) then d := 1 - d; if (d < 0) then d := 0;
|
||||
d := (d - mindist) * rmax; if (d < 0) then d := 0;
|
||||
|
||||
sigma := d * random * 2 * PI;
|
||||
phi := d * random * PI;
|
||||
r := d * random;
|
||||
|
||||
SinCos(sigma, sins, coss);
|
||||
SinCos(phi, sinp, cosp);
|
||||
|
||||
FPx^ := FPx^ + VVAR * (in_x + mul_x * r * coss * cosp);
|
||||
FPy^ := FPy^ + VVAR * (in_y + mul_y * r * coss * sinp);
|
||||
FPz^ := FPz^ + VVAR * (in_z + mul_z * r * sins);
|
||||
color^ := Abs(Frac(color^ + mul_c * random * d));
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationFalloff2.Create;
|
||||
begin
|
||||
scatter := 1;
|
||||
mindist := 0.5;
|
||||
mul_x := 1;
|
||||
mul_y := 1;
|
||||
mul_z := 0;
|
||||
mul_c := 0;
|
||||
x0 := 0;
|
||||
y0 := 0;
|
||||
z0 := 0;
|
||||
invert := 0;
|
||||
blurtype := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationFalloff2.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationFalloff2.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationFalloff2.GetName: string;
|
||||
begin
|
||||
Result := 'falloff2';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationFalloff2.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := n_scatter;
|
||||
1: Result := n_mindist;
|
||||
2: Result := n_mul_x;
|
||||
3: Result := n_mul_y;
|
||||
4: Result := n_mul_z;
|
||||
5: Result := n_mul_c;
|
||||
6: Result := n_x0;
|
||||
7: Result := n_y0;
|
||||
8: Result := n_z0;
|
||||
9: Result := n_invert;
|
||||
10: Result := n_blurtype;
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationFalloff2.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = n_scatter then begin
|
||||
if Value < 1e-6 then Value := 1e-6;
|
||||
scatter := Value;
|
||||
Result := True;
|
||||
end else if Name = n_mindist then begin
|
||||
if Value < 0 then Value := 0;
|
||||
mindist := Value;
|
||||
Result := True;
|
||||
end else if Name = n_mul_x then begin
|
||||
if Value < 0 then Value := 0
|
||||
else if Value > 1 then Value := 1;
|
||||
mul_x := Value;
|
||||
Result := True;
|
||||
end else if Name = n_mul_y then begin
|
||||
if Value < 0 then Value := 0
|
||||
else if Value > 1 then Value := 1;
|
||||
mul_y := Value;
|
||||
Result := True;
|
||||
end else if Name = n_mul_z then begin
|
||||
if Value < 0 then Value := 0
|
||||
else if Value > 1 then Value := 1;
|
||||
mul_z := Value;
|
||||
Result := True;
|
||||
end else if Name = n_mul_c then begin
|
||||
if Value < 0 then Value := 0
|
||||
else if Value > 1 then Value := 1;
|
||||
mul_c := Value;
|
||||
Result := True;
|
||||
end else if Name = n_x0 then begin
|
||||
x0 := Value;
|
||||
Result := True;
|
||||
end else if Name = n_y0 then begin
|
||||
y0 := Value;
|
||||
Result := True;
|
||||
end else if Name = n_z0 then begin
|
||||
z0 := Value;
|
||||
Result := True;
|
||||
end else if Name = n_invert then begin
|
||||
if (Value > 1) then Value := 1;
|
||||
if (Value < 0) then Value := 0;
|
||||
invert := Round(Value);
|
||||
Result := True;
|
||||
end else if Name = n_blurtype then begin
|
||||
if (Value > 2) then Value := 2;
|
||||
if (Value < 0) then Value := 0;
|
||||
blurtype := Round(Value);
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
function TVariationFalloff2.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = n_scatter then begin
|
||||
scatter := 1;
|
||||
Result := True;
|
||||
end else if Name = n_mindist then begin
|
||||
mindist := 0.5;
|
||||
Result := True;
|
||||
end else if Name = n_mul_x then begin
|
||||
mul_x := 1;
|
||||
Result := True;
|
||||
end else if Name = n_mul_y then begin
|
||||
mul_y := 1;
|
||||
Result := True;
|
||||
end else if Name = n_mul_z then begin
|
||||
mul_z := 0;
|
||||
Result := True;
|
||||
end else if Name = n_mul_c then begin
|
||||
mul_c := 0;
|
||||
Result := True;
|
||||
end else if Name = n_x0 then begin
|
||||
x0 := 0;
|
||||
Result := True;
|
||||
end else if Name = n_y0 then begin
|
||||
y0 := 0;
|
||||
Result := True;
|
||||
end else if Name = n_z0 then begin
|
||||
z0 := 0;
|
||||
Result := True;
|
||||
end else if Name = n_invert then begin
|
||||
invert := 0;
|
||||
Result := True;
|
||||
end else if Name = n_blurtype then begin
|
||||
blurtype := 0;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationFalloff2.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 11
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationFalloff2.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = n_scatter then begin
|
||||
Value := scatter;
|
||||
Result := True;
|
||||
end else if Name = n_mindist then begin
|
||||
Value := mindist;
|
||||
Result := True;
|
||||
end else if Name = n_mul_x then begin
|
||||
Value := mul_x;
|
||||
Result := True;
|
||||
end else if Name = n_mul_y then begin
|
||||
Value := mul_y;
|
||||
Result := True;
|
||||
end else if Name = n_mul_z then begin
|
||||
Value := mul_z;
|
||||
Result := True;
|
||||
end else if Name = n_mul_c then begin
|
||||
Value := mul_c;
|
||||
Result := True;
|
||||
end else if Name = n_x0 then begin
|
||||
Value := x0;
|
||||
Result := True;
|
||||
end else if Name = n_y0 then begin
|
||||
Value := y0;
|
||||
Result := True;
|
||||
end else if Name = n_z0 then begin
|
||||
Value := z0;
|
||||
Result := True;
|
||||
end else if Name = n_invert then begin
|
||||
Value := invert;
|
||||
Result := True;
|
||||
end else if Name = n_blurtype then begin
|
||||
Value := blurtype;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationFalloff2), true, true);
|
||||
end.
|
||||
206
Variations/varFan2.pas
Normal file
206
Variations/varFan2.pas
Normal file
@ -0,0 +1,206 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varFan2;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationFan2 = class(TBaseVariation)
|
||||
private
|
||||
FX, FY: double;
|
||||
dy, dx, dx2: double;
|
||||
old: byte;
|
||||
procedure CalcNew;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationFan2 }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationFan2.Prepare;
|
||||
const
|
||||
EPS = 1E-10;
|
||||
begin
|
||||
dy := FY;
|
||||
dx := pi * (sqr(FX) + EPS);
|
||||
dx2 := dx/2;
|
||||
end;
|
||||
|
||||
procedure TVariationFan2.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
if old = 1 then f := CalcFunction
|
||||
else f := CalcNew;
|
||||
end;
|
||||
|
||||
procedure TVariationFan2.CalcFunction;
|
||||
var
|
||||
r, a : double;
|
||||
sinr, cosr: double;
|
||||
Angle: double;
|
||||
begin
|
||||
Angle := arctan2(FTx^, FTy^);
|
||||
if System.Frac((Angle + dy)/dx) > 0.5 then
|
||||
a := Angle - dx2
|
||||
else
|
||||
a := Angle + dx2;
|
||||
SinCos(a, sinr, cosr);
|
||||
r := vvar * sqrt(sqr(FTx^) + sqr(FTy^));
|
||||
FPx^ := FPx^ + r * sinr;
|
||||
FPy^ := FPy^ + r * cosr;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationFan2.CalcNew;
|
||||
var
|
||||
r, a : double;
|
||||
sinr, cosr: double;
|
||||
Angle: double;
|
||||
begin
|
||||
Angle := arctan2(FTx^, FTy^);
|
||||
if System.Frac((Angle + dy)/dx) > 0.5 then
|
||||
a := Angle - dx2
|
||||
else
|
||||
a := Angle + dx2;
|
||||
SinCos(a, sinr, cosr);
|
||||
r := vvar * sqrt(sqr(FTx^) + sqr(FTy^));
|
||||
FPx^ := FPx^ + r * cosr;
|
||||
FPy^ := FPy^ + r * sinr;
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
end;
|
||||
|
||||
constructor TVariationFan2.Create;
|
||||
begin
|
||||
FX := 2 * Random - 1;
|
||||
FY := 2 * Random - 1;
|
||||
old := 1;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class function TVariationFan2.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationFan2.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationFan2.GetName: string;
|
||||
begin
|
||||
Result := 'fan2';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationFan2.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'fan2_x';
|
||||
1: Result := 'fan2_y';
|
||||
2: Result := 'fan2_old';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationFan2.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'fan2_x' then begin
|
||||
FX := Value;
|
||||
Result := True;
|
||||
end else if Name = 'fan2_y' then begin
|
||||
FY := Value;
|
||||
Result := True;
|
||||
end else if Name = 'fan2_old' then begin
|
||||
if (Value < 0) then Value := 0;
|
||||
if (Value > 1) then Value := 1;
|
||||
old := Round(Value);
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
function TVariationFan2.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'fan2_x' then begin
|
||||
FX := 0;
|
||||
Result := True;
|
||||
end else if Name = 'fan2_y' then begin
|
||||
FY := 0;
|
||||
Result := True;
|
||||
end else if Name = 'fan2_old' then begin
|
||||
old := 1;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationFan2.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 3
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationFan2.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'fan2_x' then begin
|
||||
Value := FX;
|
||||
Result := True;
|
||||
end else if Name = 'fan2_y' then begin
|
||||
Value := FY;
|
||||
Result := True;
|
||||
end else if Name = 'fan2_old' then begin
|
||||
Value := old;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationFan2), true, false);
|
||||
end.
|
||||
148
Variations/varFlux.pas
Normal file
148
Variations/varFlux.pas
Normal file
@ -0,0 +1,148 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varFlux;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationFlux = class(TBaseVariation)
|
||||
private
|
||||
spread, spr: double;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationFlux.Prepare;
|
||||
begin
|
||||
spr := 2 + spread;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////
|
||||
procedure TVariationFlux.CalcFunction;
|
||||
var
|
||||
avgr, avga, xmv, xpv, frc,
|
||||
x, y, y2, s, c: double;
|
||||
|
||||
begin
|
||||
// Avoid reduant calculations by precalculating everything what is used at least twice
|
||||
x := FTx^;
|
||||
xpv := x + VVAR;
|
||||
xmv := x - VVAR;
|
||||
y := FTy^;
|
||||
y2 := sqr(y);
|
||||
|
||||
// We have a division by zero problem in the original flux
|
||||
// (What if y + (x-vvar) == 0 ????)
|
||||
frc := sqrt(y2 + sqr(xmv));
|
||||
if (frc = 0) then frc := 1.0;
|
||||
|
||||
avgr := VVAR * (spr * sqrt(sqrt(y2 + sqr(xpv) ) / frc));
|
||||
avga := (arctan2(y, xmv) - arctan2(y, xpv)) / 2.0;
|
||||
SinCos(avga, s, c);
|
||||
|
||||
FPx^ := FPx^ + avgr * c;
|
||||
FPy^ := FPy^ + avgr * s;
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationFlux.Create;
|
||||
begin
|
||||
spread := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationFlux.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationFlux.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationFlux.GetName: string;
|
||||
begin
|
||||
Result := 'flux';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationFlux.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'flux_spread';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationFlux.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'flux_spread' then begin
|
||||
spread := Value;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationFlux.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 1
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationFlux.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'flux_spread' then begin
|
||||
Value := spread;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationFlux), true, false);
|
||||
end.
|
||||
118
Variations/varFoci.pas
Normal file
118
Variations/varFoci.pas
Normal file
@ -0,0 +1,118 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varFoci;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationFoci = class(TBaseVariation)
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
|
||||
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationFoci.CalcFunction;
|
||||
var
|
||||
expx, expnx, siny, cosy, tmp: double;
|
||||
begin
|
||||
expx := exp(FTx^) * 0.5;
|
||||
expnx := 0.25 / expx;
|
||||
sincos(FTy^, siny, cosy);
|
||||
|
||||
tmp := ( expx + expnx - cosy );
|
||||
if (tmp = 0) then tmp := 1e-6;
|
||||
tmp := VVAR / tmp;
|
||||
|
||||
FPx^ := FPx^ + (expx - expnx) * tmp;
|
||||
FPy^ := FPy^ + siny * tmp;
|
||||
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationFoci.Create;
|
||||
begin
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationFoci.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationFoci.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationFoci.GetName: string;
|
||||
begin
|
||||
Result := 'foci';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationFoci.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
Result := '';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationFoci.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationFoci.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 0
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationFoci.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationFoci), true, false);
|
||||
end.
|
||||
359
Variations/varGenericPlugin.pas
Normal file
359
Variations/varGenericPlugin.pas
Normal file
@ -0,0 +1,359 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
{
|
||||
Variation Plugin DLL support for Apophysis:
|
||||
Generic Plugin Support Unit
|
||||
Started by Jed Kelsey, June 2007
|
||||
|
||||
|
||||
Portions Copyright (C) 2008 Joel Faber
|
||||
|
||||
February 2008:
|
||||
- Remove 30 plugin limit
|
||||
- Reset variables
|
||||
}
|
||||
|
||||
unit varGenericPlugin;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan, Settings, // Translation,
|
||||
Classes, //TStrings/TStringList
|
||||
SysUtils, //FindFirst/FindNext/FindClose
|
||||
Forms; //MessageBox
|
||||
|
||||
type
|
||||
TPluginVariationClass = class of TPluginVariation;
|
||||
|
||||
TPluginData = record
|
||||
Instance: Integer;
|
||||
PluginHandle: THandle;
|
||||
PluginClass: TPluginVariationClass;
|
||||
|
||||
PluginVarGetName: function: PAnsiChar; cdecl;
|
||||
PluginVarGetNrVariables: function: Integer; cdecl;
|
||||
PluginVarGetVariableNameAt: function(const Index: integer): PAnsiChar; cdecl;
|
||||
|
||||
PluginVarCreate: function: Pointer; cdecl;
|
||||
PluginVarDestroy: function(var MyVariation: Pointer): LongBool; cdecl;
|
||||
PluginVarInit: function(MyVariation, FPx, FPy, FTx, FTy: Pointer; vvar: double): LongBool; cdecl;
|
||||
PluginVarInit3D: function(MyVariation, FPx, FPy, FPz, FTx, FTy, FTz: Pointer; vvar: double): LongBool; cdecl;
|
||||
PluginVarInitDC: function(MyVariation, FPx, FPy, FPz, FTx, FTy, FTz, color: Pointer; vvar, a, b, c, d, e, f: double): LongBool; cdecl;
|
||||
PluginVarPrepare: function(MyVariation: Pointer): LongBool; cdecl;
|
||||
PluginVarCalc: function(MyVariation: Pointer): LongBool; cdecl;
|
||||
PluginVarGetVariable: function(MyVariation: Pointer; const Name: PAnsiChar; var value: double): LongBool; cdecl;
|
||||
PluginVarSetVariable: function(MyVariation: Pointer; const Name: PAnsiChar; var value: double): LongBool; cdecl;
|
||||
PluginVarResetVariable:function(MyVariation: Pointer; const Name: PAnsiChar) : LongBool; cdecl;
|
||||
end;
|
||||
PPluginData = ^TPluginData;
|
||||
|
||||
// This class serves as a proxy for the plugin variations.
|
||||
TPluginVariation = class(TBaseVariation)
|
||||
|
||||
private
|
||||
PluginData : TPluginData;
|
||||
MyVariation : Pointer;
|
||||
public
|
||||
constructor Create(varData : TPluginData);
|
||||
destructor Destroy; override;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
type
|
||||
TVariationPluginLoader = class (TVariationLoader)
|
||||
public
|
||||
constructor Create(varData : TPluginData);
|
||||
destructor Destroy; override;
|
||||
|
||||
function GetName: string; override;
|
||||
function GetInstance: TBaseVariation; override;
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
private
|
||||
PluginData : TPluginData;
|
||||
end;
|
||||
|
||||
procedure InitializePlugins;
|
||||
|
||||
const CurrentPlatform =
|
||||
{$ifdef Apo7X64}
|
||||
$00000040
|
||||
{$else}
|
||||
$00000020
|
||||
{$endif};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Windows, //LoadLibrary
|
||||
Global;
|
||||
|
||||
{ TPluginVariation }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
constructor TVariationPluginLoader.Create(varData : TPluginData);
|
||||
begin
|
||||
PluginData := varData;
|
||||
end;
|
||||
|
||||
destructor TVariationPluginLoader.Destroy;
|
||||
begin
|
||||
FreeLibrary(PluginData.PluginHandle);
|
||||
end;
|
||||
|
||||
function TVariationPluginLoader.GetName : string;
|
||||
begin
|
||||
Result := String(PluginData.PluginVarGetName);
|
||||
end;
|
||||
|
||||
function TVariationPluginLoader.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TPluginVariation.Create(PluginData);
|
||||
end;
|
||||
|
||||
function TVariationPluginLoader.GetNrVariables: integer;
|
||||
begin
|
||||
Result := PluginData.PluginVarGetNrVariables;
|
||||
end;
|
||||
|
||||
function TVariationPluginLoader.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
Result := String(PluginData.PluginVarGetVariableNameAt(Index));
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
procedure TPluginVariation.Prepare;
|
||||
begin
|
||||
with PluginData do begin
|
||||
if @PluginVarInitDC <> nil then
|
||||
PluginVarInitDC(MyVariation, Pointer(FPX), Pointer(FPy), Pointer(FPz), Pointer(FTx), Pointer(FTy), Pointer(FTz), Pointer(color), vvar, a, b, c, d, e, f)
|
||||
else if @PluginVarInit3D <> nil then
|
||||
PluginVarInit3D(MyVariation, Pointer(FPX), Pointer(FPy), Pointer(FPz), Pointer(FTx), Pointer(FTy), Pointer(FTz), vvar)
|
||||
else
|
||||
PluginVarInit(MyVariation, Pointer(FPX), Pointer(FPy), Pointer(FTx), Pointer(FTy), vvar);
|
||||
PluginVarPrepare(MyVariation);
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TPluginVariation.CalcFunction;
|
||||
begin
|
||||
PluginData.PluginVarCalc(MyVariation);
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TPluginVariation.Create(varData : TPluginData);
|
||||
begin
|
||||
PluginData := varData;
|
||||
MyVariation := PluginData.PluginVarCreate;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
destructor TPluginVariation.Destroy;
|
||||
begin
|
||||
PluginData.PluginVarDestroy(MyVariation);
|
||||
inherited;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TPluginVariation.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TPluginVariation.GetName: string;
|
||||
begin
|
||||
Result := '';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TPluginVariation.GetNrVariables: integer;
|
||||
begin
|
||||
Result := PluginData.PluginVarGetNrVariables;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TPluginVariation.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
Result := String(PluginData.PluginVarGetVariableNameAt(Index));
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TPluginVariation.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := PluginData.PluginVarSetVariable(MyVariation,PAnsiChar(AnsiString(Name)),value);
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TPluginVariation.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := PluginData.PluginVarGetVariable(MyVariation,PAnsiChar(AnsiString(Name)),value);
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TPluginVariation.ResetVariable(const Name: string) : boolean;
|
||||
var
|
||||
dummy: double;
|
||||
begin
|
||||
if @PluginData.PluginVarResetVariable <> nil then
|
||||
Result := PluginData.PluginVarResetVariable(MyVariation, PAnsiChar(AnsiString(Name)))
|
||||
else begin
|
||||
dummy := 0;
|
||||
Result := PluginData.PluginVarSetVariable(MyVariation,PAnsiChar(AnsiString(Name)), dummy);
|
||||
end;
|
||||
end;
|
||||
|
||||
function GetPlatformOf(dllPath: string): integer;
|
||||
var
|
||||
fs: TFilestream;
|
||||
signature: DWORD;
|
||||
dos_header: IMAGE_DOS_HEADER;
|
||||
pe_header: IMAGE_FILE_HEADER;
|
||||
opt_header: IMAGE_OPTIONAL_HEADER;
|
||||
begin
|
||||
fs := TFilestream.Create(dllPath, fmOpenread or fmShareDenyNone);
|
||||
try
|
||||
fs.read(dos_header, SizeOf(dos_header));
|
||||
if dos_header.e_magic <> IMAGE_DOS_SIGNATURE then
|
||||
begin
|
||||
Result := 0;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
fs.seek(dos_header._lfanew, soFromBeginning);
|
||||
fs.read(signature, SizeOf(signature));
|
||||
if signature <> IMAGE_NT_SIGNATURE then
|
||||
begin
|
||||
Result := 0;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
fs.read(pe_header, SizeOf(pe_header));
|
||||
case pe_header.Machine of
|
||||
IMAGE_FILE_MACHINE_I386: Result := $00000020;
|
||||
IMAGE_FILE_MACHINE_AMD64: Result := $00000040;
|
||||
else
|
||||
Result := 0;
|
||||
end; { Case }
|
||||
|
||||
finally
|
||||
fs.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure InitializePlugins;
|
||||
var
|
||||
searchResult: TSearchRec;
|
||||
dllPath, name, msg: string;
|
||||
PluginData: TPluginData;
|
||||
errno: integer;
|
||||
errstr: string;
|
||||
begin
|
||||
NumBuiltinVars := NRLOCVAR + GetNrRegisteredVariations;
|
||||
PluginPath := ReadPluginDir;
|
||||
|
||||
// Try to find regular files matching *.dll in the plugins dir
|
||||
if FindFirst(PluginPath + '*.dll', faAnyFile, searchResult) = 0 then
|
||||
begin
|
||||
repeat
|
||||
with PluginData do begin
|
||||
dllPath := PluginPath + searchResult.Name;
|
||||
|
||||
//Check plugin platform
|
||||
if CurrentPlatform <> GetPlatformOf(dllPath)
|
||||
then continue;
|
||||
|
||||
//Load DLL and initialize plugins!
|
||||
PluginHandle := LoadLibrary(PChar(dllPath));
|
||||
if PluginHandle<>0 then begin
|
||||
@PluginVarGetName := GetProcAddress(PluginHandle,'PluginVarGetName');
|
||||
if @PluginVarGetName = nil then begin // Must not be a valid plugin!
|
||||
FreeLibrary(PluginHandle);
|
||||
msg := msg + 'Invalid plugin type: "' + searchResult.Name + '" is not a plugin' + #13#10;
|
||||
continue;
|
||||
end;
|
||||
name := String(PluginVarGetName);
|
||||
if GetVariationIndex(name) >= 0 then begin
|
||||
FreeLibrary(PluginHandle);
|
||||
msg := msg + 'Cannot load plugin from ' + searchResult.Name + ': variation "' + name + '" already exists!' + #13#10;
|
||||
// msg := msg + Format(TextByKey('common-loaderror') + #13#10, [searchResult.Name, name]);
|
||||
end
|
||||
else begin
|
||||
@PluginVarGetNrVariables := GetProcAddress(PluginHandle,'PluginVarGetNrVariables');
|
||||
@PluginVarGetVariableNameAt := GetProcAddress(PluginHandle,'PluginVarGetVariableNameAt');
|
||||
@PluginVarCreate := GetProcAddress(PluginHandle,'PluginVarCreate');
|
||||
@PluginVarDestroy := GetProcAddress(PluginHandle,'PluginVarDestroy');
|
||||
@PluginVarInit := GetProcAddress(PluginHandle,'PluginVarInit');
|
||||
@PluginVarInit3D := GetProcAddress(PluginHandle,'PluginVarInit3D');
|
||||
@PluginVarInitDC := GetProcAddress(PluginHandle,'PluginVarInitDC');
|
||||
@PluginVarPrepare := GetProcAddress(PluginHandle,'PluginVarPrepare');
|
||||
@PluginVarCalc := GetProcAddress(PluginHandle,'PluginVarCalc');
|
||||
@PluginVarGetVariable := GetProcAddress(PluginHandle,'PluginVarGetVariable');
|
||||
@PluginVarSetVariable := GetProcAddress(PluginHandle,'PluginVarSetVariable');
|
||||
@PluginVarResetVariable := GetProcAddress(PluginHandle,'PluginVarResetVariable');
|
||||
|
||||
RegisterVariation(TVariationPluginLoader.Create(PluginData), @PluginVarInit3D <> nil, @PluginVarInitDC <> nil);
|
||||
//RegisterVariationFile(ExtractFilePath(Application.ExeName) + 'Plugins\' + searchResult.Name, name);
|
||||
RegisterVariationFile(PluginPath + searchResult.Name, name); // AV: fixed!
|
||||
end;
|
||||
end else begin
|
||||
errno := GetLastError;
|
||||
errstr := SysErrorMessage(errno);
|
||||
msg := msg + 'Cannot open plugin file: ' + searchResult.Name + ' (Error #' + IntToStr(GetLastError) + ' - ' + errstr + ')' + #13#10;
|
||||
end;
|
||||
end;
|
||||
until (FindNext(searchResult) <> 0);
|
||||
SysUtils.FindClose(searchResult); //Since we use Windows unit (LoadLibrary)
|
||||
|
||||
if msg <> '' then
|
||||
Application.MessageBox(
|
||||
PChar('There were problems with some of the plugins:' + #13#10#13#10 + msg),
|
||||
'Warning', MB_ICONWARNING or MB_OK); // TextByKey('common-loaderror1')
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
end.
|
||||
|
||||
245
Variations/varGlynnSim1.pas
Normal file
245
Variations/varGlynnSim1.pas
Normal file
@ -0,0 +1,245 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varGlynnSim1;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationGlynnSim1 = class(TBaseVariation)
|
||||
private
|
||||
radius, radius1, thickness, contrast, pow,
|
||||
Phi1, abspow, x1, y1: double;
|
||||
procedure FilledCircle(var x: double; var y: double);
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationGlynnSim1 }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationGlynnSim1.Prepare;
|
||||
var sPhi1, cPhi1: double;
|
||||
begin
|
||||
SinCos(Phi1 * Pi / 180, sPhi1, cPhi1);
|
||||
x1 := radius * cPhi1;
|
||||
y1 := radius * sPhi1;
|
||||
abspow := abs(pow);
|
||||
end;
|
||||
|
||||
procedure TVariationGlynnSim1.FilledCircle(var x: double; var y: double);
|
||||
var r, Phi, sPhi, cPhi: double;
|
||||
begin
|
||||
Randomize;
|
||||
r := radius1 * (thickness + (1 - thickness) * random);
|
||||
Phi := 2 * Pi * random;
|
||||
SinCos(Phi, sPhi, cPhi);
|
||||
x := r * cPhi + x1;
|
||||
y := r * sPhi + y1;
|
||||
end;
|
||||
|
||||
procedure TVariationGlynnSim1.CalcFunction;
|
||||
var r, r2, x, y, px, py, Alpha: double;
|
||||
begin
|
||||
x := FTx^; y := FTy^;
|
||||
r := hypot(x, y);
|
||||
Alpha := radius / r;
|
||||
|
||||
if (r < radius) then
|
||||
begin
|
||||
FilledCircle(px, py);
|
||||
FPx^ := FPx^ + vvar * px;
|
||||
FPy^ := FPy^ + vvar * py;
|
||||
end else
|
||||
begin
|
||||
if (random > contrast * power(Alpha, abspow)) then
|
||||
begin
|
||||
px := x;
|
||||
py := y;
|
||||
end else
|
||||
begin
|
||||
px := sqr(Alpha) * x;
|
||||
py := sqr(Alpha) * y;
|
||||
end;
|
||||
r2 := sqr(px - x1) +sqr(py - y1);
|
||||
if (r2 < sqr(radius1)) then
|
||||
begin
|
||||
FilledCircle(px,py);
|
||||
FPx^ := FPx^ + vvar * px;
|
||||
FPy^ := FPy^ + vvar * py;
|
||||
end else
|
||||
begin
|
||||
FPx^ := FPx^ + vvar * px;
|
||||
FPy^ := FPy^ + vvar * py;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationGlynnSim1.Create;
|
||||
begin
|
||||
radius := 1;
|
||||
radius1 := 0.1;
|
||||
thickness := 0.1;
|
||||
contrast := 0.5;
|
||||
pow := 1.5;
|
||||
Phi1 := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationGlynnSim1.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationGlynnSim1.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationGlynnSim1.GetName: string;
|
||||
begin
|
||||
Result := 'GlynnSim1';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationGlynnSim1.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'GlynnSim1_radius';
|
||||
1: Result := 'GlynnSim1_radius1';
|
||||
2: Result := 'GlynnSim1_Phi1';
|
||||
3: Result := 'GlynnSim1_thickness';
|
||||
4: Result := 'GlynnSim1_pow';
|
||||
5: Result := 'GlynnSim1_contrast';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationGlynnSim1.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'GlynnSim1_radius' then begin
|
||||
radius := Value;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim1_thickness' then begin
|
||||
if Value < 0 then Value := 0;
|
||||
if Value > 1 then Value := 1;
|
||||
thickness := Value;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim1_contrast' then begin
|
||||
if Value < 0 then Value := 0;
|
||||
if Value > 1 then Value := 1;
|
||||
contrast := Value;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim1_pow' then begin
|
||||
pow := Value;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim1_Phi1' then begin
|
||||
Phi1 := Value;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim1_radius1' then begin
|
||||
radius1 := Value;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
function TVariationGlynnSim1.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'GlynnSim1_radius' then begin
|
||||
radius:= 1;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim1_thickness' then begin
|
||||
thickness := 0.1;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim1_contrast' then begin
|
||||
contrast := 0.5;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim1_pow' then begin
|
||||
pow := 1.5;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim1_Phi1' then begin
|
||||
Phi1 := 0;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim1_radius1' then begin
|
||||
radius1 := 0.1;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationGlynnSim1.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 6
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationGlynnSim1.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'GlynnSim1_radius' then begin
|
||||
Value := radius;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim1_thickness' then begin
|
||||
Value := thickness;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim1_contrast' then begin
|
||||
Value := contrast;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim1_pow' then begin
|
||||
Value := pow;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim1_Phi1' then begin
|
||||
Value := Phi1;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim1_radius1' then begin
|
||||
Value := radius1;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationGlynnSim1), false, false);
|
||||
end.
|
||||
234
Variations/varGlynnSim2.pas
Normal file
234
Variations/varGlynnSim2.pas
Normal file
@ -0,0 +1,234 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varGlynnSim2;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationGlynnSim2 = class(TBaseVariation)
|
||||
private
|
||||
radius, thickness, contrast, pow,
|
||||
Phi1, Phi2, Phi10, Phi20,
|
||||
gamma, delta, abspow: double;
|
||||
procedure Circle(var x: double; var y: double);
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationGlynnSim2 }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationGlynnSim2.Prepare;
|
||||
begin
|
||||
Phi10 := Phi1 * Pi / 180;
|
||||
Phi20 := Phi2 * Pi / 180;
|
||||
delta := Phi20 - Phi10;
|
||||
gamma := thickness * (2 * radius + thickness) / (radius + thickness);
|
||||
abspow := abs(pow);
|
||||
end;
|
||||
|
||||
procedure TVariationGlynnSim2.Circle(var x: double; var y: double);
|
||||
var r, Phi, sPhi, cPhi: double;
|
||||
begin
|
||||
Randomize;
|
||||
r := radius + thickness - gamma * random;
|
||||
Phi := Phi10 + delta * random;
|
||||
SinCos(Phi, sPhi, cPhi);
|
||||
x := r * cPhi;
|
||||
y := r * sPhi;
|
||||
end;
|
||||
|
||||
procedure TVariationGlynnSim2.CalcFunction;
|
||||
var r, x, y, px, py, Alpha: double;
|
||||
begin
|
||||
x := FTx^; y := FTy^;
|
||||
r := hypot(x, y);
|
||||
Alpha := radius / r;
|
||||
|
||||
if (r < radius) then
|
||||
begin
|
||||
Circle(px, py);
|
||||
FPx^ := FPx^ + vvar * px;
|
||||
FPy^ := FPy^ + vvar * py;
|
||||
end else
|
||||
if (random > contrast * power(Alpha, abspow)) then
|
||||
begin
|
||||
FPx^ := FPx^ + vvar * x;
|
||||
FPy^ := FPy^ + vvar * y;
|
||||
end else
|
||||
begin
|
||||
FPx^ := FPx^ + vvar * sqr(Alpha) * x;
|
||||
FPy^ := FPy^ + vvar * sqr(Alpha) * y;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationGlynnSim2.Create;
|
||||
begin
|
||||
radius := 1;
|
||||
thickness := 0.1;
|
||||
contrast := 0.5;
|
||||
pow := 1.5;
|
||||
Phi1 := 0;
|
||||
Phi2 := 360;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationGlynnSim2.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationGlynnSim2.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationGlynnSim2.GetName: string;
|
||||
begin
|
||||
Result := 'GlynnSim2';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationGlynnSim2.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'GlynnSim2_radius';
|
||||
1: Result := 'GlynnSim2_thickness';
|
||||
2: Result := 'GlynnSim2_contrast';
|
||||
3: Result := 'GlynnSim2_pow';
|
||||
4: Result := 'GlynnSim2_Phi1';
|
||||
5: Result := 'GlynnSim2_Phi2';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationGlynnSim2.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'GlynnSim2_radius' then begin
|
||||
radius := Value;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim2_thickness' then begin
|
||||
if Value < 0 then Value := 0;
|
||||
if Value > 1 then Value := 1;
|
||||
thickness := Value;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim2_contrast' then begin
|
||||
if Value < 0 then Value := 0;
|
||||
if Value > 1 then Value := 1;
|
||||
contrast := Value;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim2_pow' then begin
|
||||
pow := Value;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim2_Phi1' then begin
|
||||
Phi1 := Value;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim2_Phi2' then begin
|
||||
Phi2 := Value;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
function TVariationGlynnSim2.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'GlynnSim2_radius' then begin
|
||||
radius:= 1;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim2_thickness' then begin
|
||||
thickness := 0.1;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim2_contrast' then begin
|
||||
contrast := 0.5;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim2_pow' then begin
|
||||
pow := 1.5;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim2_Phi1' then begin
|
||||
Phi1 := 0;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim2_Phi2' then begin
|
||||
Phi2 := 360;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationGlynnSim2.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 6
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationGlynnSim2.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'GlynnSim2_radius' then begin
|
||||
Value := radius;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim2_thickness' then begin
|
||||
Value := thickness;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim2_contrast' then begin
|
||||
Value := contrast;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim2_pow' then begin
|
||||
Value := pow;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim2_Phi1' then begin
|
||||
Value := Phi1;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim2_Phi2' then begin
|
||||
Value := Phi2;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationGlynnSim2), false, false);
|
||||
end.
|
||||
210
Variations/varGlynnSim3.pas
Normal file
210
Variations/varGlynnSim3.pas
Normal file
@ -0,0 +1,210 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varGlynnSim3;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationGlynnSim3 = class(TBaseVariation)
|
||||
private
|
||||
radius, thickness, contrast, pow,
|
||||
radius1, radius2, gamma: double;
|
||||
procedure DoubleCircle(var x: double; var y: double);
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationGlynnSim2 }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationGlynnSim3.Prepare;
|
||||
begin
|
||||
radius1 := radius + thickness;
|
||||
radius2 := sqr(radius) / radius1;
|
||||
gamma := radius1 / (radius1 + radius2);
|
||||
end;
|
||||
|
||||
procedure TVariationGlynnSim3.DoubleCircle(var x: double; var y: double);
|
||||
var r, Phi, sPhi, cPhi: double;
|
||||
begin
|
||||
Randomize;
|
||||
Phi := 2 * Pi * random;
|
||||
SinCos(Phi, sPhi, cPhi);
|
||||
if (random < gamma) then r := radius1
|
||||
else r := radius2;
|
||||
x := r * cPhi;
|
||||
y := r * sPhi;
|
||||
end;
|
||||
|
||||
procedure TVariationGlynnSim3.CalcFunction;
|
||||
var r, r2, x, y, px, py, Alpha: double;
|
||||
begin
|
||||
x := FTx^; y := FTy^;
|
||||
r := hypot(x, y);
|
||||
Alpha := radius / r;
|
||||
|
||||
if (r < radius1) then
|
||||
begin
|
||||
DoubleCircle(px, py);
|
||||
FPx^ := FPx^ + vvar * px;
|
||||
FPy^ := FPy^ + vvar * py;
|
||||
end else
|
||||
begin
|
||||
if (random > contrast * power(Alpha, pow)) then
|
||||
begin
|
||||
FPx^ := FPx^ + vvar * x;
|
||||
FPy^ := FPy^ + vvar * y;
|
||||
end else
|
||||
begin
|
||||
FPx^ := FPx^ + vvar * sqr(Alpha) * x;
|
||||
FPy^ := FPy^ + vvar * sqr(Alpha) * y;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationGlynnSim3.Create;
|
||||
begin
|
||||
radius := 1;
|
||||
thickness := 0.1;
|
||||
contrast := 0.5;
|
||||
pow := 1.5;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationGlynnSim3.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationGlynnSim3.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationGlynnSim3.GetName: string;
|
||||
begin
|
||||
Result := 'GlynnSim3';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationGlynnSim3.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'GlynnSim3_radius';
|
||||
1: Result := 'GlynnSim3_thickness';
|
||||
2: Result := 'GlynnSim3_contrast';
|
||||
3: Result := 'GlynnSim3_pow';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationGlynnSim3.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'GlynnSim3_radius' then begin
|
||||
radius := Value;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim3_thickness' then begin
|
||||
thickness := Value;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim3_contrast' then begin
|
||||
if Value < 0 then Value := 0;
|
||||
if Value > 1 then Value := 1;
|
||||
contrast := Value;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim3_pow' then begin
|
||||
pow := Value;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
function TVariationGlynnSim3.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'GlynnSim3_radius' then begin
|
||||
radius:= 1;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim3_thickness' then begin
|
||||
thickness := 0.1;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim3_contrast' then begin
|
||||
contrast := 0.5;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim3_pow' then begin
|
||||
pow := 1.5;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationGlynnSim3.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 4
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationGlynnSim3.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'GlynnSim3_radius' then begin
|
||||
Value := radius;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim3_thickness' then begin
|
||||
Value := thickness;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim3_contrast' then begin
|
||||
Value := contrast;
|
||||
Result := True;
|
||||
end else if Name = 'GlynnSim3_pow' then begin
|
||||
Value := pow;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationGlynnSim3), false, false);
|
||||
end.
|
||||
127
Variations/varHandkerchief.pas
Normal file
127
Variations/varHandkerchief.pas
Normal file
@ -0,0 +1,127 @@
|
||||
{ Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina }
|
||||
|
||||
unit varHandkerchief;
|
||||
|
||||
interface
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationHandkerchief = class(TBaseVariation)
|
||||
private
|
||||
old: byte;
|
||||
procedure CalcPlugin;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure CalcFunction; override;
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
////////////////////////
|
||||
procedure TVariationHandkerchief.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
if old = 1 then f := CalcFunction
|
||||
else f := CalcPlugin;
|
||||
end;
|
||||
|
||||
procedure TVariationHandkerchief.CalcFunction;
|
||||
var
|
||||
r, FAngle: double;
|
||||
begin
|
||||
FAngle := arctan2(FTx^, FTy^);
|
||||
r := sqrt(sqr(FTx^) + sqr(FTy^));
|
||||
FPx^ := FPx^ + vvar * sin(FAngle + r) * r;
|
||||
FPy^ := FPy^ + vvar * cos(FAngle - r) * r;
|
||||
end;
|
||||
|
||||
procedure TVariationHandkerchief.CalcPlugin;
|
||||
var
|
||||
r, FAngle: double;
|
||||
begin
|
||||
FAngle := arctan2(FTy^, FTx^);
|
||||
r := sqrt(sqr(FTx^) + sqr(FTy^));
|
||||
FPx^ := FPx^ + vvar * sin(FAngle + r) * r;
|
||||
FPy^ := FPy^ + vvar * cos(FAngle - r) * r;
|
||||
end;
|
||||
|
||||
constructor TVariationHandkerchief.Create;
|
||||
begin
|
||||
old := 1;
|
||||
end;
|
||||
|
||||
class function TVariationHandkerchief.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationHandkerchief.Create;
|
||||
end;
|
||||
|
||||
class function TVariationHandkerchief.GetName: string;
|
||||
begin
|
||||
Result := 'handkerchief';
|
||||
end;
|
||||
|
||||
function TVariationHandkerchief.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 1;
|
||||
end;
|
||||
|
||||
function TVariationHandkerchief.GetVariable(const Name: string;
|
||||
var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'handkerchief_old' then begin
|
||||
value := old;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationHandkerchief.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index of
|
||||
0: Result := 'handkerchief_old';
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationHandkerchief.SetVariable(const Name: string;
|
||||
var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'handkerchief_old' then begin
|
||||
if Value < 0 then Value := 0;
|
||||
if Value > 1 then Value := 1;
|
||||
old := Round(value);
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationHandkerchief.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'handkerchief_old' then begin
|
||||
old := 1;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
//////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationHandkerchief), false, false);
|
||||
|
||||
end.
|
||||
61
Variations/varHeart.pas
Normal file
61
Variations/varHeart.pas
Normal file
@ -0,0 +1,61 @@
|
||||
{ Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina }
|
||||
|
||||
unit varHeart;
|
||||
|
||||
interface
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationHeart = class(TBaseVariation)
|
||||
private
|
||||
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
////////////////////////
|
||||
|
||||
procedure TVariationHeart.CalcFunction;
|
||||
var
|
||||
FAngle, r, sinr, cosr: double;
|
||||
begin
|
||||
FAngle := arctan2(FTx^, FTy^);
|
||||
r := sqrt(sqr(FTx^) + sqr(FTy^));
|
||||
Sincos(r * FAngle, sinr, cosr);
|
||||
r := r * vvar;
|
||||
FPx^ := FPx^ + r * sinr;
|
||||
FPy^ := FPy^ - r * cosr;
|
||||
end;
|
||||
|
||||
constructor TVariationHeart.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
end;
|
||||
|
||||
class function TVariationHeart.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationHeart.Create;
|
||||
end;
|
||||
|
||||
class function TVariationHeart.GetName: string;
|
||||
begin
|
||||
Result := 'heart';
|
||||
end;
|
||||
|
||||
//////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationHeart), false, false);
|
||||
|
||||
end.
|
||||
240
Variations/varHyperboloid.pas
Normal file
240
Variations/varHyperboloid.pas
Normal file
@ -0,0 +1,240 @@
|
||||
{ Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina }
|
||||
|
||||
unit varHyperboloid;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationHyperboloid = class(TBaseVariation)
|
||||
private
|
||||
kx, ky, kz, maxheight, h, hb: double;
|
||||
vkx, vky, vkz: double;
|
||||
limit, zero: byte;
|
||||
|
||||
procedure CalcCut;
|
||||
procedure CalcCutBoarder;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationHyperboloid }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationHyperboloid.Prepare;
|
||||
begin
|
||||
vkx := VVAR * kx;
|
||||
vky := VVAR * ky;
|
||||
vkz := VVAR * kz;
|
||||
h := sqrt(1 + sqr(maxheight / ky));
|
||||
hb := sqrt(sqr(h) - 1);
|
||||
end;
|
||||
|
||||
procedure TVariationHyperboloid.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
if (limit = 0) then
|
||||
f := CalcFunction
|
||||
else if (zero = 0) then
|
||||
f := CalcCutBoarder
|
||||
else
|
||||
f := CalcCut;
|
||||
end;
|
||||
|
||||
procedure TVariationHyperboloid.CalcFunction;
|
||||
var
|
||||
sn, cn, sh, ch: double;
|
||||
begin
|
||||
SinCos(FTx^, sn, cn);
|
||||
SinhCosh(FTy^, sh, ch);
|
||||
|
||||
FPx^ := FPx^ + vkx * ch * sn;
|
||||
FPy^ := FPy^ + vky * sh;
|
||||
FPz^ := FPz^ + vkz * ch * cn;
|
||||
end;
|
||||
|
||||
procedure TVariationHyperboloid.CalcCut;
|
||||
var
|
||||
sn, cn, sh, ch: double;
|
||||
begin
|
||||
SinhCosh(FTy^, sh, ch);
|
||||
|
||||
if (ch <= h) then // cut the surface
|
||||
begin
|
||||
SinCos(FTx^, sn, cn);
|
||||
FPx^ := FPx^ + vkx * ch * sn;
|
||||
FPy^ := FPy^ + vky * sh;
|
||||
FPz^ := FPz^ + vkz * ch * cn;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TVariationHyperboloid.CalcCutBoarder;
|
||||
var
|
||||
sn, cn, sh, ch: double;
|
||||
begin
|
||||
SinCos(FTx^, sn, cn);
|
||||
SinhCosh(FTy^, sh, ch);
|
||||
|
||||
if (ch <= h) then // cut the surface
|
||||
begin
|
||||
FPx^ := FPx^ + vkx * ch * sn;
|
||||
FPy^ := FPy^ + vky * sh;
|
||||
FPz^ := FPz^ + vkz * ch * cn;
|
||||
end
|
||||
else begin // place the point on it's boarder
|
||||
FPx^ := FPx^ + vkx * h * sn;
|
||||
FPy^ := FPy^ + vky * sign(sh) * hb;
|
||||
FPz^ := FPz^ + vkz * h * cn;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationHyperboloid.Create;
|
||||
begin
|
||||
kx := 1;
|
||||
ky := 1;
|
||||
kz := 1;
|
||||
maxheight := RandomRange(3, 6);
|
||||
limit := 1;
|
||||
zero := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationHyperboloid.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationHyperboloid.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationHyperboloid.GetName: string;
|
||||
begin
|
||||
Result := 'hourglass3D'; // AV: hyperbolic hyperboloid :)
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationHyperboloid.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'hourglass3D_kx';
|
||||
1: Result := 'hourglass3D_ky';
|
||||
2: Result := 'hourglass3D_kz';
|
||||
3: Result := 'hourglass3D_maxheight';
|
||||
4: Result := 'hourglass3D_uselimit';
|
||||
5: Result := 'hourglass3D_zero_edges';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationHyperboloid.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'hourglass3D_kx' then begin
|
||||
if (value < 1E-5) then Value := 1E-5;
|
||||
kx := Value;
|
||||
Result := True;
|
||||
end else if Name = 'hourglass3D_ky' then begin
|
||||
if (value < 1E-5) then Value := 1E-5;
|
||||
ky := Value;
|
||||
Result := True;
|
||||
end else if Name = 'hourglass3D_kz' then begin
|
||||
if (value < 1E-5) then Value := 1E-5;
|
||||
kz := Value;
|
||||
Result := True;
|
||||
end else if Name = 'hourglass3D_maxheight' then begin
|
||||
if (value < 0.1) then Value := 0.1;
|
||||
maxheight := Value;
|
||||
Result := True;
|
||||
end else if Name = 'hourglass3D_uselimit' then begin
|
||||
if (value < 0) then Value := 0;
|
||||
if (value > 1) then Value := 1;
|
||||
limit := Round(Value);
|
||||
Result := True;
|
||||
end else if Name = 'hourglass3D_zero_edges' then begin
|
||||
if (value < 0) then Value := 0;
|
||||
if (value > 1) then Value := 1;
|
||||
zero := Round(Value);
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationHyperboloid.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'hourglass3D_kx' then begin
|
||||
kx:= 1;
|
||||
Result := True;
|
||||
end else if Name = 'hourglass3D_ky' then begin
|
||||
ky := 1;
|
||||
Result := True;
|
||||
end else if Name = 'hourglass3D_kz' then begin
|
||||
kz := 1;
|
||||
Result := True;
|
||||
end else if Name = 'hourglass3D_maxheight' then begin
|
||||
maxheight := 3;
|
||||
Result := True;
|
||||
end else if Name = 'hourglass3D_uselimit' then begin
|
||||
limit := IfThen(limit = 0, 1, 0);
|
||||
Result := True;
|
||||
end else if Name = 'hourglass3D_zero_edges' then begin
|
||||
zero := IfThen(zero = 0, 1, 0);
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationHyperboloid.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 6;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationHyperboloid.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'hourglass3D_kx' then begin
|
||||
Value := kx;
|
||||
Result := True;
|
||||
end else if Name = 'hourglass3D_ky' then begin
|
||||
Value := ky;
|
||||
Result := True;
|
||||
end else if Name = 'hourglass3D_kz' then begin
|
||||
Value := kz;
|
||||
Result := True;
|
||||
end else if Name = 'hourglass3D_maxheight' then begin
|
||||
Value := maxheight;
|
||||
Result := True;
|
||||
end else if Name = 'hourglass3D_uselimit' then begin
|
||||
Value := limit;
|
||||
Result := True;
|
||||
end else if Name = 'hourglass3D_zero_edges' then begin
|
||||
Value := zero;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationHyperboloid), true, false);
|
||||
end.
|
||||
185
Variations/varHypertile.pas
Normal file
185
Variations/varHypertile.pas
Normal file
@ -0,0 +1,185 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varHypertile;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationHypertile = class(TBaseVariation)
|
||||
private
|
||||
hypertile_p, hypertile_q, hypertile_n: integer;
|
||||
re, im: double;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationHypertile.Prepare;
|
||||
var
|
||||
t, pa, qa, r: double;
|
||||
begin
|
||||
pa := PI2 / hypertile_p;
|
||||
qa := PI2 / hypertile_q;
|
||||
t := cos(pa);
|
||||
r := (1 - t) / (t + cos(qa)) + 1;
|
||||
if (r > 0) then
|
||||
r := 1 / sqrt(r)
|
||||
else
|
||||
r := 1;
|
||||
t := hypertile_n * pa;
|
||||
SinCos(t, pa, qa);
|
||||
re := r * qa;
|
||||
im := r * pa;
|
||||
end;
|
||||
|
||||
procedure TVariationHypertile.CalcFunction;
|
||||
var
|
||||
u, v, s, t, vr: double;
|
||||
begin
|
||||
u := FTx^ + re;
|
||||
v := FTy^ - im;
|
||||
|
||||
s := re * FTx^ - im * FTy^ + 1;
|
||||
t := re * FTy^ + im * FTx^;
|
||||
|
||||
vr := vvar / (sqr(s) + sqr(t));
|
||||
|
||||
FPx^ := FPx^ + vr * (u * s + v * t);
|
||||
FPy^ := FPy^ + vr * (v * s - u * t);
|
||||
// FPz^ := FPz^ + VVAR * FTz^;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationHypertile.Create;
|
||||
begin
|
||||
hypertile_p := 3;
|
||||
hypertile_q := 7;
|
||||
hypertile_n := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationHypertile.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationHypertile.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationHypertile.GetName: string;
|
||||
begin
|
||||
Result := 'hypertile';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationHypertile.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'hypertile_p';
|
||||
1: Result := 'hypertile_q';
|
||||
2: Result := 'hypertile_n';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationHypertile.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'hypertile_p' then begin
|
||||
if Value < 3 then Value := 3;
|
||||
hypertile_p := Round(Value);
|
||||
Result := True;
|
||||
end else if Name = 'hypertile_q' then begin
|
||||
if Value < 3 then Value := 3;
|
||||
hypertile_q := Round(Value);
|
||||
Result := True;
|
||||
end else if Name = 'hypertile_n' then begin
|
||||
hypertile_n := Round(Value);
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationHypertile.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'hypertile_p' then begin
|
||||
hypertile_p := 3;
|
||||
Result := True;
|
||||
end else if Name = 'hypertile_q' then begin
|
||||
hypertile_q := 7;
|
||||
Result := True;
|
||||
end else if Name = 'hypertile_n' then begin
|
||||
hypertile_n := 0;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationHypertile.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 3;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationHypertile.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'hypertile_p' then begin
|
||||
Value := hypertile_p;
|
||||
Result := True;
|
||||
end else if Name = 'hypertile_q' then begin
|
||||
Value := hypertile_q;
|
||||
Result := True;
|
||||
end else if Name = 'hypertile_n' then begin
|
||||
Value := hypertile_n;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationHypertile), false, false);
|
||||
end.
|
||||
173
Variations/varHypertile1.pas
Normal file
173
Variations/varHypertile1.pas
Normal file
@ -0,0 +1,173 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varHypertile1;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationHypertile1 = class(TBaseVariation)
|
||||
private
|
||||
hypertile1_p, hypertile1_q: integer;
|
||||
pa, r: double;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationHypertile1.Prepare;
|
||||
var
|
||||
cp, r2: double;
|
||||
begin
|
||||
pa := PI2 / hypertile1_p;
|
||||
cp := cos(pa);
|
||||
r2 := 1 - (cp - 1) / (cp + cos(PI2 / hypertile1_q));
|
||||
if (r2 > 0) then
|
||||
r := 1 / sqrt(r2)
|
||||
else
|
||||
r := 1;
|
||||
end;
|
||||
|
||||
procedure TVariationHypertile1.CalcFunction;
|
||||
var
|
||||
sina, cosa, re, im, u, v, s, t, vr: double;
|
||||
begin
|
||||
SinCos(random(32767) * pa, sina, cosa);
|
||||
re := r * cosa;
|
||||
im := r * sina;
|
||||
|
||||
u := FTx^ + re;
|
||||
v := FTy^ - im;
|
||||
|
||||
s := re * FTx^ - im * FTy^ + 1;
|
||||
t := re * FTy^ + im * FTx^;
|
||||
|
||||
vr := vvar / (sqr(s) + sqr(t));
|
||||
|
||||
FPx^ := FPx^ + vr * (u * s + v * t);
|
||||
FPy^ := FPy^ + vr * (v * s - u * t);
|
||||
// FPz^ := FPz^ + VVAR * FTz^;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationHypertile1.Create;
|
||||
begin
|
||||
hypertile1_p := 3;
|
||||
hypertile1_q := 7;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationHypertile1.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationHypertile1.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationHypertile1.GetName: string;
|
||||
begin
|
||||
Result := 'hypertile1';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationHypertile1.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'hypertile1_p';
|
||||
1: Result := 'hypertile1_q';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationHypertile1.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'hypertile1_p' then begin
|
||||
if Value < 3 then Value := 3;
|
||||
hypertile1_p := Round(Value);
|
||||
Result := True;
|
||||
end else if Name = 'hypertile1_q' then begin
|
||||
if Value < 3 then Value := 3;
|
||||
hypertile1_q := Round(Value);
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationHypertile1.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'hypertile1_p' then begin
|
||||
hypertile1_p := 3;
|
||||
Result := True;
|
||||
end else if Name = 'hypertile1_q' then begin
|
||||
hypertile1_q := 7;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationHypertile1.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 2;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationHypertile1.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'hypertile1_p' then begin
|
||||
Value := hypertile1_p;
|
||||
Result := True;
|
||||
end else if Name = 'hypertile1_q' then begin
|
||||
Value := hypertile1_q;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationHypertile1), false, false);
|
||||
end.
|
||||
172
Variations/varHypertile2.pas
Normal file
172
Variations/varHypertile2.pas
Normal file
@ -0,0 +1,172 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varHypertile2;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationHypertile2 = class(TBaseVariation)
|
||||
private
|
||||
hypertile2_p, hypertile2_q: integer;
|
||||
pa, r: double;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationHypertile2.Prepare;
|
||||
var
|
||||
cp, r2: double;
|
||||
begin
|
||||
pa := PI2 / hypertile2_p;
|
||||
cp := cos(pa);
|
||||
r2 := 1 - (cp - 1) / (cp + cos(PI2 / hypertile2_q));
|
||||
if (r2 > 0) then
|
||||
r := 1 / sqrt(r2)
|
||||
else
|
||||
r := 1;
|
||||
end;
|
||||
|
||||
procedure TVariationHypertile2.CalcFunction;
|
||||
var
|
||||
sina, cosa, x, y, u, v, s, t, vr: double;
|
||||
begin
|
||||
u := FTx^ + r;
|
||||
v := FTy^;
|
||||
s := r * FTx^ + 1;
|
||||
t := r * FTy^;
|
||||
|
||||
vr := vvar / (sqr(s) + sqr(t));
|
||||
x := u * s + v * t;
|
||||
y := v * s - u * t;
|
||||
|
||||
SinCos(random(32767) * pa, sina, cosa);
|
||||
|
||||
FPx^ := FPx^ + vr * (x * cosa + y * sina);
|
||||
FPy^ := FPy^ + vr * (y * cosa - x * sina);
|
||||
// FPz^ := FPz^ + VVAR * FTz^;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationHypertile2.Create;
|
||||
begin
|
||||
hypertile2_p := 3;
|
||||
hypertile2_q := 7;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationHypertile2.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationHypertile2.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationHypertile2.GetName: string;
|
||||
begin
|
||||
Result := 'hypertile2';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationHypertile2.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'hypertile2_p';
|
||||
1: Result := 'hypertile2_q';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationHypertile2.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'hypertile2_p' then begin
|
||||
if Value < 3 then Value := 3;
|
||||
hypertile2_p := Round(Value);
|
||||
Result := True;
|
||||
end else if Name = 'hypertile2_q' then begin
|
||||
if Value < 3 then Value := 3;
|
||||
hypertile2_q := Round(Value);
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationHypertile2.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'hypertile2_p' then begin
|
||||
hypertile2_p := 3;
|
||||
Result := True;
|
||||
end else if Name = 'hypertile2_q' then begin
|
||||
hypertile2_q := 7;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationHypertile2.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 2;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationHypertile2.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'hypertile2_p' then begin
|
||||
Value := hypertile2_p;
|
||||
Result := True;
|
||||
end else if Name = 'hypertile2_q' then begin
|
||||
Value := hypertile2_q;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationHypertile2), false, false);
|
||||
end.
|
||||
193
Variations/varHypertile3D.pas
Normal file
193
Variations/varHypertile3D.pas
Normal file
@ -0,0 +1,193 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varHypertile3D;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationHypertile3D = class(TBaseVariation)
|
||||
private
|
||||
hypertile3D_p, hypertile3D_q, hypertile3D_n: integer;
|
||||
cx, cy, c2x, c2y, c2, s2x, s2y, s2z: double;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationHypertile3D.Prepare;
|
||||
var
|
||||
t, pa, qa, r: double;
|
||||
begin
|
||||
pa := PI2 / hypertile3D_p;
|
||||
qa := PI2 / hypertile3D_q;
|
||||
t := cos(pa);
|
||||
r := -(t - 1) / (t + cos(qa));
|
||||
if (r > 0) then
|
||||
r := 1 / sqrt(1 + r)
|
||||
else
|
||||
r := 1;
|
||||
|
||||
t := hypertile3D_n * pa;
|
||||
SinCos(t, pa, qa);
|
||||
|
||||
cx := r * qa;
|
||||
cy := r * pa;
|
||||
c2x := 2 * cx;
|
||||
c2y := 2 * cy;
|
||||
c2 := sqr(cx) + sqr(cy);
|
||||
|
||||
s2x := 1 + sqr(cx) - sqr(cy);
|
||||
s2y := 1 + sqr(cy) - sqr(cx);
|
||||
s2z := 1 - sqr(cy) - sqr(cx);
|
||||
end;
|
||||
|
||||
procedure TVariationHypertile3D.CalcFunction;
|
||||
var
|
||||
r2, x2cx, y2cy, vr: double;
|
||||
begin
|
||||
r2 := sqr(FTx^) + sqr(FTy^) + sqr(FTz^);
|
||||
|
||||
x2cx := c2x * FTx^;
|
||||
y2cy := c2y * FTy^;
|
||||
|
||||
vr := vvar / (c2 * r2 + x2cx - y2cy + 1);
|
||||
|
||||
FPx^ := FPx^ + vr * (FTx^ * s2x - cx * ( y2cy - r2 - 1));
|
||||
FPy^ := FPy^ + vr * (FTy^ * s2y + cy * (-x2cx - r2 - 1));
|
||||
FPz^ := FPz^ + vr * (FTz^ * s2z);
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationHypertile3D.Create;
|
||||
begin
|
||||
hypertile3D_p := 3;
|
||||
hypertile3D_q := 7;
|
||||
hypertile3D_n := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationHypertile3D.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationHypertile3D.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationHypertile3D.GetName: string;
|
||||
begin
|
||||
Result := 'hypertile3D';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationHypertile3D.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'hypertile3D_p';
|
||||
1: Result := 'hypertile3D_q';
|
||||
2: Result := 'hypertile3D_n';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationHypertile3D.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'hypertile3D_p' then begin
|
||||
if Value < 3 then Value := 3;
|
||||
hypertile3D_p := Round(Value);
|
||||
Result := True;
|
||||
end else if Name = 'hypertile3D_q' then begin
|
||||
if Value < 3 then Value := 3;
|
||||
hypertile3D_q := Round(Value);
|
||||
Result := True;
|
||||
end else if Name = 'hypertile3D_n' then begin
|
||||
hypertile3D_n := Round(Value);
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationHypertile3D.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'hypertile3D_p' then begin
|
||||
hypertile3D_p := 3;
|
||||
Result := True;
|
||||
end else if Name = 'hypertile3D_q' then begin
|
||||
hypertile3D_q := 7;
|
||||
Result := True;
|
||||
end else if Name = 'hypertile3D_n' then begin
|
||||
hypertile3D_n := 0;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationHypertile3D.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 3;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationHypertile3D.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'hypertile3D_p' then begin
|
||||
Value := hypertile3D_p;
|
||||
Result := True;
|
||||
end else if Name = 'hypertile3D_q' then begin
|
||||
Value := hypertile3D_q;
|
||||
Result := True;
|
||||
end else if Name = 'hypertile3D_n' then begin
|
||||
Value := hypertile3D_n;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationHypertile3D), true, false);
|
||||
end.
|
||||
178
Variations/varHypertile3D1.pas
Normal file
178
Variations/varHypertile3D1.pas
Normal file
@ -0,0 +1,178 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varHypertile3D1;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationHypertile3D1 = class(TBaseVariation)
|
||||
private
|
||||
hypertile3D1_p, hypertile3D1_q: integer;
|
||||
pa, r, c2, s2z: double;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationHypertile3D1.Prepare;
|
||||
var
|
||||
t, qa: double;
|
||||
begin
|
||||
pa := PI2 / hypertile3D1_p;
|
||||
qa := PI2 / hypertile3D1_q;
|
||||
t := cos(pa);
|
||||
r := -(t - 1) / (t + cos(qa));
|
||||
if (r > 0) then
|
||||
r := 1 / sqrt(1 + r)
|
||||
else
|
||||
r := 1;
|
||||
|
||||
c2 := sqr(r);
|
||||
s2z := 1 - c2;
|
||||
end;
|
||||
|
||||
procedure TVariationHypertile3D1.CalcFunction;
|
||||
var
|
||||
sina, cosa, cx, cy, s2x, s2y, x2cx, y2cy, r2, vr: double;
|
||||
begin
|
||||
SinCos(random(32767) * pa, sina, cosa);
|
||||
cx := r * cosa;
|
||||
cy := r * sina;
|
||||
s2x := 1 + sqr(cx) - sqr(cy);
|
||||
s2y := 1 + sqr(cy) - sqr(cx);
|
||||
|
||||
r2 := sqr(FTx^) + sqr(FTy^) + sqr(FTz^);
|
||||
|
||||
x2cx := 2 * cx * FTx^;
|
||||
y2cy := 2 * cy * FTy^;
|
||||
|
||||
vr := vvar / (c2 * r2 + x2cx - y2cy + 1);
|
||||
|
||||
FPx^ := FPx^ + vr * (FTx^ * s2x - cx * ( y2cy - r2 - 1));
|
||||
FPy^ := FPy^ + vr * (FTy^ * s2y + cy * (-x2cx - r2 - 1));
|
||||
FPz^ := FPz^ + vr * (FTz^ * s2z);
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationHypertile3D1.Create;
|
||||
begin
|
||||
hypertile3D1_p := 3;
|
||||
hypertile3D1_q := 7;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationHypertile3D1.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationHypertile3D1.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationHypertile3D1.GetName: string;
|
||||
begin
|
||||
Result := 'hypertile3D1';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationHypertile3D1.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'hypertile3D1_p';
|
||||
1: Result := 'hypertile3D1_q';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationHypertile3D1.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'hypertile3D1_p' then begin
|
||||
if Value < 3 then Value := 3;
|
||||
hypertile3D1_p := Round(Value);
|
||||
Result := True;
|
||||
end else if Name = 'hypertile3D1_q' then begin
|
||||
if Value < 3 then Value := 3;
|
||||
hypertile3D1_q := Round(Value);
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationHypertile3D1.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'hypertile3D1_p' then begin
|
||||
hypertile3D1_p := 3;
|
||||
Result := True;
|
||||
end else if Name = 'hypertile3D1_q' then begin
|
||||
hypertile3D1_q := 7;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationHypertile3D1.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 2;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationHypertile3D1.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'hypertile3D1_p' then begin
|
||||
Value := hypertile3D1_p;
|
||||
Result := True;
|
||||
end else if Name = 'hypertile3D1_q' then begin
|
||||
Value := hypertile3D1_q;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationHypertile3D1), true, false);
|
||||
end.
|
||||
179
Variations/varHypertile3D2.pas
Normal file
179
Variations/varHypertile3D2.pas
Normal file
@ -0,0 +1,179 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varHypertile3D2;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationHypertile3D2 = class(TBaseVariation)
|
||||
private
|
||||
hypertile3D2_p, hypertile3D2_q: integer;
|
||||
pa, cx, c2, c2x, s2x, s2y, s2z: double;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationHypertile3D2.Prepare;
|
||||
var
|
||||
t, qa, r: double;
|
||||
begin
|
||||
pa := PI2 / hypertile3D2_p;
|
||||
qa := PI2 / hypertile3D2_q;
|
||||
t := cos(pa);
|
||||
r := -(t - 1) / (t + cos(qa));
|
||||
if (r > 0) then
|
||||
r := 1 / sqrt(1 + r)
|
||||
else
|
||||
r := 1;
|
||||
|
||||
cx := r;
|
||||
c2 := sqr(cx);
|
||||
c2x := 2 * cx;
|
||||
|
||||
s2x := 1 + c2;
|
||||
s2y := 1 - c2;
|
||||
s2z := 1 - c2;
|
||||
end;
|
||||
|
||||
procedure TVariationHypertile3D2.CalcFunction;
|
||||
var
|
||||
r2, sina, cosa, x2cx, x, y, vr: double;
|
||||
begin
|
||||
r2 := sqr(FTx^) + sqr(FTy^) + sqr(FTz^);
|
||||
|
||||
x2cx := c2x * FTx^;
|
||||
x := FTx^ * s2x - cx * (-r2 - 1);
|
||||
y := FTy^ * s2y;
|
||||
|
||||
vr := vvar / (c2 * r2 + x2cx + 1);
|
||||
SinCos(random(32767) * pa, sina, cosa);
|
||||
|
||||
FPx^ := FPx^ + vr * (x * cosa + y * sina);
|
||||
FPy^ := FPy^ + vr * (y * cosa - x * sina);
|
||||
FPz^ := FPz^ + vr * (FTz^ * s2z);
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationHypertile3D2.Create;
|
||||
begin
|
||||
hypertile3D2_p := 3;
|
||||
hypertile3D2_q := 7;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationHypertile3D2.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationHypertile3D2.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationHypertile3D2.GetName: string;
|
||||
begin
|
||||
Result := 'hypertile3D2';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationHypertile3D2.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'hypertile3D2_p';
|
||||
1: Result := 'hypertile3D2_q';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationHypertile3D2.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'hypertile3D2_p' then begin
|
||||
if Value < 3 then Value := 3;
|
||||
hypertile3D2_p := Round(Value);
|
||||
Result := True;
|
||||
end else if Name = 'hypertile3D2_q' then begin
|
||||
if Value < 3 then Value := 3;
|
||||
hypertile3D2_q := Round(Value);
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationHypertile3D2.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'hypertile3D2_p' then begin
|
||||
hypertile3D2_p := 3;
|
||||
Result := True;
|
||||
end else if Name = 'hypertile3D2_q' then begin
|
||||
hypertile3D2_q := 7;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationHypertile3D2.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 2;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationHypertile3D2.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'hypertile3D2_p' then begin
|
||||
Value := hypertile3D2_p;
|
||||
Result := True;
|
||||
end else if Name = 'hypertile3D2_q' then begin
|
||||
Value := hypertile3D2_q;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationHypertile3D2), true, false);
|
||||
end.
|
||||
169
Variations/varInversion3D.pas
Normal file
169
Variations/varInversion3D.pas
Normal file
@ -0,0 +1,169 @@
|
||||
{ Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina }
|
||||
|
||||
unit varInversion3D;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
const
|
||||
sr = 'inversion3D_radius';
|
||||
sx0 = 'inversion3D_x0';
|
||||
sy0 = 'inversion3D_y0';
|
||||
sz0 = 'inversion3D_z0';
|
||||
|
||||
type
|
||||
TVariationInversion3D = class(TBaseVariation)
|
||||
private
|
||||
r, r2, x0, y0, z0: double;
|
||||
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationInversion3D }
|
||||
|
||||
//////////////////////////////////////////
|
||||
procedure TVariationInversion3D.Prepare;
|
||||
begin
|
||||
r2 := sqr(r);
|
||||
end;
|
||||
|
||||
//////////////////////////////////////////
|
||||
procedure TVariationInversion3D.CalcFunction;
|
||||
var x, y, z, dist: double;
|
||||
begin
|
||||
x := FTx^ - x0;
|
||||
y := FTy^ - y0;
|
||||
z := FTz^ - z0;
|
||||
|
||||
dist := sqr(x) + sqr(y) + sqr(z) + 1E-30;
|
||||
|
||||
FPx^ := FPx^ + vvar * (r2 * x / dist + x0);
|
||||
FPy^ := FPy^ + vvar * (r2 * y / dist + y0);
|
||||
FPz^ := FPz^ + vvar * (r2 * z / dist + z0);
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
constructor TVariationInversion3D.Create;
|
||||
begin
|
||||
r := 1;
|
||||
x0 := 0;
|
||||
y0 := 0;
|
||||
z0 := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationInversion3D.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationInversion3D.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationInversion3D.GetName: string;
|
||||
begin
|
||||
Result := 'inversion3D';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationInversion3D.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index of
|
||||
0: Result := sr;
|
||||
1: Result := sx0;
|
||||
2: Result := sy0;
|
||||
3: Result := sz0;
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationInversion3D.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = sr then begin
|
||||
if (Value < 1E-6) then Value := 1E-6;
|
||||
r := value;
|
||||
Result := True;
|
||||
end else if Name = sx0 then begin
|
||||
x0 := Value;
|
||||
Result := True;
|
||||
end else if Name = sy0 then begin
|
||||
y0 := Value;
|
||||
Result := True;
|
||||
end else if Name = sz0 then begin
|
||||
z0 := Value;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationInversion3D.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = sr then begin
|
||||
r := 1;
|
||||
Result := True;
|
||||
end else if Name = sx0 then begin
|
||||
x0 := 0;
|
||||
Result := True;
|
||||
end else if Name = sy0 then begin
|
||||
y0 := 0;
|
||||
Result := True;
|
||||
end else if Name = sz0 then begin
|
||||
z0 := 0;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
function TVariationInversion3D.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 4;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationInversion3D.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = sr then begin
|
||||
Value := r;
|
||||
Result := True;
|
||||
end else if Name = sx0 then begin
|
||||
Value := x0;
|
||||
Result := True;
|
||||
end else if Name = sy0 then begin
|
||||
Value := y0;
|
||||
Result := True;
|
||||
end else if Name = sz0 then begin
|
||||
Value := z0;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationInversion3D), true, false);
|
||||
end.
|
||||
237
Variations/varJulia.pas
Normal file
237
Variations/varJulia.pas
Normal file
@ -0,0 +1,237 @@
|
||||
{ Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina }
|
||||
|
||||
unit varJulia;
|
||||
|
||||
interface
|
||||
uses
|
||||
{$ifdef Apo7X64}
|
||||
{$else}
|
||||
AsmRandom,
|
||||
{$endif}
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
{$ifdef Apo7X64}
|
||||
{$else}
|
||||
{$define _ASM_}
|
||||
{$endif}
|
||||
|
||||
type
|
||||
TVariationJulia = class(TBaseVariation)
|
||||
private
|
||||
old: byte;
|
||||
vvar2: double;
|
||||
procedure CalcPlugin;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const IndJulia: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
////////////////////////
|
||||
procedure TVariationJulia.Prepare;
|
||||
begin
|
||||
vvar2 := vvar * sqrt(2) * 0.5;
|
||||
end;
|
||||
|
||||
procedure TVariationJulia.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
if old = 1 then f := CalcFunction
|
||||
else f := CalcPlugin;
|
||||
end;
|
||||
|
||||
procedure TVariationJulia.CalcFunction;
|
||||
{$ifndef _ASM_}
|
||||
var
|
||||
r: double;
|
||||
begin
|
||||
(*
|
||||
// AV: oriiginal code was:
|
||||
|
||||
FAngle := arctan2(FTx^, FTy^) / 2;
|
||||
SinCos(FAngle + pi * random(2), sina, cosa);
|
||||
r := vvar * sqrt(sqrt(sqrt(sqr(FTx^) + sqr(FTy^)));
|
||||
FPx^ := FPx^ + r * cosa;
|
||||
FPy^ := FPy^ + r * sina;
|
||||
|
||||
// AV: I simplified calculations
|
||||
*)
|
||||
|
||||
r := sqrt(sqrt(sqr(FTx^) + sqr(FTy^)) + FTy^ );
|
||||
|
||||
if random(2) = 0 then begin
|
||||
FPx^ := FPx^ + vvar2 * r;
|
||||
FPy^ := FPy^ + vvar2 / r * FTx^;
|
||||
end
|
||||
else begin
|
||||
FPx^ := FPx^ - vvar2 * r;
|
||||
FPy^ := FPy^ - vvar2 / r * FTx^;
|
||||
end;
|
||||
{$else}
|
||||
asm
|
||||
mov edx, [eax + FTx]
|
||||
fld qword ptr [edx] // FTx
|
||||
fld qword ptr [edx + 8] // FTy
|
||||
fld st(1) // FTx
|
||||
fmul st,st // sqr(FTx)
|
||||
fld st(1) // FTy
|
||||
fmul st,st // sqr(FTy)
|
||||
faddp
|
||||
fsqrt
|
||||
faddp
|
||||
fsqrt
|
||||
|
||||
fld qword ptr [eax + vvar2]
|
||||
mov ecx,eax
|
||||
mov eax,2
|
||||
call AsmRandInt
|
||||
shr eax,1
|
||||
jc @skip
|
||||
fchs
|
||||
@skip:
|
||||
|
||||
fmul st(2),st
|
||||
fmul st,st(1)
|
||||
|
||||
mov edx, [ecx + FPx]
|
||||
fadd qword ptr [edx]
|
||||
fstp qword ptr [edx]
|
||||
fdivp st(1),st
|
||||
fadd qword ptr [edx + 8]
|
||||
fstp qword ptr [edx + 8]
|
||||
fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TVariationJulia.CalcPlugin;
|
||||
{$ifndef _ASM_}
|
||||
var
|
||||
r: double;
|
||||
begin
|
||||
r := sqrt(sqrt(sqr(FTx^) + sqr(FTy^)) + FTx^ );
|
||||
|
||||
if random(2) = 0 then begin
|
||||
FPx^ := FPx^ + vvar2 * r;
|
||||
FPy^ := FPy^ + vvar2 / r * FTy^;
|
||||
end
|
||||
else begin
|
||||
FPx^ := FPx^ - vvar2 * r;
|
||||
FPy^ := FPy^ - vvar2 / r * FTy^;
|
||||
end;
|
||||
{$else}
|
||||
asm
|
||||
mov edx, [eax + FTx]
|
||||
fld qword ptr [edx + 8] // FTy
|
||||
fld qword ptr [edx] // FTx
|
||||
fld st(1)
|
||||
fmul st,st
|
||||
fld st(1)
|
||||
fmul st,st
|
||||
faddp
|
||||
fsqrt
|
||||
faddp
|
||||
fsqrt
|
||||
|
||||
fld qword ptr [eax + vvar2]
|
||||
mov ecx,eax
|
||||
mov eax,2
|
||||
call AsmRandInt
|
||||
shr eax,1
|
||||
jc @skip
|
||||
fchs
|
||||
@skip:
|
||||
|
||||
fmul st(2),st
|
||||
fmul st,st(1)
|
||||
|
||||
mov edx, [ecx + FPx]
|
||||
fadd qword ptr [edx]
|
||||
fstp qword ptr [edx]
|
||||
fdivp st(1),st
|
||||
fadd qword ptr [edx + 8]
|
||||
fstp qword ptr [edx + 8]
|
||||
fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
constructor TVariationJulia.Create;
|
||||
begin
|
||||
old := 1;
|
||||
end;
|
||||
|
||||
class function TVariationJulia.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationJulia.Create;
|
||||
end;
|
||||
|
||||
class function TVariationJulia.GetName: string;
|
||||
begin
|
||||
Result := 'julia';
|
||||
end;
|
||||
|
||||
function TVariationJulia.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 1;
|
||||
end;
|
||||
|
||||
function TVariationJulia.GetVariable(const Name: string;
|
||||
var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'julia_old' then begin
|
||||
value := old;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationJulia.GetVariableNameAt(const IndJulia: integer): string;
|
||||
begin
|
||||
case IndJulia of
|
||||
0: Result := 'julia_old';
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationJulia.SetVariable(const Name: string;
|
||||
var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'julia_old' then begin
|
||||
if Value < 0 then Value := 0;
|
||||
if Value > 1 then Value := 1;
|
||||
old := Round(value);
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationJulia.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'julia_old' then begin
|
||||
old := 1;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
//////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationJulia), false, false);
|
||||
|
||||
end.
|
||||
462
Variations/varJulia3Djf.pas
Normal file
462
Variations/varJulia3Djf.pas
Normal file
@ -0,0 +1,462 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varJulia3Djf; // original variation code by Joel Faber, modified & optimized by Peter Sdobnov
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
{$ifdef Apo7X64}
|
||||
{$else}
|
||||
AsmRandom,
|
||||
{$endif}
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
const
|
||||
var_name = 'julia3D';
|
||||
var_n_name='julia3D_power';
|
||||
|
||||
{$ifdef Apo7X64}
|
||||
{$else}
|
||||
{$define _ASM_}
|
||||
{$endif}
|
||||
|
||||
type
|
||||
TVariationJulia3DJF = class(TBaseVariation)
|
||||
private
|
||||
N: integer;
|
||||
|
||||
absN: integer;
|
||||
cN: double;
|
||||
|
||||
procedure CalcPower1;
|
||||
procedure CalcPowerMinus1;
|
||||
procedure CalcPower2;
|
||||
procedure CalcPowerMinus2;
|
||||
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
// TVariationJulia3DJF
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationJulia3DJF.Create;
|
||||
begin
|
||||
N := random(5) + 2;
|
||||
if random(2) = 0 then N := -N;
|
||||
end;
|
||||
|
||||
procedure TVariationJulia3DJF.Prepare;
|
||||
begin
|
||||
absN := abs(N);
|
||||
cN := (1/N - 1) / 2;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationJulia3DJF.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
if N = 2 then f := CalcPower2
|
||||
else if N = -2 then f := CalcPowerMinus2
|
||||
else if N = 1 then f := CalcPower1
|
||||
else if N = -1 then f := CalcPowerMinus1
|
||||
else f := CalcFunction;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationJulia3DJF.CalcFunction;
|
||||
{$ifndef _ASM_}
|
||||
var
|
||||
r, r2d, z, tmp: double;
|
||||
sina, cosa: extended;
|
||||
begin
|
||||
z := FTz^ / absN;
|
||||
r2d := sqr(FTx^) + sqr(FTy^);
|
||||
r := vvar * Math.Power(r2d + sqr(z), cN); // r^n / sqrt(r) --> r^(n-0.5)
|
||||
|
||||
FPz^ := FPz^ + r * z;
|
||||
|
||||
tmp := r * sqrt(r2d);
|
||||
sincos((arctan2(FTy^, FTx^) + 2*pi*random(absN)) / N, sina, cosa);
|
||||
|
||||
FPx^ := FPx^ + tmp * cosa;
|
||||
FPy^ := FPy^ + tmp * sina;
|
||||
{$else}
|
||||
asm
|
||||
mov edx, [eax + FTx]
|
||||
fld qword ptr [edx + 32] // FTz
|
||||
fidiv dword ptr [eax + absN]
|
||||
fld qword ptr [edx] // FTx
|
||||
fld qword ptr [edx + 8] // FTy
|
||||
fld st(1)
|
||||
fmul st, st
|
||||
fld st(1)
|
||||
fmul st, st
|
||||
faddp
|
||||
fld qword ptr [eax + cN]
|
||||
fld st(4)
|
||||
fmul st, st
|
||||
fadd st, st(2)
|
||||
// --- x^y = 2^(y*log2(x))
|
||||
fyl2x
|
||||
fld st
|
||||
frndint
|
||||
fsub st(1), st
|
||||
fxch st(1)
|
||||
f2xm1
|
||||
fld1
|
||||
fadd
|
||||
fscale
|
||||
fstp st(1)
|
||||
// ---
|
||||
fmul qword ptr [eax + vvar]
|
||||
|
||||
fmul st(4), st
|
||||
fxch st(1)
|
||||
fsqrt
|
||||
fmulp
|
||||
|
||||
fxch st(2)
|
||||
fpatan
|
||||
mov ecx, eax
|
||||
mov eax, dword ptr [eax + absN]
|
||||
call AsmRandInt
|
||||
push eax
|
||||
fild dword ptr [esp]
|
||||
add esp, 4
|
||||
fldpi
|
||||
fadd st, st
|
||||
fmulp
|
||||
faddp
|
||||
fidiv dword ptr [ecx + N]
|
||||
|
||||
fsincos
|
||||
mov edx, [ecx + FPx]
|
||||
fmul st, st(2)
|
||||
fadd qword ptr [edx] // FPx
|
||||
fstp qword ptr [edx]
|
||||
fmulp
|
||||
fadd qword ptr [edx + 8] // FPy
|
||||
fstp qword ptr [edx + 8]
|
||||
fadd qword ptr [edx + $18] // FPz
|
||||
fstp qword ptr [edx + $18]
|
||||
fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TVariationJulia3DJF.CalcPower2;
|
||||
{$ifndef _ASM_}
|
||||
var
|
||||
r, r2d, z, tmp: double;
|
||||
sina, cosa: extended;
|
||||
begin
|
||||
z := FTz^ / 2;
|
||||
r2d := sqr(FTx^) + sqr(FTy^);
|
||||
r := vvar / sqrt(sqrt(r2d + sqr(z))); // vvar * sqrt(r3d) / r3d --> vvar / sqrt(r3d)
|
||||
|
||||
FPz^ := FPz^ + r * z;
|
||||
|
||||
tmp := r * sqrt(r2d);
|
||||
sincos(arctan2(FTy^, FTx^) / 2 + pi*random(2), sina, cosa);
|
||||
|
||||
FPx^ := FPx^ + tmp * cosa;
|
||||
FPy^ := FPy^ + tmp * sina;
|
||||
{$else}
|
||||
asm
|
||||
mov edx, [eax + FTx]
|
||||
fld qword ptr [edx + 32] // FTz
|
||||
fld1
|
||||
fadd st, st
|
||||
fdiv st(1), st
|
||||
fld qword ptr [edx + 8] // FTy
|
||||
fld qword ptr [edx] // FTx
|
||||
fld st(1)
|
||||
fld st(1)
|
||||
fpatan
|
||||
fdivrp st(3), st
|
||||
|
||||
fmul st, st
|
||||
fxch st(1)
|
||||
fmul st, st
|
||||
faddp
|
||||
fld st(2)
|
||||
fmul st, st
|
||||
fadd st, st(1)
|
||||
fsqrt
|
||||
fsqrt
|
||||
fdivr qword ptr [eax + vvar]
|
||||
fmul st(3), st
|
||||
|
||||
fxch st(1)
|
||||
fsqrt
|
||||
fmulp
|
||||
fxch st(1)
|
||||
|
||||
mov ecx, eax
|
||||
mov eax, 2
|
||||
call AsmRandInt
|
||||
fldpi
|
||||
push eax
|
||||
fimul dword ptr [esp]
|
||||
add esp, 4
|
||||
faddp
|
||||
|
||||
fsincos
|
||||
mov edx, [ecx + FPx]
|
||||
fmul st, st(2)
|
||||
fadd qword ptr [edx] // FPx
|
||||
fstp qword ptr [edx]
|
||||
fmulp
|
||||
fadd qword ptr [edx + 8] // FPy
|
||||
fstp qword ptr [edx + 8]
|
||||
fadd qword ptr [edx + $18] // FPz
|
||||
fstp qword ptr [edx + $18]
|
||||
fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TVariationJulia3DJF.CalcPowerMinus2;
|
||||
{$ifndef _ASM_}
|
||||
var
|
||||
r, r2d, r3d, z, tmp: double;
|
||||
sina, cosa: extended;
|
||||
begin
|
||||
z := FTz^ / 2;
|
||||
r2d := sqr(FTx^) + sqr(FTy^);
|
||||
r3d := sqrt(r2d + sqr(z));
|
||||
r := vvar / (sqrt(r3d) * r3d);
|
||||
|
||||
FPz^ := FPz^ + r * z;
|
||||
|
||||
tmp := r * sqrt(r2d);
|
||||
sincos(arctan2(FTy^, FTx^) / 2 + pi*random(2), sina, cosa);
|
||||
|
||||
FPx^ := FPx^ + tmp * cosa;
|
||||
FPy^ := FPy^ - tmp * sina;
|
||||
{$else}
|
||||
asm
|
||||
mov edx, [eax + FTx]
|
||||
fld qword ptr [edx + 32] // FTz
|
||||
fld1
|
||||
fadd st, st
|
||||
fdiv st(1), st
|
||||
fld qword ptr [edx + 8] // FTy
|
||||
fld qword ptr [edx] // FTx
|
||||
fld st(1)
|
||||
fld st(1)
|
||||
fpatan
|
||||
fdivrp st(3), st
|
||||
|
||||
fmul st, st
|
||||
fxch st(1)
|
||||
fmul st, st
|
||||
faddp
|
||||
fld st(2)
|
||||
fmul st, st
|
||||
fadd st, st(1)
|
||||
fsqrt
|
||||
fld st
|
||||
fsqrt
|
||||
fmulp
|
||||
fdivr qword ptr [eax + vvar]
|
||||
fmul st(3), st
|
||||
|
||||
fxch st(1)
|
||||
fsqrt
|
||||
fmulp
|
||||
fxch st(1)
|
||||
|
||||
mov ecx, eax
|
||||
mov eax, 2
|
||||
call AsmRandInt
|
||||
fldpi
|
||||
push eax
|
||||
fimul dword ptr [esp]
|
||||
add esp, 4
|
||||
faddp
|
||||
|
||||
fsincos
|
||||
mov edx, [ecx + FPx]
|
||||
fmul st, st(2)
|
||||
fadd qword ptr [edx] // FPx
|
||||
fstp qword ptr [edx]
|
||||
fmulp
|
||||
fsubr qword ptr [edx + 8] // FPy
|
||||
fstp qword ptr [edx + 8]
|
||||
fadd qword ptr [edx + $18] // FPz
|
||||
fstp qword ptr [edx + $18]
|
||||
fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TVariationJulia3DJF.CalcPower1;
|
||||
{$ifndef _ASM_}
|
||||
begin
|
||||
FPx^ := FPx^ + vvar * FTx^;
|
||||
FPy^ := FPy^ + vvar * FTy^;
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
{$else}
|
||||
asm
|
||||
fld qword ptr [eax + vvar]
|
||||
mov edx, [eax + FTx]
|
||||
fld qword ptr [edx] // FTx
|
||||
fmul st, st(1)
|
||||
fadd qword ptr [edx + 16] // FPx
|
||||
fstp qword ptr [edx + 16]
|
||||
|
||||
fld qword ptr [edx + 8] // FTy
|
||||
fmul st, st(1)
|
||||
fadd qword ptr [edx + 24] // FPy
|
||||
fstp qword ptr [edx + 24]
|
||||
|
||||
fmul qword ptr [edx + 32] // FTz
|
||||
fadd qword ptr [edx + 40] // FPz
|
||||
fstp qword ptr [edx + 40]
|
||||
|
||||
fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TVariationJulia3DJF.CalcPowerMinus1;
|
||||
{$ifndef _ASM_}
|
||||
var
|
||||
r: double;
|
||||
begin
|
||||
r := vvar / (sqr(FTx^) + sqr(FTy^) + sqr(FTz^));
|
||||
|
||||
FPx^ := FPx^ + r * FTx^;
|
||||
FPy^ := FPy^ - r * FTy^;
|
||||
FPz^ := FPz^ + r * FTz^;
|
||||
{$else}
|
||||
asm
|
||||
mov edx, [eax + FTx]
|
||||
fld qword ptr [edx + 32] // FTz
|
||||
fld qword ptr [edx + 8] // FTy
|
||||
fld qword ptr [edx] // FTx
|
||||
fld st(2)
|
||||
fmul st, st
|
||||
fld st(2)
|
||||
fmul st, st
|
||||
faddp
|
||||
fld st(1)
|
||||
fmul st, st
|
||||
faddp
|
||||
fdivr qword ptr [eax + vvar]
|
||||
|
||||
fmul st(3), st
|
||||
fmul st(2), st
|
||||
fmulp
|
||||
fadd qword ptr [edx + 16] // FPx
|
||||
fstp qword ptr [edx + 16]
|
||||
fsubr qword ptr [edx + 24] // FPy
|
||||
fstp qword ptr [edx + 24]
|
||||
fadd qword ptr [edx + 40] // FPz
|
||||
fstp qword ptr [edx + 40]
|
||||
fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationJulia3DJF.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationJulia3DJF.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationJulia3DJF.GetName: string;
|
||||
begin
|
||||
Result := var_name;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationJulia3DJF.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index of
|
||||
0: Result := var_n_name;
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationJulia3DJF.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = var_n_name then begin
|
||||
N := Round(Value);
|
||||
if N = 0 then N := 1;
|
||||
Value := N;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationJulia3DJF.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = var_n_name then begin
|
||||
if N = 2 then N := -2
|
||||
else N := 2;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationJulia3DJF.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 1;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationJulia3DJF.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = var_n_name then begin
|
||||
Value := N;
|
||||
Result := true;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationJulia3DJF), true, false);
|
||||
end.
|
||||
|
||||
445
Variations/varJulia3Dz.pas
Normal file
445
Variations/varJulia3Dz.pas
Normal file
@ -0,0 +1,445 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varJulia3Dz;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
{$ifdef Apo7X64}
|
||||
{$else}
|
||||
AsmRandom,
|
||||
{$endif}
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
const
|
||||
var_name = 'julia3Dz';
|
||||
var_n_name='julia3Dz_power';
|
||||
|
||||
{$ifdef Apo7X64}
|
||||
{$else}
|
||||
{$define _ASM_}
|
||||
{$endif}
|
||||
|
||||
type
|
||||
TVariationJulia3D = class(TBaseVariation)
|
||||
private
|
||||
N: integer;
|
||||
|
||||
absN: integer;
|
||||
cN: double;
|
||||
|
||||
procedure CalcPower1;
|
||||
procedure CalcPowerMinus1;
|
||||
procedure CalcPower2;
|
||||
procedure CalcPowerMinus2;
|
||||
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
// TVariationJulia3D
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationJulia3D.Create;
|
||||
begin
|
||||
N := random(5) + 2;
|
||||
if random(2) = 0 then N := -N;
|
||||
end;
|
||||
|
||||
procedure TVariationJulia3D.Prepare;
|
||||
begin
|
||||
absN := abs(N);
|
||||
cN := 1 / N / 2;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationJulia3D.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
if N = 2 then f := CalcPower2
|
||||
else if N = -2 then f := CalcPowerMinus2
|
||||
else if N = 1 then f := CalcPower1
|
||||
else if N = -1 then f := CalcPowerMinus1
|
||||
else f := CalcFunction;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationJulia3D.CalcFunction;
|
||||
{$ifndef _ASM_}
|
||||
var
|
||||
r, r2d: double;
|
||||
sina, cosa: extended;
|
||||
begin
|
||||
r2d := sqr(FTx^) + sqr(FTy^);
|
||||
r := vvar * Math.Power(r2d, cN);
|
||||
|
||||
FPz^ := FPz^ + r * FTz^ / (sqrt(r2d) * absN);
|
||||
|
||||
sincos((arctan2(FTy^, FTx^) + 2*pi*random(absN)) / N, sina, cosa);
|
||||
FPx^ := FPx^ + r * cosa;
|
||||
FPy^ := FPy^ + r * sina;
|
||||
{$else}
|
||||
asm
|
||||
mov edx, [eax + FTx]
|
||||
fld qword ptr [edx] // FTx
|
||||
fld qword ptr [edx + 8] // FTy
|
||||
fld st(1)
|
||||
fmul st, st
|
||||
fld st(1)
|
||||
fmul st, st
|
||||
faddp
|
||||
fld qword ptr [eax + cN]
|
||||
fld st(1)
|
||||
// --- x^y = 2^(y*log2(x))
|
||||
fyl2x
|
||||
fld st
|
||||
frndint
|
||||
fsub st(1), st
|
||||
fxch st(1)
|
||||
f2xm1
|
||||
fld1
|
||||
fadd
|
||||
fscale
|
||||
fstp st(1)
|
||||
// ---
|
||||
fmul qword ptr [eax + vvar]
|
||||
|
||||
fxch st(1)
|
||||
fsqrt
|
||||
fimul dword ptr [eax + absN]
|
||||
fdivr st, st(1)
|
||||
fmul qword ptr [edx + 32] // FTz
|
||||
fadd qword ptr [edx + 40] // FPz
|
||||
fstp qword ptr [edx + 40]
|
||||
|
||||
fxch st(2)
|
||||
fpatan
|
||||
mov ecx, eax
|
||||
mov eax, dword ptr [eax + absN]
|
||||
call AsmRandInt
|
||||
push eax
|
||||
fild dword ptr [esp]
|
||||
add esp, 4
|
||||
fldpi
|
||||
fadd st, st
|
||||
fmulp
|
||||
faddp
|
||||
fidiv dword ptr [ecx + N]
|
||||
|
||||
fsincos
|
||||
fmul st, st(2)
|
||||
|
||||
mov edx, [ecx + FPx]
|
||||
fadd qword ptr [edx] // FPx
|
||||
fstp qword ptr [edx]
|
||||
fmulp
|
||||
fadd qword ptr [edx + 8] // FPy
|
||||
fstp qword ptr [edx + 8]
|
||||
fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TVariationJulia3D.CalcPower2;
|
||||
{$ifndef _ASM_}
|
||||
var
|
||||
r, r2d: double;
|
||||
sina, cosa: extended;
|
||||
begin
|
||||
r2d := sqrt(sqr(FTx^) + sqr(FTy^));
|
||||
r := vvar * sqrt(r2d);
|
||||
|
||||
FPz^ := FPz^ + r * FTz^ / r2d / 2;
|
||||
|
||||
sincos((arctan2(FTy^, FTx^)/2 + pi*random(2)), sina, cosa);
|
||||
FPx^ := FPx^ + r * cosa;
|
||||
FPy^ := FPy^ + r * sina;
|
||||
{$else}
|
||||
asm
|
||||
mov edx, [eax + FTx]
|
||||
fld qword ptr [edx + 8] // FTy
|
||||
fld qword ptr [edx] // FTx
|
||||
fld st(1)
|
||||
fld st(1)
|
||||
fpatan
|
||||
fld1
|
||||
fadd st, st
|
||||
fdivp st(1), st
|
||||
mov ecx, eax
|
||||
mov eax, 2
|
||||
call AsmRandInt
|
||||
fldpi
|
||||
push eax
|
||||
fimul dword ptr [esp]
|
||||
add esp, 4
|
||||
faddp
|
||||
|
||||
fxch st(2)
|
||||
fmul st, st
|
||||
fxch st(1)
|
||||
fmul st, st
|
||||
faddp
|
||||
fsqrt
|
||||
|
||||
fld st
|
||||
|
||||
fsqrt
|
||||
fmul qword ptr [ecx + vvar]
|
||||
|
||||
fxch st(1)
|
||||
fadd st, st
|
||||
fdivr st, st(1)
|
||||
|
||||
mov edx, [ecx + FPx]
|
||||
fmul qword ptr [edx + $10] // FTz
|
||||
fadd qword ptr [edx + $18] // FPz
|
||||
fstp qword ptr [edx + $18]
|
||||
|
||||
fxch st(1)
|
||||
|
||||
fsincos
|
||||
|
||||
fmul st, st(2)
|
||||
fadd qword ptr [edx] // FPx
|
||||
fstp qword ptr [edx]
|
||||
fmulp
|
||||
fadd qword ptr [edx + 8] // FPy
|
||||
fstp qword ptr [edx + 8]
|
||||
fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TVariationJulia3D.CalcPowerMinus2;
|
||||
{$ifndef _ASM_}
|
||||
var
|
||||
r, r2d: double;
|
||||
sina, cosa: extended;
|
||||
begin
|
||||
r2d := sqrt(sqr(FTx^) + sqr(FTy^));
|
||||
r := vvar / sqrt(r2d);
|
||||
|
||||
FPz^ := FPz^ + r * FTz^ / r2d / 2;
|
||||
|
||||
sincos(pi*random(2) - arctan2(FTy^, FTx^)/2, sina, cosa);
|
||||
FPx^ := FPx^ + r * cosa;
|
||||
FPy^ := FPy^ + r * sina;
|
||||
{$else}
|
||||
asm
|
||||
mov edx, [eax + FTx]
|
||||
fld qword ptr [edx + 8] // FTy
|
||||
fld qword ptr [edx] // FTx
|
||||
fld st(1)
|
||||
fld st(1)
|
||||
fpatan
|
||||
fld1
|
||||
fadd st, st
|
||||
fdivp st(1), st
|
||||
mov ecx, eax
|
||||
mov eax, 2
|
||||
call AsmRandInt
|
||||
fldpi
|
||||
push eax
|
||||
fimul dword ptr [esp]
|
||||
add esp, 4
|
||||
faddp
|
||||
|
||||
fxch st(2)
|
||||
fmul st, st
|
||||
fxch st(1)
|
||||
fmul st, st
|
||||
faddp
|
||||
fsqrt
|
||||
|
||||
fld st
|
||||
|
||||
fsqrt
|
||||
fdivr qword ptr [ecx + vvar]
|
||||
|
||||
fxch st(1)
|
||||
fadd st, st
|
||||
fdivr st, st(1)
|
||||
mov edx, [ecx + FPx]
|
||||
fmul qword ptr [edx + $10] // FTz
|
||||
fadd qword ptr [edx + $18]
|
||||
fstp qword ptr [edx + $18]
|
||||
|
||||
fxch st(1)
|
||||
fsincos
|
||||
|
||||
fmul st, st(2)
|
||||
mov edx, [ecx + FPx]
|
||||
fadd qword ptr [edx] // FPx
|
||||
fstp qword ptr [edx]
|
||||
fmulp
|
||||
fsubr qword ptr [edx + 8] // FPy
|
||||
fstp qword ptr [edx + 8]
|
||||
fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TVariationJulia3D.CalcPower1;
|
||||
{$ifndef _ASM_}
|
||||
begin
|
||||
FPx^ := FPx^ + vvar * FTx^;
|
||||
FPy^ := FPy^ + vvar * FTy^;
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
{$else}
|
||||
asm
|
||||
fld qword ptr [eax + vvar]
|
||||
mov edx, [eax + FTx]
|
||||
fld qword ptr [edx] // FTx
|
||||
fmul st, st(1)
|
||||
fadd qword ptr [edx + 16] // FPx
|
||||
fstp qword ptr [edx + 16]
|
||||
|
||||
fld qword ptr [edx + 8] // FTy
|
||||
fmul st, st(1)
|
||||
fadd qword ptr [edx + 24] // FPy
|
||||
fstp qword ptr [edx + 24]
|
||||
|
||||
fmul qword ptr [edx + 32] // FTz
|
||||
fadd qword ptr [edx + 40] // FPz
|
||||
fstp qword ptr [edx + 40]
|
||||
|
||||
fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TVariationJulia3D.CalcPowerMinus1;
|
||||
{$ifndef _ASM_}
|
||||
var
|
||||
r: double;
|
||||
begin
|
||||
r := vvar / (sqr(FTx^) + sqr(FTy^));
|
||||
|
||||
FPx^ := FPx^ + r * FTx^;
|
||||
FPy^ := FPy^ - r * FTy^;
|
||||
FPz^ := FPz^ + r * FTz^;
|
||||
{$else}
|
||||
asm
|
||||
mov edx, [eax + FTx]
|
||||
fld qword ptr [edx + 8] // FTy
|
||||
fld qword ptr [edx] // FTx
|
||||
fld st(1)
|
||||
fmul st, st
|
||||
fld st(1)
|
||||
fmul st, st
|
||||
faddp
|
||||
fdivr qword ptr [eax + vvar]
|
||||
|
||||
fmul st(2), st
|
||||
fmul st(1), st
|
||||
fmul qword ptr [edx + 32] // FTz
|
||||
fadd qword ptr [edx + 40] // FPz
|
||||
fstp qword ptr [edx + 40]
|
||||
|
||||
fadd qword ptr [edx + 16] // FPx
|
||||
fstp qword ptr [edx + 16]
|
||||
fsubr qword ptr [edx + 24] // FPy
|
||||
fstp qword ptr [edx + 24]
|
||||
fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationJulia3D.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationJulia3D.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationJulia3D.GetName: string;
|
||||
begin
|
||||
Result := var_name;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationJulia3D.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index of
|
||||
0: Result := var_n_name;
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationJulia3D.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = var_n_name then begin
|
||||
N := Round(Value);
|
||||
if N = 0 then N := 1;
|
||||
Value := N;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationJulia3D.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = var_n_name then begin
|
||||
if N = 2 then N := -2
|
||||
else N := 2;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationJulia3D.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 1;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationJulia3D.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = var_n_name then begin
|
||||
Value := N;
|
||||
Result := true;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationJulia3D), true, false);
|
||||
end.
|
||||
432
Variations/varJuliaN.pas
Normal file
432
Variations/varJuliaN.pas
Normal file
@ -0,0 +1,432 @@
|
||||
unit varJuliaN;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
{$ifdef Apo7X64}
|
||||
{$else}
|
||||
AsmRandom,
|
||||
{$endif}
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
const
|
||||
var_name = 'julian';
|
||||
var_n_name='julian_power';
|
||||
var_c_name='julian_dist';
|
||||
|
||||
{$ifdef Apo7X64}
|
||||
{$else}
|
||||
{$define _ASM_}
|
||||
{$endif}
|
||||
|
||||
type
|
||||
TVariationJulian = class(TBaseVariation)
|
||||
private
|
||||
N: integer;
|
||||
c: double;
|
||||
|
||||
absN: integer;
|
||||
cN, vvar2: double;
|
||||
|
||||
procedure CalcPower1;
|
||||
procedure CalcPowerMinus1;
|
||||
procedure CalcPower2;
|
||||
procedure CalcPowerMinus2;
|
||||
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
// TVariationJulian
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationJulian.Create;
|
||||
begin
|
||||
N := random(5) + 2;
|
||||
c := 1.0;
|
||||
end;
|
||||
|
||||
procedure TVariationJulian.Prepare;
|
||||
begin
|
||||
absN := abs(N);
|
||||
cN := c / N / 2;
|
||||
|
||||
vvar2 := vvar * sqrt(2)/2;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationJulian.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
if c = 1 then begin
|
||||
if N = 2 then f := CalcPower2
|
||||
else if N = -2 then f := CalcPowerMinus2
|
||||
else if N = 1 then f := CalcPower1
|
||||
else if N = -1 then f := CalcPowerMinus1
|
||||
else f := CalcFunction;
|
||||
end
|
||||
else f := CalcFunction;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationJulian.CalcFunction;
|
||||
{$ifndef _ASM_}
|
||||
var
|
||||
r: double;
|
||||
sina, cosa: extended;
|
||||
begin
|
||||
sincos((arctan2(FTy^, FTx^) + 2 * pi * random(absN)) / N, sina, cosa);
|
||||
r := vvar * Math.Power(sqr(FTx^) + sqr(FTy^), cN);
|
||||
|
||||
FPx^ := FPx^ + r * cosa;
|
||||
FPy^ := FPy^ + r * sina;
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
{$else}
|
||||
const
|
||||
epsval: double = 1.0e-12;
|
||||
asm
|
||||
mov edx, [eax + FTx]
|
||||
// AV: for Apo7X.15C compatibility
|
||||
fld qword ptr [eax + vvar]
|
||||
fmul qword ptr [edx + 32] // FTz
|
||||
fadd qword ptr [edx + 40] // FPz
|
||||
fstp qword ptr [edx + 40]
|
||||
// main code
|
||||
fld qword ptr [edx] // FTx
|
||||
fld qword ptr [edx + 8] // FTy
|
||||
fld qword ptr [eax + cN]
|
||||
fld st(2)
|
||||
fmul st, st
|
||||
fld st(2)
|
||||
fmul st, st
|
||||
faddp
|
||||
// x^y = 2^(y*log2(x))
|
||||
// Add small value to prevent divide-by-zero error
|
||||
// in case x =(FTx^2+FTy^2) = 0
|
||||
fld epsval
|
||||
faddp st(1), st
|
||||
fyl2x
|
||||
fld st
|
||||
frndint
|
||||
fsub st(1), st
|
||||
fxch st(1)
|
||||
f2xm1
|
||||
fld1
|
||||
fadd
|
||||
fscale
|
||||
fstp st(1)
|
||||
|
||||
fmul qword ptr [eax + vvar]
|
||||
|
||||
fxch st(2)
|
||||
fpatan
|
||||
mov ecx, eax
|
||||
mov eax, dword ptr [eax + absN]
|
||||
call AsmRandInt
|
||||
push eax
|
||||
fild dword ptr [esp]
|
||||
add esp, 4
|
||||
fldpi
|
||||
fadd st, st
|
||||
fmulp
|
||||
faddp
|
||||
fidiv dword ptr [ecx + N]
|
||||
fsincos
|
||||
|
||||
fmul st, st(2)
|
||||
mov edx, [ecx + FPx]
|
||||
fadd qword ptr [edx] // FPx
|
||||
fstp qword ptr [edx]
|
||||
fmulp
|
||||
fadd qword ptr [edx + 8] // FPy
|
||||
fstp qword ptr [edx + 8]
|
||||
fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TVariationJulian.CalcPower2;
|
||||
{$ifndef _ASM_}
|
||||
var
|
||||
d: double;
|
||||
begin
|
||||
d := sqrt( sqrt(sqr(FTx^) + sqr(FTy^)) + FTx^ );
|
||||
|
||||
if random(2) = 0 then begin
|
||||
FPx^ := FPx^ + vvar2 * d;
|
||||
FPy^ := FPy^ + vvar2 / d * FTy^;
|
||||
end
|
||||
else begin
|
||||
FPx^ := FPx^ - vvar2 * d;
|
||||
FPy^ := FPy^ - vvar2 / d * FTy^;
|
||||
end;
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
{$else}
|
||||
asm
|
||||
mov edx, [eax + FTx]
|
||||
// AV: for Apo7X.15C compatibility
|
||||
fld qword ptr [eax + vvar]
|
||||
fmul qword ptr [edx + 32] // FTz
|
||||
fadd qword ptr [edx + 40] // FPz
|
||||
fstp qword ptr [edx + 40]
|
||||
// main code
|
||||
fld qword ptr [edx + 8] // FTy
|
||||
fld qword ptr [edx] // FTx
|
||||
fld st(1)
|
||||
fmul st,st
|
||||
fld st(1)
|
||||
fmul st,st
|
||||
faddp
|
||||
fsqrt
|
||||
faddp
|
||||
fsqrt
|
||||
|
||||
fld qword ptr [eax + vvar2]
|
||||
mov ecx,eax
|
||||
mov eax,2
|
||||
call AsmRandInt
|
||||
shr eax,1
|
||||
jc @skip
|
||||
fchs
|
||||
@skip:
|
||||
|
||||
fmul st(2),st
|
||||
fmul st,st(1)
|
||||
|
||||
mov edx, [ecx + FPx]
|
||||
fadd qword ptr [edx]
|
||||
fstp qword ptr [edx]
|
||||
fdivp st(1),st
|
||||
fadd qword ptr [edx + 8]
|
||||
fstp qword ptr [edx + 8]
|
||||
fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TVariationJulian.CalcPowerMinus2;
|
||||
{$ifndef _ASM_}
|
||||
var
|
||||
r, xd: double;
|
||||
begin
|
||||
r := sqrt(sqr(FTx^) + sqr(FTy^));
|
||||
xd := r + FTx^;
|
||||
|
||||
r := vvar / sqrt(r * (sqr(Fty^) + sqr(xd)) );
|
||||
|
||||
if random(2) = 0 then begin
|
||||
FPx^ := FPx^ + r * xd;
|
||||
FPy^ := FPy^ - r * FTy^;
|
||||
end
|
||||
else begin
|
||||
FPx^ := FPx^ - r * xd;
|
||||
FPy^ := FPy^ + r * FTy^;
|
||||
end;
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
{$else}
|
||||
asm
|
||||
mov edx, [eax + FTx]
|
||||
// AV: for Apo7X.15C compatibility
|
||||
fld qword ptr [eax + vvar]
|
||||
fmul qword ptr [edx + 32] // FTz
|
||||
fadd qword ptr [edx + 40] // FPz
|
||||
fstp qword ptr [edx + 40]
|
||||
// main code
|
||||
fld qword ptr [edx + 8]
|
||||
fld qword ptr [edx]
|
||||
fld st(1)
|
||||
fmul st,st
|
||||
fld st(1)
|
||||
fmul st,st
|
||||
faddp
|
||||
fsqrt
|
||||
fadd st(1),st
|
||||
fld st(1)
|
||||
fmul st,st
|
||||
fld st(3)
|
||||
fmul st,st
|
||||
faddp
|
||||
fmulp
|
||||
fsqrt
|
||||
|
||||
fdivr qword ptr [eax + vvar]
|
||||
|
||||
mov ecx,eax
|
||||
mov eax,2
|
||||
call AsmRandInt
|
||||
shr eax,1
|
||||
jc @skip
|
||||
fchs
|
||||
@skip:
|
||||
|
||||
fmul st(1),st
|
||||
fmulp st(2),st
|
||||
|
||||
mov edx, [ecx + FPx]
|
||||
fsubr qword ptr [edx]
|
||||
fstp qword ptr [edx]
|
||||
fadd qword ptr [edx + 8]
|
||||
fstp qword ptr [edx + 8]
|
||||
fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TVariationJulian.CalcPower1;
|
||||
{$ifndef _ASM_}
|
||||
begin
|
||||
FPx^ := FPx^ + vvar * FTx^;
|
||||
FPy^ := FPy^ + vvar * FTy^;
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
{$else}
|
||||
asm
|
||||
fld qword ptr [eax + vvar]
|
||||
mov edx, [eax + FTx]
|
||||
fld qword ptr [edx] // FTx
|
||||
fmul st, st(1)
|
||||
fadd qword ptr [edx + 16] // FPx
|
||||
fstp qword ptr [edx + 16]
|
||||
|
||||
fld qword ptr [edx + 8] // FTy
|
||||
fmul st, st(1)
|
||||
fadd qword ptr [edx + 24] // FPy
|
||||
fstp qword ptr [edx + 24]
|
||||
|
||||
fmul qword ptr [edx + 32] // FTz
|
||||
fadd qword ptr [edx + 40] // FPz
|
||||
fstp qword ptr [edx + 40]
|
||||
fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TVariationJulian.CalcPowerMinus1;
|
||||
{$ifndef _ASM_}
|
||||
var
|
||||
r: double;
|
||||
begin
|
||||
r := vvar / (sqr(FTx^) + sqr(FTy^));
|
||||
|
||||
FPx^ := FPx^ + r * FTx^;
|
||||
FPy^ := FPy^ - r * FTy^;
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
{$else}
|
||||
asm
|
||||
mov edx, [eax + FTx]
|
||||
// AV: for Apo7X.15C compatibility
|
||||
fld qword ptr [eax + vvar]
|
||||
fmul qword ptr [edx + 32] // FTz
|
||||
fadd qword ptr [edx + 40] // FPz
|
||||
fstp qword ptr [edx + 40]
|
||||
|
||||
// main code
|
||||
fld qword ptr [edx + 8] // FTy
|
||||
fld qword ptr [edx] // FTx
|
||||
fld st(1)
|
||||
fmul st, st
|
||||
fld st(1)
|
||||
fmul st, st
|
||||
faddp
|
||||
fdivr qword ptr [eax + vvar]
|
||||
fmul st(2), st
|
||||
fmulp
|
||||
fadd qword ptr [edx + 16] // FPx
|
||||
fstp qword ptr [edx + 16]
|
||||
fsubr qword ptr [edx + 24] // FPy
|
||||
fstp qword ptr [edx + 24]
|
||||
fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationJulian.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationJulian.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationJulian.GetName: string;
|
||||
begin
|
||||
Result := var_name;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationJulian.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index of
|
||||
0: Result := var_n_name;
|
||||
1: Result := var_c_name;
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationJulian.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = var_n_name then begin
|
||||
N := Round(Value);
|
||||
if N = 0 then N := 1;
|
||||
Value := N;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = var_c_name then begin
|
||||
c := value;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationJulian.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = var_n_name then begin
|
||||
if N = 2 then N := -2
|
||||
else N := 2;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = var_c_name then begin
|
||||
c := 1;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationJulian.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 2;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationJulian.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = var_n_name then begin
|
||||
Value := N;
|
||||
Result := true;
|
||||
end
|
||||
else if Name = var_c_name then begin
|
||||
Value := c;
|
||||
Result := true;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationJulian), true, false);
|
||||
end.
|
||||
|
||||
252
Variations/varJuliaN3Dx.pas
Normal file
252
Variations/varJuliaN3Dx.pas
Normal file
@ -0,0 +1,252 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varJuliaN3Dx;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
const
|
||||
j3power = 'julian3Dx_power';
|
||||
j3dist = 'julian3Dx_dist';
|
||||
j3a = 'julian3Dx_a';
|
||||
j3b = 'julian3Dx_b';
|
||||
j3c = 'julian3Dx_c';
|
||||
j3d = 'julian3Dx_d';
|
||||
j3e = 'julian3Dx_e';
|
||||
j3f = 'julian3Dx_f';
|
||||
|
||||
type
|
||||
TVariationJulian3Dx = class(TBaseVariation)
|
||||
private
|
||||
jdist, ja, jb, jc, jd, je, jf: double;
|
||||
jpower, absN: integer;
|
||||
cN, pi2: double;
|
||||
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationJulian3Dx }
|
||||
|
||||
{ Based on standart Julia3D by Joel Faber,
|
||||
with additional pre-affine parameters and JuliaN_dist variable }
|
||||
|
||||
//////////////////////////////////////////
|
||||
procedure TVariationJulian3Dx.Prepare;
|
||||
var ca, sa: double;
|
||||
begin
|
||||
absN := abs(jpower);
|
||||
cN := (jdist / jpower - 1.0) / 2.0;
|
||||
pi2 := pi * 2;
|
||||
end;
|
||||
|
||||
//////////////////////////////////////////
|
||||
procedure TVariationJulian3Dx.CalcFunction;
|
||||
var x, y, z, r, r2, alpha, sina, cosa: double;
|
||||
begin
|
||||
x := ja * FTx^ + jb * FTy^ + je;
|
||||
y := jc * FTx^ + jd * FTy^ + jf;
|
||||
z := FTz^ / absN;
|
||||
|
||||
r2 := sqr(x) + sqr(y); // AV: replaced FTx^ * FTx^ + FTy^ * FTy^;
|
||||
r := vvar * Math.power(r2 + z * z, cN);
|
||||
FPz^ := FPz^ + r * z;
|
||||
|
||||
alpha := (arctan2(y, x) + pi2 * random(absN))/ jpower;
|
||||
SinCos(alpha, sina, cosa);
|
||||
r := r * sqrt(r2);
|
||||
FPx^ := FPx^ + r * cosa;
|
||||
FPy^ := FPy^ + r * sina;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
constructor TVariationJulian3Dx.Create;
|
||||
begin
|
||||
jpower := 2 + random(5);
|
||||
jdist := 1;
|
||||
ja := 1;
|
||||
jb := 0;
|
||||
jc := 0;
|
||||
jd := 1;
|
||||
je := 0;
|
||||
jf := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationJulian3Dx.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationJulian3Dx.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationJulian3Dx.GetName: string;
|
||||
begin
|
||||
Result := 'julian3Dx';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationJulian3Dx.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index of
|
||||
0: Result := j3power;
|
||||
1: Result := j3dist;
|
||||
2: Result := j3a;
|
||||
3: Result := j3b;
|
||||
4: Result := j3c;
|
||||
5: Result := j3d;
|
||||
6: Result := j3e;
|
||||
7: Result := j3f;
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationJulian3Dx.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = j3power then begin
|
||||
jpower := Round(Value);
|
||||
if jpower = 0 then jpower := 1;
|
||||
Value := jpower;
|
||||
Result := True;
|
||||
end else if Name = j3dist then begin
|
||||
jdist := value;
|
||||
Result := True;
|
||||
end else if Name = j3a then begin
|
||||
ja := Value;
|
||||
Result := True;
|
||||
end else if Name = j3b then begin
|
||||
jb := Value;
|
||||
Result := True;
|
||||
end else if Name = j3c then begin
|
||||
jc := Value;
|
||||
Result := True;
|
||||
end else if Name = j3d then begin
|
||||
jd := Value;
|
||||
Result := True;
|
||||
end else if Name = j3e then begin
|
||||
je := Value;
|
||||
Result := True;
|
||||
end else if Name = j3f then begin
|
||||
jf := Value;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationJulian3Dx.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = j3power then begin
|
||||
jpower := 2;
|
||||
Result := True;
|
||||
end else if Name = j3dist then begin
|
||||
jdist := 1;
|
||||
Result := True;
|
||||
end else if Name = j3a then begin
|
||||
ja := 1;
|
||||
Result := True;
|
||||
end else if Name = j3b then begin
|
||||
jb := 0;
|
||||
Result := True;
|
||||
end else if Name = j3c then begin
|
||||
jc := 0;
|
||||
Result := True;
|
||||
end else if Name = j3d then begin
|
||||
jd := 1;
|
||||
Result := True;
|
||||
end else if Name = j3e then begin
|
||||
je := 0;
|
||||
Result := True;
|
||||
end else if Name = j3f then begin
|
||||
jf := 0;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
function TVariationJulian3Dx.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 8;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationJulian3Dx.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = j3power then begin
|
||||
Value := jpower;
|
||||
Result := True;
|
||||
end else if Name = j3dist then begin
|
||||
Value := jdist;
|
||||
Result := True;
|
||||
end else if Name = j3a then begin
|
||||
Value := ja;
|
||||
Result := True;
|
||||
end else if Name = j3b then begin
|
||||
Value := jb;
|
||||
Result := True;
|
||||
end else if Name = j3c then begin
|
||||
Value := jc;
|
||||
Result := True;
|
||||
end else if Name = j3d then begin
|
||||
Value := jd;
|
||||
Result := True;
|
||||
end else if Name = j3e then begin
|
||||
Value := je;
|
||||
Result := True;
|
||||
end else if Name = j3f then begin
|
||||
Value := jf;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationJulian3Dx), true, false);
|
||||
end.
|
||||
472
Variations/varJuliaScope.pas
Normal file
472
Variations/varJuliaScope.pas
Normal file
@ -0,0 +1,472 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varJuliaScope;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
{$ifdef Apo7X64}
|
||||
{$else}
|
||||
AsmRandom,
|
||||
{$endif}
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
const
|
||||
variation_name='juliascope';
|
||||
var_n_name='juliascope_power';
|
||||
var_c_name='juliascope_dist';
|
||||
|
||||
{$ifdef Apo7X64}
|
||||
{$else}
|
||||
{$define _ASM_}
|
||||
{$endif}
|
||||
|
||||
type
|
||||
TVariationJuliaScope = class(TBaseVariation)
|
||||
private
|
||||
N: integer;
|
||||
c: double;
|
||||
|
||||
rN: integer;
|
||||
cn: double;
|
||||
|
||||
procedure CalcPower1;
|
||||
procedure CalcPowerMinus1;
|
||||
procedure CalcPower2;
|
||||
procedure CalcPowerMinus2;
|
||||
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
math;
|
||||
|
||||
// TVariationJuliaScope
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationJuliaScope.Create;
|
||||
begin
|
||||
N := random(5) + 2;
|
||||
c := 1.0;
|
||||
end;
|
||||
|
||||
procedure TVariationJuliaScope.Prepare;
|
||||
begin
|
||||
rN := abs(N);
|
||||
cn := c / N / 2;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationJuliaScope.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
if c = 1 then begin
|
||||
if N = 2 then f := CalcPower2
|
||||
else if N = -2 then f := CalcPowerMinus2
|
||||
else if N = 1 then f := CalcPower1
|
||||
else if N = -1 then f := CalcPowerMinus1
|
||||
else f := CalcFunction;
|
||||
end
|
||||
else f := CalcFunction;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationJuliaScope.CalcFunction;
|
||||
{$ifndef _ASM_}
|
||||
var
|
||||
rnd: integer;
|
||||
r: double;
|
||||
sina, cosa: extended;
|
||||
begin
|
||||
rnd := random(rN);
|
||||
if (rnd and 1) = 0 then
|
||||
sincos( (2*pi*rnd + arctan2(FTy^, FTx^)) / N, sina, cosa)
|
||||
else
|
||||
sincos( (2*pi*rnd - arctan2(FTy^, FTx^)) / N, sina, cosa);
|
||||
r := vvar * Math.Power(sqr(FTx^) + sqr(FTy^), cn);
|
||||
FPx^ := FPx^ + r * cosa;
|
||||
FPy^ := FPy^ + r * sina;
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
{$else}
|
||||
asm
|
||||
mov edx, [eax + FTy]
|
||||
fld qword ptr [edx]
|
||||
fld qword ptr [eax + cn]
|
||||
mov edx, [eax + FTx]
|
||||
|
||||
// AV: for Apo7X.15C compatibility
|
||||
fld qword ptr [eax + vvar]
|
||||
fmul qword ptr [edx + 32] // FTz
|
||||
fadd qword ptr [edx + 40] // FPz
|
||||
fstp qword ptr [edx + 40]
|
||||
|
||||
// main code
|
||||
fld qword ptr [edx]
|
||||
fld st(2)
|
||||
fld st(1)
|
||||
fpatan
|
||||
mov ecx, eax
|
||||
mov eax, dword ptr [eax + rN]
|
||||
call AsmRandInt
|
||||
push eax
|
||||
|
||||
shr eax, 1
|
||||
jnc @even
|
||||
fchs
|
||||
@even:
|
||||
|
||||
fldpi
|
||||
fadd st, st
|
||||
fimul dword ptr [esp]
|
||||
add esp, 4
|
||||
faddp
|
||||
fidiv dword ptr [ecx + N]
|
||||
|
||||
fxch st(3)
|
||||
fmul st, st
|
||||
fxch st(1)
|
||||
fmul st, st
|
||||
faddp
|
||||
// --- x^y = 2^(y*log2(x))
|
||||
fyl2x
|
||||
fld st
|
||||
frndint
|
||||
fsub st(1), st
|
||||
fxch st(1)
|
||||
f2xm1
|
||||
fld1
|
||||
fadd
|
||||
fscale
|
||||
fstp st(1)
|
||||
|
||||
fmul qword ptr [ecx + vvar]
|
||||
fxch st(1)
|
||||
fsincos
|
||||
fmul st, st(2)
|
||||
|
||||
mov edx, [ecx + FPx]
|
||||
fadd qword ptr [edx]
|
||||
fstp qword ptr [edx]
|
||||
fmulp
|
||||
mov edx, [ecx + FPy]
|
||||
fadd qword ptr [edx]
|
||||
fstp qword ptr [edx]
|
||||
fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TVariationJuliaScope.CalcPower2;
|
||||
{$ifndef _ASM_}
|
||||
var
|
||||
r: double;
|
||||
sina, cosa: extended;
|
||||
begin
|
||||
if random(2) = 0 then
|
||||
sincos(arctan2(FTy^, FTx^)/2, sina, cosa)
|
||||
else
|
||||
sincos(pi - arctan2(FTy^, FTx^)/2, sina, cosa);
|
||||
|
||||
r := vvar * sqrt(sqrt(sqr(FTx^) + sqr(FTy^)));
|
||||
|
||||
FPx^ := FPx^ + r * cosa;
|
||||
FPy^ := FPy^ + r * sina;
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
{$else}
|
||||
asm
|
||||
mov edx, [eax + FTy]
|
||||
fld qword ptr [edx]
|
||||
mov edx, [eax + FTx]
|
||||
|
||||
// AV: for Apo7X.15C compatibility
|
||||
fld qword ptr [eax + vvar]
|
||||
fmul qword ptr [edx + 32] // FTz
|
||||
fadd qword ptr [edx + 40] // FPz
|
||||
fstp qword ptr [edx + 40]
|
||||
|
||||
// main code
|
||||
fld qword ptr [edx]
|
||||
fld st(1)
|
||||
fld st(1)
|
||||
fpatan
|
||||
fld1
|
||||
fadd st, st
|
||||
fdivp st(1), st
|
||||
mov ecx, eax
|
||||
call AsmRandInt
|
||||
|
||||
shr eax, 1
|
||||
jnc @skip
|
||||
fldpi
|
||||
fsubrp st(1), st
|
||||
@skip:
|
||||
fxch st(2)
|
||||
fmul st, st
|
||||
fxch st(1)
|
||||
fmul st, st
|
||||
faddp
|
||||
fsqrt
|
||||
fsqrt
|
||||
fmul qword ptr [ecx + vvar]
|
||||
fxch st(1)
|
||||
|
||||
fsincos
|
||||
|
||||
fmul st, st(2)
|
||||
mov edx, [ecx + FPx]
|
||||
fadd qword ptr [edx]
|
||||
fstp qword ptr [edx]
|
||||
fmulp
|
||||
mov edx, [ecx + FPy]
|
||||
fadd qword ptr [edx]
|
||||
fstp qword ptr [edx]
|
||||
fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TVariationJuliaScope.CalcPowerMinus2;
|
||||
{$ifndef _ASM_}
|
||||
var
|
||||
r: double;
|
||||
sina, cosa: extended;
|
||||
begin
|
||||
if random(2) = 0 then
|
||||
sincos(arctan2(FTy^, FTx^)/2, sina, cosa)
|
||||
else
|
||||
sincos(pi - arctan2(FTy^, FTx^)/2, sina, cosa);
|
||||
r := vvar / sqrt(sqrt(sqr(FTx^) + sqr(FTy^)));
|
||||
|
||||
FPx^ := FPx^ + r * cosa;
|
||||
FPy^ := FPy^ - r * sina;
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
{$else}
|
||||
asm
|
||||
mov edx, [eax + FTy]
|
||||
fld qword ptr [edx]
|
||||
mov edx, [eax + FTx]
|
||||
|
||||
// AV: for Apo7X.15C compatibility
|
||||
fld qword ptr [eax + vvar]
|
||||
fmul qword ptr [edx + 32] // FTz
|
||||
fadd qword ptr [edx + 40] // FPz
|
||||
fstp qword ptr [edx + 40]
|
||||
|
||||
// main code
|
||||
fld qword ptr [edx]
|
||||
fld st(1)
|
||||
fld st(1)
|
||||
fpatan
|
||||
fld1
|
||||
fadd st, st
|
||||
fdivp st(1), st
|
||||
mov ecx, eax
|
||||
mov eax, 2
|
||||
call AsmRandInt
|
||||
|
||||
shr eax, 1
|
||||
jnc @skip
|
||||
fldpi
|
||||
fsubrp st(1), st
|
||||
@skip:
|
||||
fxch st(2)
|
||||
fmul st, st
|
||||
fxch st(1)
|
||||
fmul st, st
|
||||
faddp
|
||||
fsqrt
|
||||
fsqrt
|
||||
fdivr qword ptr [ecx + vvar]
|
||||
fxch st(1)
|
||||
|
||||
fsincos
|
||||
|
||||
fmul st, st(2)
|
||||
mov edx, [ecx + FPx]
|
||||
fadd qword ptr [edx]
|
||||
fstp qword ptr [edx]
|
||||
fmulp
|
||||
mov edx, [ecx + FPy]
|
||||
fsubr qword ptr [edx]
|
||||
fstp qword ptr [edx]
|
||||
fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TVariationJuliaScope.CalcPower1;
|
||||
{$ifndef _ASM_}
|
||||
begin
|
||||
FPx^ := FPx^ + vvar * FTx^;
|
||||
FPy^ := FPy^ + vvar * FTy^;
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
{$else}
|
||||
asm
|
||||
fld qword ptr [eax + vvar]
|
||||
mov edx, [eax + FTx]
|
||||
fld qword ptr [edx] // FTx
|
||||
fmul st, st(1)
|
||||
fadd qword ptr [edx + 16] // FPx
|
||||
fstp qword ptr [edx + 16]
|
||||
|
||||
fld qword ptr [edx + 8] // FTy
|
||||
fmul st, st(1)
|
||||
fadd qword ptr [edx + 24] // FPy
|
||||
fstp qword ptr [edx + 24]
|
||||
|
||||
fmul qword ptr [edx + 32] // FTz
|
||||
fadd qword ptr [edx + 40] // FPz
|
||||
fstp qword ptr [edx + 40]
|
||||
fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TVariationJuliaScope.CalcPowerMinus1;
|
||||
{$ifndef _ASM_}
|
||||
var
|
||||
r: double;
|
||||
begin
|
||||
r := vvar / (sqr(FTx^) + sqr(FTy^));
|
||||
|
||||
FPx^ := FPx^ + r * FTx^;
|
||||
FPy^ := FPy^ - r * FTy^;
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
{$else}
|
||||
asm
|
||||
mov edx, [eax + FTx]
|
||||
// AV: for Apo7X.15C compatibility
|
||||
fld qword ptr [eax + vvar]
|
||||
fmul qword ptr [edx + 32] // FTz
|
||||
fadd qword ptr [edx + 40] // FPz
|
||||
fstp qword ptr [edx + 40]
|
||||
|
||||
// main code
|
||||
fld qword ptr [edx + 8] // FTy
|
||||
fld qword ptr [edx] // FTx
|
||||
fld st(1)
|
||||
fmul st, st
|
||||
fld st(1)
|
||||
fmul st, st
|
||||
faddp
|
||||
fdivr qword ptr [eax + vvar]
|
||||
fmul st(2), st
|
||||
fmulp
|
||||
fadd qword ptr [edx + 16] // FPx
|
||||
fstp qword ptr [edx + 16]
|
||||
fsubr qword ptr [edx + 24] // FPy
|
||||
fstp qword ptr [edx + 24]
|
||||
fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationJuliaScope.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationJuliaScope.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationJuliaScope.GetName: string;
|
||||
begin
|
||||
Result := variation_name;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationJuliaScope.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index of
|
||||
0: Result := var_n_name;
|
||||
1: Result := var_c_name;
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationJuliaScope.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = var_n_name then begin
|
||||
N := Round(Value);
|
||||
if N = 0 then N := 1;
|
||||
Value := N;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = var_c_name then begin
|
||||
c := value;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationJuliaScope.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = var_n_name then begin
|
||||
if N = 2 then N := -2
|
||||
else N := 2;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = var_c_name then begin
|
||||
c := 1;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationJuliaScope.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 2;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationJuliaScope.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = var_n_name then begin
|
||||
Value := N;
|
||||
Result := true;
|
||||
end
|
||||
else if Name = var_c_name then begin
|
||||
Value := c;
|
||||
Result := true;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationJuliaScope), true, false);
|
||||
end.
|
||||
269
Variations/varJulian2DC.pas
Normal file
269
Variations/varJulian2DC.pas
Normal file
@ -0,0 +1,269 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varJulian2DC;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
const
|
||||
j2power = 'julian2dc_power';
|
||||
j2dist = 'julian2dc_dist';
|
||||
j2col = 'julian2dc_col';
|
||||
j2a = 'julian2dc_a';
|
||||
j2b = 'julian2dc_b';
|
||||
j2c = 'julian2dc_c';
|
||||
j2d = 'julian2dc_d';
|
||||
j2e = 'julian2dc_e';
|
||||
j2f = 'julian2dc_f';
|
||||
|
||||
jeps: double = 1E-5;
|
||||
|
||||
type
|
||||
TVariationJulian2DC = class(TBaseVariation)
|
||||
private
|
||||
jdist, jcol, jpower, ja, jb, jc, jd, je, jf: double;
|
||||
cN, pi2, jps, absN, den: double;
|
||||
psn: smallint;
|
||||
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationJulian2DC }
|
||||
|
||||
//////////////////////////////////////////
|
||||
procedure TVariationJulian2DC.Prepare;
|
||||
begin
|
||||
absN := abs(jpower);
|
||||
if (jpower > 0) then psn := 1 else psn := -1;
|
||||
den := jpower + psn * jeps;
|
||||
if (absN < 1) then
|
||||
jps := 1 / den
|
||||
else jps := jpower;
|
||||
cN := jdist / jps / 2;
|
||||
pi2 := pi * 2;
|
||||
end;
|
||||
|
||||
//////////////////////////////////////////
|
||||
procedure TVariationJulian2DC.CalcFunction;
|
||||
var
|
||||
x, y, r, angle, sina, cosa: double;
|
||||
ra: integer;
|
||||
begin
|
||||
x := ja * FTx^ + jb * FTy^ + je;
|
||||
y := jc * FTx^ + jd * FTy^ + jf;
|
||||
|
||||
ra := Trunc(random * (absN - jeps));
|
||||
angle := (arctan2(y, x) + pi2 * ra)/ den;
|
||||
r := vvar * Math.power(sqr(x) + sqr(y), cN);
|
||||
|
||||
SinCos(angle, sina, cosa);
|
||||
FPx^ := FPx^ + r * cosa;
|
||||
FPy^ := FPy^ + r * sina;
|
||||
color^ := fmod(abs(r * jcol + (angle / pi2) * (1 - jcol)), 1.0);
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
constructor TVariationJulian2DC.Create;
|
||||
var beta, sinb, cosb: double;
|
||||
begin
|
||||
beta := pi / RandomRange(1, 6);
|
||||
SinCos(beta, sinb, cosb);
|
||||
jpower := 2 + random(5);
|
||||
jdist := 1;
|
||||
jcol := random;
|
||||
ja := cosb;
|
||||
jb := sinb;
|
||||
jc := -sinb;
|
||||
jd := cosb;
|
||||
je := 2 * random - 1;
|
||||
jf := 2 * random - 1;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationJulian2DC.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationJulian2DC.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationJulian2DC.GetName: string;
|
||||
begin
|
||||
Result := 'julian2dc';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationJulian2DC.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index of
|
||||
0: Result := j2power;
|
||||
1: Result := j2dist;
|
||||
2: Result := j2col;
|
||||
3: Result := j2a;
|
||||
4: Result := j2b;
|
||||
5: Result := j2c;
|
||||
6: Result := j2d;
|
||||
7: Result := j2e;
|
||||
8: Result := j2f;
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationJulian2DC.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = j2power then begin
|
||||
if abs(Value) < jeps then Value := jeps;
|
||||
jpower := Value;
|
||||
Result := True;
|
||||
end else if Name = j2dist then begin
|
||||
jdist := value;
|
||||
Result := True;
|
||||
end else if Name = j2col then begin
|
||||
jcol := Value;
|
||||
Result := True;
|
||||
end else if Name = j2a then begin
|
||||
ja := Value;
|
||||
Result := True;
|
||||
end else if Name = j2b then begin
|
||||
jb := Value;
|
||||
Result := True;
|
||||
end else if Name = j2c then begin
|
||||
jc := Value;
|
||||
Result := True;
|
||||
end else if Name = j2d then begin
|
||||
jd := Value;
|
||||
Result := True;
|
||||
end else if Name = j2e then begin
|
||||
je := Value;
|
||||
Result := True;
|
||||
end else if Name = j2f then begin
|
||||
jf := Value;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationJulian2DC.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = j2power then begin
|
||||
jpower := 2;
|
||||
Result := True;
|
||||
end else if Name = j2dist then begin
|
||||
jdist := 1;
|
||||
Result := True;
|
||||
end else if Name = j2col then begin
|
||||
jcol := 0;
|
||||
Result := True;
|
||||
end else if Name = j2a then begin
|
||||
ja := 1;
|
||||
Result := True;
|
||||
end else if Name = j2b then begin
|
||||
jb := 0;
|
||||
Result := True;
|
||||
end else if Name = j2c then begin
|
||||
jc := 0;
|
||||
Result := True;
|
||||
end else if Name = j2d then begin
|
||||
jd := 1;
|
||||
Result := True;
|
||||
end else if Name = j2e then begin
|
||||
je := 0;
|
||||
Result := True;
|
||||
end else if Name = j2f then begin
|
||||
jf := 0;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
function TVariationJulian2DC.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 9;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationJulian2DC.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = j2power then begin
|
||||
Value := jpower;
|
||||
Result := True;
|
||||
end else if Name = j2dist then begin
|
||||
Value := jdist;
|
||||
Result := True;
|
||||
end else if Name = j2col then begin
|
||||
Value := jcol;
|
||||
Result := True;
|
||||
end else if Name = j2a then begin
|
||||
Value := ja;
|
||||
Result := True;
|
||||
end else if Name = j2b then begin
|
||||
Value := jb;
|
||||
Result := True;
|
||||
end else if Name = j2c then begin
|
||||
Value := jc;
|
||||
Result := True;
|
||||
end else if Name = j2d then begin
|
||||
Value := jd;
|
||||
Result := True;
|
||||
end else if Name = j2e then begin
|
||||
Value := je;
|
||||
Result := True;
|
||||
end else if Name = j2f then begin
|
||||
Value := jf;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationJulian2DC), false, true);
|
||||
end.
|
||||
195
Variations/varLazysusan.pas
Normal file
195
Variations/varLazysusan.pas
Normal file
@ -0,0 +1,195 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
You should have received a copy of the GNU General Public License
|
||||
GNU General Public License for more details.
|
||||
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varLazysusan;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationLazysusan = class(TBaseVariation)
|
||||
private
|
||||
lazysusan_spin, lazysusan_space, lazysusan_twist : double;
|
||||
lazysusan_x, lazysusan_y : double;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationLazysusan.Prepare;
|
||||
begin
|
||||
end;
|
||||
procedure TVariationLazysusan.CalcFunction;
|
||||
var
|
||||
a, r, sina, cosa, x, y: double;
|
||||
begin
|
||||
x := FTx^ - lazysusan_x;
|
||||
y := FTy^ + lazysusan_y;
|
||||
r := sqrt(x*x + y*y);
|
||||
|
||||
if (r < VVAR) then
|
||||
begin
|
||||
a := ArcTan2(y, x) + lazysusan_spin + lazysusan_twist*(VVAR-r);
|
||||
sincos(a, sina, cosa);
|
||||
FPx^ := FPx^ + VVAR * (r*cosa + lazysusan_x);
|
||||
FPy^ := FPy^ + VVAR * (r*sina - lazysusan_y);
|
||||
end else begin
|
||||
r := 1.0 + lazysusan_space / (r + 1E-6);
|
||||
FPx^ := FPx^ + VVAR * (r*x + lazysusan_x);
|
||||
FPy^ := FPy^ + VVAR * (r*y - lazysusan_y);
|
||||
end;
|
||||
|
||||
FPz^ := FPz^ + VVAR * FTz^;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationLazysusan.Create;
|
||||
begin
|
||||
lazysusan_spin := PI;
|
||||
lazysusan_space := 0;
|
||||
lazysusan_twist := 0;
|
||||
lazysusan_x := 0;
|
||||
lazysusan_y := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationLazysusan.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationLazysusan.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationLazysusan.GetName: string;
|
||||
begin
|
||||
Result := 'lazysusan';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationLazysusan.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'lazysusan_spin';
|
||||
1: Result := 'lazysusan_space';
|
||||
2: Result := 'lazysusan_twist';
|
||||
3: Result := 'lazysusan_x';
|
||||
4: Result := 'lazysusan_y';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationLazysusan.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'lazysusan_spin' then begin
|
||||
Value := frac(value / (2 * PI)) * (2 * PI);
|
||||
lazysusan_spin := value;
|
||||
Result := True;
|
||||
end else if Name = 'lazysusan_space' then begin
|
||||
lazysusan_space := Value;
|
||||
Result := True;
|
||||
end else if Name = 'lazysusan_twist' then begin
|
||||
lazysusan_twist := Value;
|
||||
Result := True;
|
||||
end else if Name = 'lazysusan_x' then begin
|
||||
lazysusan_x := Value;
|
||||
Result := True;
|
||||
end else if Name = 'lazysusan_y' then begin
|
||||
lazysusan_y := Value;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
function TVariationLazysusan.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'lazysusan_spin' then begin
|
||||
lazysusan_spin := PI;
|
||||
Result := True;
|
||||
end else if Name = 'lazysusan_space' then begin
|
||||
lazysusan_space := 0;
|
||||
Result := True;
|
||||
end else if Name = 'lazysusan_twist' then begin
|
||||
lazysusan_twist := 0;
|
||||
Result := True;
|
||||
end else if Name = 'lazysusan_x' then begin
|
||||
lazysusan_x := 0;
|
||||
Result := True;
|
||||
end else if Name = 'lazysusan_y' then begin
|
||||
lazysusan_x := 0;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationLazysusan.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 5
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationLazysusan.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'lazysusan_spin' then begin
|
||||
Value := lazysusan_spin;
|
||||
Result := True;
|
||||
end else if Name = 'lazysusan_space' then begin
|
||||
Value := lazysusan_space;
|
||||
Result := True;
|
||||
end else if Name = 'lazysusan_twist' then begin
|
||||
Value := lazysusan_twist;
|
||||
Result := True;
|
||||
end else if Name = 'lazysusan_x' then begin
|
||||
Value := lazysusan_x;
|
||||
Result := True;
|
||||
end else if Name = 'lazysusan_y' then begin
|
||||
Value := lazysusan_y;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationLazysusan), true, false);
|
||||
end.
|
||||
143
Variations/varLog.pas
Normal file
143
Variations/varLog.pas
Normal file
@ -0,0 +1,143 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varLog;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationLog = class(TBaseVariation)
|
||||
private
|
||||
base, denom: double;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationLog }
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationLog.Prepare;
|
||||
begin
|
||||
denom := 0.5 / Ln(base);
|
||||
end;
|
||||
|
||||
procedure TVariationLog.CalcFunction;
|
||||
begin
|
||||
FPx^ := FPx^ + vvar * Ln(sqr(FTx^) + sqr(FTy^)) * denom;
|
||||
FPy^ := FPy^ + vvar * ArcTan2(FTy^, FTx^);
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationLog.Create;
|
||||
begin
|
||||
base := 2.71828182845905; // AV: Euler number
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationLog.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationLog.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationLog.GetName: string;
|
||||
begin
|
||||
Result := 'log';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationLog.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'log_base';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationLog.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'log_base' then begin
|
||||
base := Value;
|
||||
if (base < 1E-6) then // AV: log_base > 0
|
||||
base := 1E-6;
|
||||
if (RoundTo(base, -6) = 1) then // AV: log_base <> 1
|
||||
base := 1.000001;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
function TVariationLog.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'log_base' then begin
|
||||
base := 2.71828182845905;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationLog.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 1
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationLog.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'log_base' then begin
|
||||
Value := base;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationLog), true, false);
|
||||
end.
|
||||
170
Variations/varLoonie.pas
Normal file
170
Variations/varLoonie.pas
Normal file
@ -0,0 +1,170 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varLoonie;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationLoonie = class(TBaseVariation)
|
||||
private
|
||||
sqrvar: double;
|
||||
use3D: byte;
|
||||
procedure Calc3D;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationLoonie.Prepare;
|
||||
begin
|
||||
sqrvar := VVAR * VVAR;
|
||||
end;
|
||||
|
||||
procedure TVariationLoonie.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
if use3D <> 0 then
|
||||
f := Calc3D
|
||||
else f := CalcFunction;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////
|
||||
procedure TVariationLoonie.CalcFunction;
|
||||
var r, r2 : double;
|
||||
begin
|
||||
r2 := sqr(FTx^) + sqr(FTy^);
|
||||
|
||||
if (r2 < (sqrvar)) and (r2 <> 0) then
|
||||
begin
|
||||
r := VVAR * sqrt((sqrvar) / r2 - 1.0);
|
||||
FPx^ := FPx^ + r * FTx^;
|
||||
FPy^ := FPy^ + r * FTy^;
|
||||
end else begin
|
||||
FPx^ := FPx^ + VVAR * FTx^;
|
||||
FPy^ := FPy^ + VVAR * FTy^;
|
||||
end;
|
||||
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
end;
|
||||
|
||||
procedure TVariationLoonie.Calc3D;
|
||||
var r, r2 : double;
|
||||
begin
|
||||
r2 := sqr(FTx^) + sqr(FTy^) + sqr(FTz^);
|
||||
|
||||
if (r2 < (sqrvar)) and (r2 <> 0) then
|
||||
begin
|
||||
r := VVAR * sqrt((sqrvar) / r2 - 1.0);
|
||||
FPx^ := FPx^ + r * FTx^;
|
||||
FPy^ := FPy^ + r * FTy^;
|
||||
FPz^ := FPz^ + r * FTz^;
|
||||
end else begin
|
||||
FPx^ := FPx^ + VVAR * FTx^;
|
||||
FPy^ := FPy^ + VVAR * FTy^;
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationLoonie.Create;
|
||||
begin
|
||||
sqrvar := 0;
|
||||
use3D := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationLoonie.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationLoonie.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationLoonie.GetName: string;
|
||||
begin
|
||||
Result := 'loonie';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationLoonie.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'loonie_use3D';
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationLoonie.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'loonie_use3D' then begin
|
||||
if Value < 0 then Value := 0;
|
||||
if Value > 1 then Value := 1;
|
||||
use3D := Round(Value);
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationLoonie.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 1;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationLoonie.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'loonie_use3D' then begin
|
||||
Value := use3D;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationLoonie), true, false);
|
||||
end.
|
||||
256
Variations/varMobius.pas
Normal file
256
Variations/varMobius.pas
Normal file
@ -0,0 +1,256 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varMobius;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationMobius = class(TBaseVariation)
|
||||
private
|
||||
Re_A, Im_A, Re_B, Im_B, Re_C, Im_C, Re_D, Im_D: double;
|
||||
mobius_invert : byte;
|
||||
procedure CalcInvert;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure CalcFunction; override;
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationMobius.GetCalcFunction(var f: TCalcFunction);
|
||||
begin // AV: this helps to increase the calc speed
|
||||
if (mobius_invert <> 0) then
|
||||
f := CalcInvert
|
||||
else f := CalcFunction;
|
||||
end;
|
||||
|
||||
procedure TVariationMobius.CalcFunction;
|
||||
const EPS = 1E-100;
|
||||
var
|
||||
uRe, uIm, vRe, vIm, vDenom : double;
|
||||
begin
|
||||
uRe := (Re_A) * FTX^ - (Im_A) * FTY^ + (Re_B);
|
||||
uIm := (Re_A) * FTY^ + (Im_A) * FTX^ + (Im_B);
|
||||
vRe := (Re_C) * FTX^ - (Im_C) * FTY^ + (Re_D);
|
||||
vIm := (Re_C) * FTY^ + (Im_C) * FTX^ + (Im_D);
|
||||
|
||||
vDenom := vRe * vRe + vIm * vIm;
|
||||
if abs(vDenom) < EPS then vDenom := EPS;
|
||||
|
||||
FPx^ := FPx^ + VVAR * (uRe*vRe + uIm*vIm) / vDenom;
|
||||
FPy^ := FPy^ + VVAR * (uIm*vRe - uRe*vIm) / vDenom;
|
||||
FPz^ := FPz^ + VVAR * FTz^; // for Apo7x.15C compatibility only
|
||||
end;
|
||||
|
||||
procedure TVariationMobius.CalcInvert; // inverse Mobius transformation
|
||||
const EPS = 1E-100;
|
||||
var
|
||||
uRe, uIm, vRe, vIm, vDenom : double;
|
||||
begin
|
||||
uRe := (Re_D) * FTX^ - (Im_D) * FTY^ - (Re_B);
|
||||
uIm := (Re_D) * FTY^ + (Im_D) * FTX^ - (Im_B);
|
||||
vRe := -(Re_C) * FTX^ + (Im_C) * FTY^ + (Re_A);
|
||||
vIm := -(Re_C) * FTY^ - (Im_C) * FTX^ + (Im_A);
|
||||
|
||||
vDenom := vRe * vRe + vIm * vIm;
|
||||
if abs(vDenom) < EPS then vDenom := EPS;
|
||||
|
||||
FPx^ := FPx^ + VVAR * (uRe*vRe + uIm*vIm) / vDenom;
|
||||
FPy^ := FPy^ + VVAR * (uIm*vRe - uRe*vIm) / vDenom;
|
||||
FPz^ := FPz^ + VVAR * FTz^;
|
||||
end;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationMobius.Create;
|
||||
begin
|
||||
Re_A := 1; Im_A := 0;
|
||||
Re_B := 0; Im_B := 0;
|
||||
Re_C := 0; Im_C := 0;
|
||||
Re_D := 1; Im_D := 0;
|
||||
mobius_invert := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationMobius.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationMobius.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationMobius.GetName: string;
|
||||
begin
|
||||
Result := 'mobius';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationMobius.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'Re_A';
|
||||
1: Result := 'Im_A';
|
||||
2: Result := 'Re_B';
|
||||
3: Result := 'Im_B';
|
||||
4: Result := 'Re_C';
|
||||
5: Result := 'Im_C';
|
||||
6: Result := 'Re_D';
|
||||
7: Result := 'Im_D';
|
||||
8: Result := 'mobius_invert';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationMobius.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'Re_A' then begin
|
||||
Re_A := Value;
|
||||
Result := True;
|
||||
end else if Name = 'Im_A' then begin
|
||||
Im_A := Value;
|
||||
Result := True;
|
||||
end else if Name = 'Re_B' then begin
|
||||
Re_B := Value;
|
||||
Result := True;
|
||||
end else if Name = 'Im_B' then begin
|
||||
Im_B := Value;
|
||||
Result := True;
|
||||
end else if Name = 'Re_C' then begin
|
||||
Re_C := Value;
|
||||
Result := True;
|
||||
end else if Name = 'Im_C' then begin
|
||||
Im_C := Value;
|
||||
Result := True;
|
||||
end else if Name = 'Re_D' then begin
|
||||
Re_D := Value;
|
||||
Result := True;
|
||||
end else if Name = 'Im_D' then begin
|
||||
Im_D := Value;
|
||||
Result := True;
|
||||
end else if Name = 'mobius_invert' then begin
|
||||
if (Value > 1) then Value := 1;
|
||||
if (Value < 0) then Value := 0;
|
||||
mobius_invert := Round(Value);
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
function TVariationMobius.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'Re_A' then begin
|
||||
Re_A := 1;
|
||||
Result := True;
|
||||
end else if Name = 'Im_A' then begin
|
||||
Im_A := 0;
|
||||
Result := True;
|
||||
end else if Name = 'Re_B' then begin
|
||||
Re_B := 0;
|
||||
Result := True;
|
||||
end else if Name = 'Im_B' then begin
|
||||
Im_B := 0;
|
||||
Result := True;
|
||||
end else if Name = 'Re_C' then begin
|
||||
Re_C := 0;
|
||||
Result := True;
|
||||
end else if Name = 'Im_C' then begin
|
||||
Im_C := 0;
|
||||
Result := True;
|
||||
end else if Name = 'Re_D' then begin
|
||||
Re_D := 1;
|
||||
Result := True;
|
||||
end else if Name = 'Im_D' then begin
|
||||
Im_D := 0;
|
||||
Result := True;
|
||||
end else if Name = 'mobius_invert' then begin
|
||||
mobius_invert := 0;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationMobius.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 9
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationMobius.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'Re_A' then begin
|
||||
Value := Re_A;
|
||||
Result := True;
|
||||
end else if Name = 'Im_A' then begin
|
||||
Value := Im_A;
|
||||
Result := True;
|
||||
end else if Name = 'Re_B' then begin
|
||||
Value := Re_B;
|
||||
Result := True;
|
||||
end else if Name = 'Im_B' then begin
|
||||
Value := Im_B;
|
||||
Result := True;
|
||||
end else if Name = 'Re_C' then begin
|
||||
Value := Re_C;
|
||||
Result := True;
|
||||
end else if Name = 'Im_C' then begin
|
||||
Value := Im_C;
|
||||
Result := True;
|
||||
end else if Name = 'Re_D' then begin
|
||||
Value := Re_D;
|
||||
Result := True;
|
||||
end else if Name = 'Im_D' then begin
|
||||
Value := Im_D;
|
||||
Result := True;
|
||||
end else if Name = 'mobius_invert' then begin
|
||||
Value := mobius_invert;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationMobius), true, false);
|
||||
end.
|
||||
208
Variations/varModulus.pas
Normal file
208
Variations/varModulus.pas
Normal file
@ -0,0 +1,208 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varModulus;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
const
|
||||
modx = 'modulus_x';
|
||||
mody = 'modulus_y';
|
||||
modz = 'modulus_z';
|
||||
mod3D = 'modulus_use3D';
|
||||
type
|
||||
TVariationModulus = class(TBaseVariation)
|
||||
private
|
||||
mx, my, mz, xrange, yrange, zrange: double;
|
||||
m3D: byte;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationModulus }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationModulus.Prepare;
|
||||
begin
|
||||
xrange := 2.0 * mx;
|
||||
yrange := 2.0 * my;
|
||||
zrange := 2.0 * mz;
|
||||
end;
|
||||
|
||||
//////////////////////////////////////////
|
||||
procedure TVariationModulus.CalcFunction;
|
||||
begin
|
||||
if (FTx^ > mx) then
|
||||
FPx^ := FPx^ + VVAR * (-mx + fmod(FTx^ + mx, xrange))
|
||||
else if (FTx^ < -mx) then
|
||||
FPx^ := FPx^ + VVAR * (mx - fmod(mx - FTx^, xrange))
|
||||
else
|
||||
FPx^ := FPx^ + VVAR * FTx^;
|
||||
|
||||
if (FTy^ > my) then
|
||||
FPy^ := FPy^ + VVAR * (-my + fmod(FTy^ + my, yrange))
|
||||
else if (FTy^ < -my) then
|
||||
FPy^ := FPy^ + VVAR * (my - fmod(my - FTy^, yrange))
|
||||
else
|
||||
FPy^ := FPy^ + VVAR * FTy^;
|
||||
|
||||
|
||||
if (m3D <> 0) then
|
||||
begin
|
||||
if (FTz^ > mz) then
|
||||
FPz^ := FPz^ + VVAR * (-mz + fmod(FTz^ + mz, zrange))
|
||||
else if (FTz^ < -mz) then
|
||||
FPz^ := FPz^ + VVAR * (mz - fmod(mz - FTz^, zrange))
|
||||
else
|
||||
FPz^ := FPz^ + VVAR * FTz^;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationModulus.Create;
|
||||
begin
|
||||
mx := 1;
|
||||
my := 1;
|
||||
mz := 1;
|
||||
m3D := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationModulus.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationModulus.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationModulus.GetName: string;
|
||||
begin
|
||||
Result := 'modulus';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationModulus.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index of
|
||||
0: Result := modx;
|
||||
1: Result := mody;
|
||||
2: Result := modz;
|
||||
3: Result := mod3D;
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationModulus.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = modx then begin
|
||||
mx := Value;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = mody then begin
|
||||
my := value;
|
||||
Result := True;
|
||||
end else if Name = modz then begin
|
||||
mz := value;
|
||||
Result := True;
|
||||
end else if Name = mod3D then begin
|
||||
if (value < 0) then Value := 0;
|
||||
if (value > 1) then Value := 1;
|
||||
m3D := Round(Value);
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationModulus.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = modx then begin
|
||||
mx := 1;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = mody then begin
|
||||
my := 1;
|
||||
Result := True;
|
||||
end else if Name = modz then begin
|
||||
mz := 1;
|
||||
Result := True;
|
||||
end else if Name = mod3D then begin
|
||||
m3D := 0;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
function TVariationModulus.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 4;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationModulus.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = modx then begin
|
||||
Value := mx;
|
||||
Result := true;
|
||||
end
|
||||
else if Name = mody then begin
|
||||
Value := my;
|
||||
Result := true;
|
||||
end else if Name = modz then begin
|
||||
Value := mz;
|
||||
Result := true;
|
||||
end else if Name = mod3D then begin
|
||||
Value := m3D;
|
||||
Result := true;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationModulus), true, false);
|
||||
end.
|
||||
535
Variations/varNBlur.pas
Normal file
535
Variations/varNBlur.pas
Normal file
@ -0,0 +1,535 @@
|
||||
{
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
Original nBlur plugin by FractalDesire:
|
||||
http://fractaldesire.deviantart.com/art/nBlur-plugin-190401515,
|
||||
Optimized and translated into Delphi by Alice V. Koryagina
|
||||
}
|
||||
|
||||
unit varNBlur;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationNBlur = class(TBaseVariation)
|
||||
private
|
||||
numEdges, numStripes: integer;
|
||||
circumCircle, adjustToLinear, equalBlur, exactCalc: byte;
|
||||
ratioStripes, ratioHole, highlightEdges, ratioComplement, maxStripes, angStripes, midAngle, angStart,
|
||||
tan90_m_2, sina, cosa, arc_tan1, arc_tan2, speedCalc1, speedCalc2, nStripes: double;
|
||||
hasStripes, negStripes: boolean;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationNBlur }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
procedure TVariationNBlur.Prepare;
|
||||
begin
|
||||
//*********Prepare stripes related stuff*********
|
||||
nStripes := numStripes; // AV: to fix a bug with negative stripes count
|
||||
if (nStripes <> 0) then
|
||||
begin
|
||||
hasStripes := True;
|
||||
if (nStripes < 0) then
|
||||
begin
|
||||
negStripes := True;
|
||||
nStripes := -nStripes;
|
||||
end else
|
||||
negStripes := False;
|
||||
end else begin
|
||||
hasStripes := False;
|
||||
negStripes := False;
|
||||
end;
|
||||
|
||||
//**********Prepare angle related stuff**********
|
||||
midAngle := 2 * pi / numEdges;
|
||||
if hasStripes then
|
||||
begin
|
||||
angStripes := midAngle / (2 * nStripes);
|
||||
angStart := angStripes * 0.5;
|
||||
ratioComplement := 2 - ratioStripes;
|
||||
end;
|
||||
|
||||
//**********Prepare hole related stuff***********
|
||||
if (ratioHole > 0.95) and (exactCalc = 1) and (circumCircle = 0) then ratioHole := 0.95;
|
||||
|
||||
//*********Prepare edge calculation related stuff*********
|
||||
tan90_m_2 := tan((pi + midAngle) * 0.5);
|
||||
SinCos(midAngle * 0.5, sina, cosa);
|
||||
|
||||
//*********Adjustment of width of shape*********
|
||||
if (adjustToLinear = 1) then
|
||||
begin
|
||||
if((numEdges mod 4) = 0) then
|
||||
VVAR := VVAR / (sqrt(2 - 2 * cos(midAngle *(numEdges * 0.5 - 1))) * 0.5)
|
||||
else
|
||||
VVAR := VVAR / (sqrt(2 - 2 * cos(midAngle * floor(numEdges * 0.5))) * 0.5);
|
||||
end;
|
||||
|
||||
//*********Prepare circumCircle-calculation*********
|
||||
if (circumCircle = 1) then
|
||||
begin
|
||||
exactCalc := 0;
|
||||
highlightEdges := 0.1;
|
||||
end;
|
||||
|
||||
//*********Prepare speed up related stuff*********
|
||||
speedCalc1 := ratioComplement * angStart;
|
||||
speedCalc2 := ratioStripes * angStart;
|
||||
maxStripes := 2 * numStripes;
|
||||
if(negStripes = False) then
|
||||
arc_tan1 := 13.0 / power(numEdges, 1.3) * highlightEdges
|
||||
else
|
||||
arc_tan1 := 7.5 / power(numEdges, 1.3) * highlightEdges;
|
||||
arc_tan2 := 2 * arctan(arc_tan1 *(-0.5));
|
||||
end;
|
||||
|
||||
|
||||
|
||||
procedure TVariationNBlur.CalcFunction;
|
||||
var
|
||||
x, y, xTmp, yTmp, lenOuterEdges, lenInnerEdges, lenXY: double;
|
||||
|
||||
procedure RandXY;
|
||||
var
|
||||
angXY, ranTmp, angTmp, angMem, rotTmp,
|
||||
ratioTmp, ratioTmpNum, ratioTmpDen, step, speedCalcTmp: double;
|
||||
count: integer;
|
||||
begin
|
||||
if (exactCalc = 1) then
|
||||
angXY := random * PI2
|
||||
else
|
||||
angXY := (arctan(arc_tan1 * (random - 0.5)) / arc_tan2 + 0.5 + Random(numEdges)) * midAngle;
|
||||
SinCos(angXY, x, y);
|
||||
angMem := angXY;
|
||||
while (angXY > midAngle) do angXY := angXY - midAngle;
|
||||
|
||||
//********Begin of xy-calculation of radial stripes********
|
||||
if hasStripes then
|
||||
begin
|
||||
angTmp := angStart;
|
||||
count := 0;
|
||||
while(angXY > angTmp) do
|
||||
begin
|
||||
angTmp := angTmp + angStripes;
|
||||
if (angTmp > midAngle) then angTmp := midAngle;
|
||||
inc(count);
|
||||
end;
|
||||
if (angTmp <> midAngle) then angTmp := angTmp - angStart;
|
||||
|
||||
if (not negStripes) then
|
||||
begin
|
||||
if Odd(count) then
|
||||
begin
|
||||
if(angXY > angTmp) then
|
||||
begin
|
||||
angXY := angXY + angStart;
|
||||
angMem := angMem + angStart;
|
||||
SinCos(angMem, x, y);
|
||||
angTmp := angTmp + angStripes;
|
||||
inc(count);
|
||||
end
|
||||
else begin
|
||||
angXY := angXY - angStart;
|
||||
angMem := angMem - angStart;
|
||||
SinCos(angMem, x, y);
|
||||
angTmp := angTmp - angStripes;
|
||||
dec(count);
|
||||
end;
|
||||
end;
|
||||
|
||||
if (not Odd(count)) and (ratioStripes > 1.0) then
|
||||
begin
|
||||
if (angXY > angTmp) and (count <> maxStripes) then
|
||||
begin
|
||||
angMem := angMem - angXY + angTmp + (angXY - angTmp) / angStart * ratioStripes * angStart;
|
||||
angXY := angTmp + (angXY - angTmp) / angStart * ratioStripes * angStart;
|
||||
SinCos(angMem, x, y);
|
||||
end
|
||||
else begin
|
||||
angMem := angMem - angXY + angTmp - (angTmp - angXY)/ angStart * ratioStripes * angStart;
|
||||
angXY := angTmp + (angXY - angTmp)/ angStart * ratioStripes * angStart;
|
||||
SinCos(angMem, x, y);
|
||||
end;
|
||||
end;
|
||||
|
||||
if (not Odd(count)) and (ratioStripes < 1.0) then
|
||||
begin
|
||||
if (abs(angXY - angTmp) > speedCalc2) and (count <> maxStripes) then
|
||||
begin
|
||||
if (angXY - angTmp) > speedCalc2 then
|
||||
begin
|
||||
ratioTmpNum := (angXY -(angTmp + speedCalc2)) * speedCalc2;
|
||||
ratioTmpDen := angStart - speedCalc2;
|
||||
ratioTmp := ratioTmpNum / ratioTmpDen;
|
||||
SinCos((angMem - angXY + angTmp + ratioTmp), x, y);
|
||||
angXY := angTmp + ratioTmp;
|
||||
end;
|
||||
if (angTmp - angXY) > speedCalc2 then
|
||||
begin
|
||||
ratioTmpNum := (angTmp - speedCalc2 - angXY) * speedCalc2;
|
||||
ratioTmpDen := angStart - speedCalc2;
|
||||
ratioTmp := ratioTmpNum / ratioTmpDen;
|
||||
SinCos((angMem - angXY + angTmp - ratioTmp), x, y);
|
||||
angXY := angTmp - ratioTmp;
|
||||
end;
|
||||
end;
|
||||
|
||||
if (count = maxStripes) then
|
||||
if (angTmp - angXY) > speedCalc2 then
|
||||
begin
|
||||
ratioTmpNum := (angTmp - speedCalc2 - angXY) * speedCalc2;
|
||||
ratioTmpDen := angStart - speedCalc2;
|
||||
ratioTmp := ratioTmpNum / ratioTmpDen;
|
||||
SinCos((angMem - angXY + angTmp - ratioTmp), x, y);
|
||||
angXY := angTmp - ratioTmp;
|
||||
end;
|
||||
end;
|
||||
end
|
||||
else begin
|
||||
//********Change ratio and ratioComplement********
|
||||
ratioTmp := ratioStripes;
|
||||
ratioStripes := ratioComplement;
|
||||
ratioComplement := ratioTmp;
|
||||
speedCalcTmp := speedCalc1;
|
||||
speedCalc1 := speedCalc2;
|
||||
speedCalc2 := speedCalcTmp;
|
||||
//************************************************
|
||||
if not Odd(count) then
|
||||
begin
|
||||
if (angXY > angTmp) and (count <> maxStripes) then
|
||||
begin
|
||||
angXY := angXY + angStart;
|
||||
angMem := angMem + angStart;
|
||||
SinCos(angMem, x, y);
|
||||
angTmp := angTmp + angStripes;
|
||||
inc(count);
|
||||
end
|
||||
else begin
|
||||
angXY := angXY - angStart;
|
||||
angMem := angMem - angStart;
|
||||
SinCos(angMem, x, y);
|
||||
angTmp := angTmp - angStripes;
|
||||
dec(count);
|
||||
end;
|
||||
end;
|
||||
|
||||
if Odd(count) and (ratioStripes > 1.0) then
|
||||
begin
|
||||
if (angXY > angTmp) and (count <> maxStripes) then
|
||||
begin
|
||||
angMem := angMem - angXY + angTmp + (angXY - angTmp) / angStart * ratioStripes * angStart;
|
||||
angXY := angTmp + (angXY - angTmp) / angStart * ratioStripes * angStart;
|
||||
SinCos(angMem, x, y);
|
||||
end
|
||||
else begin
|
||||
angMem := angMem - angXY + angTmp - (angTmp - angXY)/ angStart * ratioStripes * angStart;
|
||||
angXY := angTmp + (angXY - angTmp)/ angStart * ratioStripes * angStart;
|
||||
SinCos(angMem, x, y);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
if Odd(count) and (ratioStripes < 1.0) then
|
||||
begin
|
||||
if (abs(angXY - angTmp) > speedCalc2) and (count <> maxStripes) then
|
||||
begin
|
||||
if (angXY - angTmp) > speedCalc2 then
|
||||
begin
|
||||
ratioTmpNum := (angXY -(angTmp + speedCalc2)) * speedCalc2;
|
||||
ratioTmpDen := angStart - speedCalc2;
|
||||
ratioTmp := ratioTmpNum / ratioTmpDen;
|
||||
SinCos((angMem - angXY + angTmp + ratioTmp), x, y);
|
||||
angXY := angTmp + ratioTmp;
|
||||
end;
|
||||
if (angTmp - angXY) > speedCalc2 then
|
||||
begin
|
||||
ratioTmpNum := (angTmp - speedCalc2 - angXY) * speedCalc2;
|
||||
ratioTmpDen := angStart - speedCalc2;
|
||||
ratioTmp := ratioTmpNum / ratioTmpDen;
|
||||
SinCos((angMem - angXY + angTmp - ratioTmp), x, y);
|
||||
angXY := angTmp - ratioTmp;
|
||||
end;
|
||||
end;
|
||||
|
||||
if (count = maxStripes) then
|
||||
begin
|
||||
angTmp := midAngle;
|
||||
if (angTmp - angXY) > speedCalc2 then
|
||||
begin
|
||||
ratioTmpNum := (angTmp - speedCalc2 - angXY) * speedCalc2;
|
||||
ratioTmpDen := angStart - speedCalc2;
|
||||
ratioTmp := ratioTmpNum / ratioTmpDen;
|
||||
SinCos((angMem - angXY + angTmp - ratioTmp), x, y);
|
||||
angXY := angTmp - ratioTmp;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
//********Restore ratio and ratioComplement*******
|
||||
ratioTmp := ratioStripes;
|
||||
ratioStripes := ratioComplement;
|
||||
ratioComplement := ratioTmp;
|
||||
speedCalcTmp := speedCalc1;
|
||||
speedCalc1 := speedCalc2;
|
||||
speedCalc2 := speedCalcTmp;
|
||||
//************************************************
|
||||
end;
|
||||
end;
|
||||
//********End of xy-calculation of radial stripes********
|
||||
|
||||
//********Begin of calculation of edge limits********
|
||||
xTmp := tan90_m_2 / (tan90_m_2 - tan(angXY));
|
||||
yTmp := xTmp * tan(angXY);
|
||||
lenOuterEdges := hypot(xTmp, yTmp);
|
||||
//*********End of calculation of edge limits********
|
||||
|
||||
//********Begin of radius-calculation (optionally hole)********
|
||||
if(exactCalc = 1) then
|
||||
if (equalBlur = 1) then ranTmp := sqrt(random)
|
||||
else ranTmp := random
|
||||
else begin
|
||||
if(circumCircle = 1) then
|
||||
if (equalBlur = 1) then ranTmp := sqrt(random)
|
||||
else ranTmp := random
|
||||
else
|
||||
if (equalBlur = 1) then ranTmp := sqrt(random) * lenOuterEdges
|
||||
else ranTmp := random * lenOuterEdges;
|
||||
end;
|
||||
lenInnerEdges := ratioHole * lenOuterEdges;
|
||||
|
||||
if (exactCalc = 0) then
|
||||
begin
|
||||
if(ranTmp < lenInnerEdges) then
|
||||
begin
|
||||
if (circumCircle = 1) then
|
||||
if (equalBlur = 1) then ranTmp := lenInnerEdges + sqrt(random) * (1.0 - lenInnerEdges + 1e-300)
|
||||
else ranTmp := lenInnerEdges + random * (1.0 - lenInnerEdges + 1e-300)
|
||||
else
|
||||
if (equalBlur = 1) then ranTmp := lenInnerEdges + sqrt(random) * (lenOuterEdges - lenInnerEdges)
|
||||
else ranTmp := lenInnerEdges + random * (lenOuterEdges - lenInnerEdges);
|
||||
end;
|
||||
end;
|
||||
|
||||
x := x * ranTmp;
|
||||
y := y * ranTmp;
|
||||
lenXY := hypot(x, y);
|
||||
//*********End of radius-calculation (optionally hole)*********
|
||||
end; // of procedure
|
||||
|
||||
begin
|
||||
|
||||
RandXY;
|
||||
|
||||
//********Exact calculation slower - interpolated calculation faster********
|
||||
if (exactCalc = 1) and (circumCircle = 0) then
|
||||
while ((lenXY < lenInnerEdges) or (lenXY > lenOuterEdges)) do RandXY;
|
||||
if (exactCalc = 1) and (circumCircle = 1) then
|
||||
while (lenXY < lenInnerEdges) do RandXY;
|
||||
xTmp := x;
|
||||
yTmp := y;
|
||||
//**************************************************************************
|
||||
|
||||
//********Begin of horizontal adjustment (rotation)********
|
||||
x := cosa * xTmp - sina * yTmp;
|
||||
y := sina * xTmp + cosa * yTmp;
|
||||
//*********End of horizontal adjustment (rotation)*********
|
||||
|
||||
FPx^ := FPx^ + VVAR * x;
|
||||
FPy^ := FPy^ + VVAR * y;
|
||||
end;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationNBlur.Create;
|
||||
begin
|
||||
numEdges := 3;
|
||||
numStripes := 0;
|
||||
ratioStripes := 1.0;
|
||||
ratioHole := 0;
|
||||
circumCircle := 0;
|
||||
adjustToLinear := 1;
|
||||
equalBlur := 1;
|
||||
exactCalc := 0;
|
||||
highlightEdges := 1.0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationNBlur.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationNBlur.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationNBlur.GetName: string;
|
||||
begin
|
||||
Result := 'nBlur';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationNBlur.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'nb_numEdges';
|
||||
1: Result := 'nb_numStripes';
|
||||
2: Result := 'nb_ratioStripes';
|
||||
3: Result := 'nb_ratioHole';
|
||||
4: Result := 'nb_circumCircle';
|
||||
5: Result := 'nb_adjustToLinear';
|
||||
6: Result := 'nb_equalBlur';
|
||||
7: Result := 'nb_exactCalc';
|
||||
8: Result := 'nb_highlightEdges';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationNBlur.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'nb_numEdges' then begin
|
||||
if (value < 3) then Value := 3;
|
||||
numEdges := Round(Value);
|
||||
Result := True;
|
||||
end else if Name = 'nb_numStripes' then begin
|
||||
numStripes := Round(Value);
|
||||
Result := True;
|
||||
end else if Name = 'nb_ratioStripes' then begin
|
||||
if (value < 0) then Value := 0;
|
||||
if (value > 2) then Value := 2;
|
||||
ratioStripes := Value;
|
||||
Result := True;
|
||||
end else if Name = 'nb_ratioHole' then begin
|
||||
if (value < 0) then Value := 0;
|
||||
if (value > 1) then Value := 1;
|
||||
ratioHole := Value;
|
||||
Result := True;
|
||||
end else if Name = 'nb_circumCircle' then begin
|
||||
if (value < 0) then Value := 0;
|
||||
if (value > 1) then Value := 1;
|
||||
circumCircle := Round(Value);
|
||||
Result := True;
|
||||
end else if Name = 'nb_adjustToLinear' then begin
|
||||
if (value < 0) then Value := 0;
|
||||
if (value > 1) then Value := 1;
|
||||
adjustToLinear := Round(Value);
|
||||
Result := True;
|
||||
end else if Name = 'nb_equalBlur' then begin
|
||||
if (value < 0) then Value := 0;
|
||||
if (value > 1) then Value := 1;
|
||||
equalBlur := Round(Value);
|
||||
Result := True;
|
||||
end else if Name = 'nb_exactCalc' then begin
|
||||
if (value < 0) then Value := 0;
|
||||
if (value > 1) then Value := 1;
|
||||
exactCalc := Round(Value);
|
||||
Result := True;
|
||||
end else if Name = 'nb_highlightEdges' then begin
|
||||
if (value < 0.1) then Value := 0.1;
|
||||
highlightEdges := Value;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
function TVariationNBlur.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'nb_numEdges' then begin
|
||||
numEdges:= 3;
|
||||
Result := True;
|
||||
end else if Name = 'nb_numStripes' then begin
|
||||
numStripes := 0;
|
||||
Result := True;
|
||||
end else if Name = 'nb_highlightEdges' then begin
|
||||
highlightEdges := 1;
|
||||
Result := True;
|
||||
end else if Name = 'nb_ratioStripes' then begin
|
||||
ratioStripes := 1;
|
||||
Result := True;
|
||||
end else if Name = 'nb_ratioHole' then begin
|
||||
ratioHole := 0;
|
||||
Result := True;
|
||||
end else if Name = 'nb_circumCircle' then begin
|
||||
circumCircle := 0;
|
||||
Result := True;
|
||||
end else if Name = 'nb_adjustToLinear' then begin
|
||||
adjustToLinear := 1;
|
||||
Result := True;
|
||||
end else if Name = 'nb_equalBlur' then begin
|
||||
equalBlur := 1;
|
||||
Result := True;
|
||||
end else if Name = 'nb_exactCalc' then begin
|
||||
exactCalc := 0;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationNBlur.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 9;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationNBlur.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'nb_numEdges' then begin
|
||||
Value := numEdges;
|
||||
Result := True;
|
||||
end else if Name = 'nb_numStripes' then begin
|
||||
Value := numStripes;
|
||||
Result := True;
|
||||
end else if Name = 'nb_ratioStripes' then begin
|
||||
Value := ratioStripes;
|
||||
Result := True;
|
||||
end else if Name = 'nb_ratioHole' then begin
|
||||
Value := ratioHole;
|
||||
Result := True;
|
||||
end else if Name = 'nb_circumCircle' then begin
|
||||
Value := circumCircle;
|
||||
Result := True;
|
||||
end else if Name = 'nb_adjustToLinear' then begin
|
||||
Value := adjustToLinear;
|
||||
Result := True;
|
||||
end else if Name = 'nb_equalBlur' then begin
|
||||
Value := equalBlur;
|
||||
Result := True;
|
||||
end else if Name = 'nb_exactCalc' then begin
|
||||
Value := exactCalc;
|
||||
Result := True;
|
||||
end else if Name = 'nb_highlightEdges' then begin
|
||||
Value := highlightEdges;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationNBlur), false, false);
|
||||
end.
|
||||
|
||||
188
Variations/varNGon.pas
Normal file
188
Variations/varNGon.pas
Normal file
@ -0,0 +1,188 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
You should have received a copy of the GNU General Public License
|
||||
GNU General Public License for more details.
|
||||
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varNGon;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationNGon = class(TBaseVariation)
|
||||
private
|
||||
ngon_sides : integer;
|
||||
ngon_power, ngon_circle, ngon_corners : double;
|
||||
cpower, csides, csidesinv : double;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationNGon.Prepare;
|
||||
begin
|
||||
cpower := -0.5 * ngon_power;
|
||||
csides := 2.0 * PI / ngon_sides;
|
||||
csidesinv := 1.0 / csides;
|
||||
end;
|
||||
|
||||
procedure TVariationNGon.CalcFunction;
|
||||
var
|
||||
r_factor, theta, phi, amp: double;
|
||||
begin
|
||||
|
||||
if (FTX^ = 0) and (FTY^ = 0) then r_factor := 0
|
||||
else r_factor := Power(FTx^ * FTx^ + FTy^ * FTy^, cpower);
|
||||
|
||||
theta := ArcTan2(FTy^, FTx^);
|
||||
|
||||
phi := theta - csides * floor(theta * csidesinv);
|
||||
if (phi > 0.5 * csides) then
|
||||
phi := phi - csides;
|
||||
|
||||
amp := (ngon_corners * (1.0 / cos(phi) - 1.0) + ngon_circle) * VVAR * r_factor;
|
||||
|
||||
FPx^ := FPx^ + amp * FTx^;
|
||||
FPy^ := FPy^ + amp * FTy^;
|
||||
FPz^ := FPz^ + VVAR * FTz^;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationNGon.Create;
|
||||
begin
|
||||
ngon_sides := 4;
|
||||
ngon_power := 2;
|
||||
ngon_circle := 1;
|
||||
ngon_corners := 1;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationNGon.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationNGon.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationNGon.GetName: string;
|
||||
begin
|
||||
Result := 'ngon';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationNGon.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'ngon_sides';
|
||||
1: Result := 'ngon_power';
|
||||
2: Result := 'ngon_circle';
|
||||
3: Result := 'ngon_corners';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationNGon.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'ngon_sides' then begin
|
||||
if (value < 0) and (value > -1) then Value := -1
|
||||
else if (value >= 0) and (value < 1) then Value := 1;
|
||||
ngon_sides := Round(value);
|
||||
Result := True;
|
||||
end else if Name = 'ngon_power' then begin
|
||||
ngon_power := Value;
|
||||
Result := True;
|
||||
end else if Name = 'ngon_circle' then begin
|
||||
ngon_circle := Value;
|
||||
Result := True;
|
||||
end else if Name = 'ngon_corners' then begin
|
||||
ngon_corners := Value;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
function TVariationNGon.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'ngon_sides' then begin
|
||||
ngon_sides := 4;
|
||||
Result := True;
|
||||
end else if Name = 'ngon_power' then begin
|
||||
ngon_power := 2;
|
||||
Result := True;
|
||||
end else if Name = 'ngon_circle' then begin
|
||||
ngon_circle := 1;
|
||||
Result := True;
|
||||
end else if Name = 'ngon_corners' then begin
|
||||
ngon_corners := 1;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationNGon.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 4
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationNGon.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'ngon_sides' then begin
|
||||
Value := ngon_sides;
|
||||
Result := True;
|
||||
end else if Name = 'ngon_power' then begin
|
||||
Value := ngon_power;
|
||||
Result := True;
|
||||
end else if Name = 'ngon_circle' then begin
|
||||
Value := ngon_circle;
|
||||
Result := True;
|
||||
end else if Name = 'ngon_corners' then begin
|
||||
Value := ngon_corners;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationNGon), true, false);
|
||||
end.
|
||||
316
Variations/varPDJ.pas
Normal file
316
Variations/varPDJ.pas
Normal file
@ -0,0 +1,316 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varPDJ;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
{$ifdef Apo7X64}
|
||||
{$else}
|
||||
{$define _ASM_}
|
||||
{$endif}
|
||||
|
||||
type
|
||||
TVariationPDJ = class(TBaseVariation)
|
||||
private
|
||||
FA,FB,FC,FD: double;
|
||||
|
||||
procedure CalcABC0;
|
||||
procedure CalcAB00;
|
||||
procedure CalcA000;
|
||||
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationPDJ }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationPDJ.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
if FD = 0 then begin
|
||||
if FC = 0 then begin
|
||||
if FB = 0 then
|
||||
f := CalcA000
|
||||
else
|
||||
f := CalcAB00;
|
||||
end
|
||||
else f := CalcABC0;
|
||||
end
|
||||
else f := CalcFunction;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationPDJ.CalcFunction;
|
||||
{$ifndef _ASM_}
|
||||
begin
|
||||
FPx^ := FPx^ + vvar * (sin(FA * FTy^) - cos(FB * FTx^));
|
||||
FPy^ := FPy^ + vvar * (sin(FC * FTx^) - cos(FD * FTy^));
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
{$else}
|
||||
asm
|
||||
fld qword ptr [eax + vvar]
|
||||
mov edx, [eax + FTx]
|
||||
// AV: 3D stuff, for Apo7X.15C compatibility
|
||||
fld st
|
||||
fmul qword ptr [edx + 32] // FTz
|
||||
fadd qword ptr [edx + 40] // FPz
|
||||
fstp qword ptr [edx + 40]
|
||||
// main code
|
||||
fld qword ptr [edx + 8] // FTy
|
||||
fld qword ptr [edx] // FTx
|
||||
|
||||
fld st(1)
|
||||
fmul qword ptr [eax + Fa]
|
||||
fsin
|
||||
fld st(1)
|
||||
fmul qword ptr [eax + Fb]
|
||||
fcos
|
||||
fsubp st(1), st
|
||||
fmul st, st(3)
|
||||
fadd qword ptr [edx + 16] // FPx
|
||||
fstp qword ptr [edx + 16]
|
||||
|
||||
fmul qword ptr [eax + Fc]
|
||||
fsin
|
||||
fxch st(1)
|
||||
fmul qword ptr [eax + Fd]
|
||||
fcos
|
||||
fsubp st(1), st
|
||||
fmulp
|
||||
fadd qword ptr [edx + 24] // FPy
|
||||
fstp qword ptr [edx + 24]
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationPDJ.CalcABC0;
|
||||
{$ifndef _ASM_}
|
||||
begin
|
||||
FPx^ := FPx^ + vvar * (sin(FA * FTy^) - cos(FB * FTx^));
|
||||
FPy^ := FPy^ + vvar * (sin(FC * FTx^) - 1);
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
{$else}
|
||||
asm
|
||||
fld qword ptr [eax + vvar]
|
||||
mov edx, [eax + FTx]
|
||||
// AV: for Apo7X.15C compatibility
|
||||
fld st
|
||||
fmul qword ptr [edx + 32] // FTz
|
||||
fadd qword ptr [edx + 40] // FPz
|
||||
fstp qword ptr [edx + 40]
|
||||
// main code
|
||||
fld qword ptr [edx + 8] // FTy
|
||||
fld qword ptr [edx] // FTx
|
||||
|
||||
fld st(1)
|
||||
fmul qword ptr [eax + Fa]
|
||||
fsin
|
||||
fld st(1)
|
||||
fmul qword ptr [eax + Fb]
|
||||
fcos
|
||||
fsubp st(1), st
|
||||
fmul st, st(3)
|
||||
fadd qword ptr [edx + 16] // FPx
|
||||
fstp qword ptr [edx + 16]
|
||||
|
||||
fmul qword ptr [eax + Fc]
|
||||
fsin
|
||||
fstp st(1)
|
||||
fld1
|
||||
fsubp st(1), st
|
||||
fmulp
|
||||
fadd qword ptr [edx + 24] // FPy
|
||||
fstp qword ptr [edx + 24]
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationPDJ.CalcAB00;
|
||||
{$ifndef _ASM_}
|
||||
begin
|
||||
FPx^ := FPx^ + vvar * (sin(FA * FTy^) - cos(FB * FTx^));
|
||||
FPy^ := FPy^ - vvar;
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
{$else}
|
||||
asm
|
||||
fld qword ptr [eax + vvar]
|
||||
mov edx, [eax + FTx]
|
||||
// AV: for Apo7X.15C compatibility
|
||||
fld st
|
||||
fmul qword ptr [edx + 32] // FTz
|
||||
fadd qword ptr [edx + 40] // FPz
|
||||
fstp qword ptr [edx + 40]
|
||||
// main code
|
||||
fld qword ptr [edx + 8] // FTy
|
||||
fmul qword ptr [eax + Fa]
|
||||
fsin
|
||||
fld qword ptr [edx] // FTx
|
||||
fmul qword ptr [eax + Fb]
|
||||
fcos
|
||||
fsubp st(1), st
|
||||
fmul st, st(1)
|
||||
fadd qword ptr [edx + 16] // FPx
|
||||
fstp qword ptr [edx + 16]
|
||||
|
||||
fsubr qword ptr [edx + 24] // FPy
|
||||
fstp qword ptr [edx + 24]
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationPDJ.CalcA000;
|
||||
{$ifndef _ASM_}
|
||||
begin
|
||||
FPx^ := FPx^ + vvar * (sin(FA * FTy^) - 1);
|
||||
FPy^ := FPy^ - vvar;
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
{$else}
|
||||
asm
|
||||
fld qword ptr [eax + vvar]
|
||||
mov edx, [eax + FTx]
|
||||
// AV: for Apo7X.15C compatibility
|
||||
fld st
|
||||
fmul qword ptr [edx + 32] // FTz
|
||||
fadd qword ptr [edx + 40] // FPz
|
||||
fstp qword ptr [edx + 40]
|
||||
// main code
|
||||
fld qword ptr [edx + 8] // FTy
|
||||
fmul qword ptr [eax + Fa]
|
||||
fsin
|
||||
fld1
|
||||
fsubp st(1), st
|
||||
fmul st, st(1)
|
||||
|
||||
fadd qword ptr [edx + 16] // FPx
|
||||
fstp qword ptr [edx + 16]
|
||||
|
||||
fsubr qword ptr [edx + 24] // FPy
|
||||
fstp qword ptr [edx + 24]
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationPDJ.Create;
|
||||
begin
|
||||
FA := PI * (2 * Random - 1);
|
||||
FB := PI * (2 * Random - 1);
|
||||
FC := PI * (2 * Random - 1);
|
||||
FD := PI * (2 * Random - 1);
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationPDJ.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationPDJ.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationPDJ.GetName: string;
|
||||
begin
|
||||
Result := 'pdj';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPDJ.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'pdj_a';
|
||||
1: Result := 'pdj_b';
|
||||
2: Result := 'pdj_c';
|
||||
3: Result := 'pdj_d';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPDJ.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'pdj_a' then begin
|
||||
FA := Value;
|
||||
Result := True;
|
||||
end else if Name = 'pdj_b' then begin
|
||||
FB := Value;
|
||||
Result := True;
|
||||
end else if Name = 'pdj_c' then begin
|
||||
FC := Value;
|
||||
Result := True;
|
||||
end else if Name = 'pdj_d' then begin
|
||||
FD := Value;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPDJ.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 4
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPDJ.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'pdj_a' then begin
|
||||
Value := FA;
|
||||
Result := True;
|
||||
end else if Name = 'pdj_b' then begin
|
||||
Value := FB;
|
||||
Result := True;
|
||||
end else if Name = 'pdj_c' then begin
|
||||
Value := FC;
|
||||
Result := True;
|
||||
end else if Name = 'pdj_d' then begin
|
||||
Value := FD;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationPDJ), true, false);
|
||||
end.
|
||||
146
Variations/varPopcorn2.pas
Normal file
146
Variations/varPopcorn2.pas
Normal file
@ -0,0 +1,146 @@
|
||||
{ Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina }
|
||||
|
||||
unit varPopcorn2;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationPopcorn2 = class(TBaseVariation)
|
||||
private
|
||||
p2x, p2y, p2c: double;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationPopcorn2 }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
procedure TVariationPopcorn2.CalcFunction;
|
||||
var
|
||||
sn, cn : double;
|
||||
begin
|
||||
SinCos(p2c * FTy^, sn, cn);
|
||||
if cn <> 0 then // AV: safety tangent
|
||||
sn := sin(sn / cn)
|
||||
else
|
||||
sn := 0;
|
||||
FPx^ := FPx^ + vvar * (FTx^ + p2x * sn);
|
||||
SinCos(p2c * FTx^, sn, cn);
|
||||
if cn <> 0 then // AV: safety tangent
|
||||
sn := sin(sn / cn)
|
||||
else
|
||||
sn := 0;
|
||||
FPy^ := FPy^ + vvar * (FTy^ + p2y * sn);
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationPopcorn2.GetName: string;
|
||||
begin
|
||||
Result := 'popcorn2';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPopcorn2.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'popcorn2_x';
|
||||
1: Result := 'popcorn2_y';
|
||||
2: Result := 'popcorn2_c';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPopcorn2.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 3;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPopcorn2.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'popcorn2_x' then begin
|
||||
p2x := Value;
|
||||
Result := True;
|
||||
end else if Name = 'popcorn2_y' then begin
|
||||
p2y := Value;
|
||||
Result := True;
|
||||
end else if Name = 'popcorn2_c' then begin
|
||||
p2c := Value;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationPopcorn2.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'popcorn2_x' then begin
|
||||
p2x := 0.1;
|
||||
Result := True;
|
||||
end else if Name = 'popcorn2_y' then begin
|
||||
p2y := 0.1;
|
||||
Result := True;
|
||||
end else if Name = 'popcorn2_c' then begin
|
||||
p2c := 3;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPopcorn2.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'popcorn2_x' then begin
|
||||
Value := p2x;
|
||||
Result := True;
|
||||
end else if Name = 'popcorn2_y' then begin
|
||||
Value := p2y;
|
||||
Result := True;
|
||||
end else if Name = 'popcorn2_c' then begin
|
||||
Value := p2c;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationPopcorn2.Create;
|
||||
begin
|
||||
p2c := 3;
|
||||
p2x := 0.1;
|
||||
p2y := 0.1;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationPopcorn2.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationPopcorn2.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationPopcorn2), false, false);
|
||||
end.
|
||||
188
Variations/varPostBoarders2.pas
Normal file
188
Variations/varPostBoarders2.pas
Normal file
@ -0,0 +1,188 @@
|
||||
{ Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina }
|
||||
|
||||
unit varPostBoarders2;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
const
|
||||
sb2c = 'post_boarders2_c';
|
||||
sleft = 'post_boarders2_left';
|
||||
sright = 'post_boarders2_right';
|
||||
eps: double = 1e-30;
|
||||
type
|
||||
TVariationPostBoarders2 = class(TBaseVariation)
|
||||
private
|
||||
b2c, left, right, cc, cl, cr: double;
|
||||
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationPostBoarders2 }
|
||||
|
||||
//////////////////////////////////////////
|
||||
procedure TVariationPostBoarders2.Prepare;
|
||||
begin
|
||||
cc := abs(b2c);
|
||||
cl := cc * abs(left);
|
||||
cr := cc + (cc * abs(right));
|
||||
end;
|
||||
|
||||
//////////////////////////////////////////
|
||||
procedure TVariationPostBoarders2.CalcFunction;
|
||||
var
|
||||
roundX, roundY, offsetX, offsetY: double;
|
||||
begin
|
||||
roundX := round(FPx^);
|
||||
roundY := round(FPy^);
|
||||
offsetX := FPx^ - roundX;
|
||||
offsetY := FPy^ - roundY;
|
||||
|
||||
if (random >= cr) then
|
||||
begin
|
||||
FPx^ := VVAR * (offsetX * cc + roundX);
|
||||
FPy^ := VVAR * (offsetY * cc + roundY);
|
||||
end
|
||||
else begin
|
||||
if (abs(offsetX) >= abs(offsetY)) then
|
||||
begin
|
||||
if(offsetX >= 0.0) then
|
||||
begin
|
||||
FPx^ := VVAR * (offsetX * cc + roundX + cl);
|
||||
FPy^ := VVAR * (offsetY * cc + roundY + cl * offsetY / offsetX);
|
||||
end
|
||||
else begin
|
||||
FPx^ := VVAR * (offsetX * cc + roundX - cl);
|
||||
FPy^ := VVAR * (offsetY * cc + roundY - cl * offsetY / offsetX);
|
||||
end;
|
||||
end
|
||||
else begin
|
||||
if(offsetY >= 0.0) then
|
||||
begin
|
||||
FPy^ := VVAR * (offsetY * cc + roundY + cl);
|
||||
FPx^ := VVAR * (offsetX * cc + roundX + offsetX / offsetY * cl);
|
||||
end
|
||||
else begin
|
||||
FPy^ := VVAR * (offsetY * cc + roundY - cl);
|
||||
FPx^ := VVAR * (offsetX * cc + roundX - offsetX / offsetY * cl);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
constructor TVariationPostBoarders2.Create;
|
||||
begin
|
||||
b2c := 0.5;
|
||||
left := 0.5;
|
||||
right := 0.5;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationPostBoarders2.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationPostBoarders2.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationPostBoarders2.GetName: string;
|
||||
begin
|
||||
Result := 'post_boarders2';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPostBoarders2.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index of
|
||||
0: Result := sb2c;
|
||||
1: Result := sleft;
|
||||
2: Result := sright;
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPostBoarders2.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = sb2c then begin
|
||||
if abs(value) = 0 then value := eps;
|
||||
b2c := value;
|
||||
Result := True;
|
||||
end else if Name = sleft then begin
|
||||
if abs(value) = 0 then value := eps;
|
||||
left := Value;
|
||||
Result := True;
|
||||
end else if Name = sright then begin
|
||||
if abs(value) = 0 then value := eps;
|
||||
right := Value;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationPostBoarders2.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = sb2c then begin
|
||||
b2c := 0.5;
|
||||
Result := True;
|
||||
end else if Name = sleft then begin
|
||||
left := 0.5;
|
||||
Result := True;
|
||||
end else if Name = sright then begin
|
||||
right := 0.5;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
function TVariationPostBoarders2.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 3;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPostBoarders2.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = sb2c then begin
|
||||
Value := b2c;
|
||||
Result := True;
|
||||
end else if Name = sleft then begin
|
||||
Value := left;
|
||||
Result := True;
|
||||
end else if Name = sright then begin
|
||||
Value := right;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationPostBoarders2), false, false);
|
||||
end.
|
||||
228
Variations/varPostBwraps.pas
Normal file
228
Variations/varPostBwraps.pas
Normal file
@ -0,0 +1,228 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varPostBwraps;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationPostBwraps = class(TBaseVariation)
|
||||
private
|
||||
post_bwraps_cellsize, post_bwraps_space, post_bwraps_gain,
|
||||
post_bwraps_inner_twist, post_bwraps_outer_twist,
|
||||
g2, r2, rfactor: double;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationPostBwraps.Prepare;
|
||||
var
|
||||
max_bubble, radius: double;
|
||||
begin
|
||||
radius := 0.5 * (post_bwraps_cellsize / (1.0 + sqr(post_bwraps_space)));
|
||||
g2 := sqr(post_bwraps_gain) / (radius + 1e-6) + 1e-6;
|
||||
max_bubble := g2 * radius;
|
||||
|
||||
if (max_bubble > 2.0) then max_bubble := 1.0
|
||||
else max_bubble := max_bubble * (1.0 / (sqr(max_bubble)/4.0 + 1.0));
|
||||
|
||||
r2 := sqr(radius);
|
||||
rfactor := radius / max_bubble;
|
||||
end;
|
||||
|
||||
procedure TVariationPostBwraps.CalcFunction;
|
||||
var
|
||||
Vx, Vy,
|
||||
Cx, Cy,
|
||||
Lx, Ly,
|
||||
r, theta, s, c : double;
|
||||
begin
|
||||
Vx := FPx^;
|
||||
Vy := FPy^;
|
||||
|
||||
if (post_bwraps_cellsize <> 0.0) then
|
||||
begin
|
||||
Cx := (floor(Vx / post_bwraps_cellsize) + 0.5) * post_bwraps_cellsize;
|
||||
Cy := (floor(Vy / post_bwraps_cellsize) + 0.5) * post_bwraps_cellsize;
|
||||
|
||||
Lx := Vx - Cx;
|
||||
Ly := Vy - Cy;
|
||||
|
||||
if ((sqr(Lx) + sqr(Ly)) <= r2) then
|
||||
begin
|
||||
Lx := Lx * g2;
|
||||
Ly := Ly * g2;
|
||||
|
||||
r := rfactor / ((sqr(Lx) + sqr(Ly)) / 4.0 + 1);
|
||||
|
||||
Lx := Lx * r;
|
||||
Ly := Ly * r;
|
||||
|
||||
r := (sqr(Lx) + sqr(Ly)) / r2;
|
||||
theta := post_bwraps_inner_twist * (1.0 - r) + post_bwraps_outer_twist * r;
|
||||
SinCos(theta, s, c);
|
||||
|
||||
Vx := Cx + c * Lx + s * Ly;
|
||||
Vy := Cy - s * Lx + c * Ly;
|
||||
|
||||
FPx^ := VVAR * Vx;
|
||||
FPy^ := VVAR * Vy;
|
||||
FPz^ := VVAR * FPz^;
|
||||
end;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationPostBwraps.Create;
|
||||
begin
|
||||
post_bwraps_cellsize := 1;
|
||||
post_bwraps_space := 0;
|
||||
post_bwraps_gain := 1;
|
||||
post_bwraps_inner_twist := 0;
|
||||
post_bwraps_outer_twist := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationPostBwraps.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationPostBwraps.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationPostBwraps.GetName: string;
|
||||
begin
|
||||
Result := 'post_bwraps';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPostBwraps.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'post_bwraps_cellsize';
|
||||
1: Result := 'post_bwraps_space';
|
||||
2: Result := 'post_bwraps_gain';
|
||||
3: Result := 'post_bwraps_inner_twist';
|
||||
4: Result := 'post_bwraps_outer_twist';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPostBwraps.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'post_bwraps_cellsize' then begin
|
||||
if Value = 0 then Value := 1e-6;
|
||||
post_bwraps_cellsize := Value;
|
||||
Result := True;
|
||||
end else if Name = 'post_bwraps_space' then begin
|
||||
post_bwraps_space := Value;
|
||||
Result := True;
|
||||
end else if Name = 'post_bwraps_gain' then begin
|
||||
post_bwraps_gain := Value;
|
||||
Result := True;
|
||||
end else if Name = 'post_bwraps_inner_twist' then begin
|
||||
post_bwraps_inner_twist := Value;
|
||||
Result := True;
|
||||
end else if Name = 'post_bwraps_outer_twist' then begin
|
||||
post_bwraps_outer_twist := Value;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
function TVariationPostBwraps.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'post_bwraps_cellsize' then begin
|
||||
post_bwraps_cellsize := 1;
|
||||
Result := True;
|
||||
end else if Name = 'post_bwraps_space' then begin
|
||||
post_bwraps_space := 0;
|
||||
Result := True;
|
||||
end else if Name = 'post_bwraps_gain' then begin
|
||||
post_bwraps_gain := 1;
|
||||
Result := True;
|
||||
end else if Name = 'post_bwraps_inner_twist' then begin
|
||||
post_bwraps_inner_twist := 0;
|
||||
Result := True;
|
||||
end else if Name = 'post_bwraps_outer_twist' then begin
|
||||
post_bwraps_outer_twist := 0;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPostBwraps.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 5
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPostBwraps.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'post_bwraps_cellsize' then begin
|
||||
Value := post_bwraps_cellsize;
|
||||
Result := True;
|
||||
end else if Name = 'post_bwraps_space' then begin
|
||||
Value := post_bwraps_space;
|
||||
Result := True;
|
||||
end else if Name = 'post_bwraps_gain' then begin
|
||||
Value := post_bwraps_gain;
|
||||
Result := True;
|
||||
end else if Name = 'post_bwraps_inner_twist' then begin
|
||||
Value := post_bwraps_inner_twist;
|
||||
Result := True;
|
||||
end else if Name = 'post_bwraps_outer_twist' then begin
|
||||
Value := post_bwraps_outer_twist;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationPostBwraps), true, false);
|
||||
end.
|
||||
203
Variations/varPostCircleCrop.pas
Normal file
203
Variations/varPostCircleCrop.pas
Normal file
@ -0,0 +1,203 @@
|
||||
{ Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina }
|
||||
|
||||
unit varPostCircleCrop;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationPostCircleCrop = class(TBaseVariation)
|
||||
|
||||
const
|
||||
sx : string = 'post_circlecrop_x';
|
||||
sy : string = 'post_circlecrop_y';
|
||||
sradius : string = 'post_circlecrop_radius';
|
||||
szero : string = 'post_circlecrop_zero';
|
||||
sarea : string = 'post_circlecrop_scatter_area';
|
||||
|
||||
private
|
||||
x0, y0, radius, scatter_area, ca: double;
|
||||
zero: byte;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationPostCircleCrop }
|
||||
|
||||
//////////////////////////////////////////
|
||||
|
||||
procedure TVariationPostCircleCrop.Prepare;
|
||||
begin
|
||||
ca := max(-1.0, min(scatter_area, 1.0));
|
||||
end;
|
||||
|
||||
procedure TVariationPostCircleCrop.CalcFunction;
|
||||
var
|
||||
x, y, rad, ang, rdc, sn, cn: double;
|
||||
begin
|
||||
x := FPx^ - x0;
|
||||
y := FPy^ - y0;
|
||||
rad := Hypot(x, y);
|
||||
|
||||
if (rad > radius) then
|
||||
begin
|
||||
if (zero = 1) then
|
||||
begin
|
||||
FPx^ := 0;
|
||||
FPy^ := 0;
|
||||
end else
|
||||
begin
|
||||
ang := arctan2(y, x);
|
||||
SinCos(ang, sn, cn);
|
||||
rdc := radius + (random * 0.5 * ca);
|
||||
|
||||
FPx^ := vvar * rdc * cn + x0;
|
||||
FPy^ := vvar * rdc * sn + y0;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
FPx^ := vvar * x + x0;
|
||||
FPy^ := vvar * y + y0;
|
||||
end;
|
||||
end;
|
||||
|
||||
constructor TVariationPostCircleCrop.Create;
|
||||
begin
|
||||
x0 := 0;
|
||||
y0 := 0;
|
||||
radius := 1;
|
||||
scatter_area := 0;
|
||||
zero := 0;
|
||||
end;
|
||||
|
||||
class function TVariationPostCircleCrop.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationPostCircleCrop.Create;
|
||||
end;
|
||||
|
||||
class function TVariationPostCircleCrop.GetName: string;
|
||||
begin
|
||||
Result := 'post_circlecrop';
|
||||
end;
|
||||
|
||||
function TVariationPostCircleCrop.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 5;
|
||||
end;
|
||||
|
||||
function TVariationPostCircleCrop.GetVariable(const Name: string;
|
||||
var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = sx then begin
|
||||
Value := x0;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sy then begin
|
||||
Value := y0;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sradius then begin
|
||||
Value := radius;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sarea then begin
|
||||
Value := scatter_area;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = szero then begin
|
||||
Value := zero;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationPostCircleCrop.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := sradius;
|
||||
1: Result := sx;
|
||||
2: Result := sy;
|
||||
3: Result := sarea;
|
||||
4: Result := szero;
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationPostCircleCrop.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = sx then begin
|
||||
x0 := 0;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sy then begin
|
||||
y0 := 0;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sradius then begin
|
||||
radius := 1;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sarea then begin
|
||||
scatter_area := 0;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = szero then begin
|
||||
zero := 0;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationPostCircleCrop.SetVariable(const Name: string;
|
||||
var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = sx then begin
|
||||
x0 := Value;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sy then begin
|
||||
y0 := Value;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sradius then begin
|
||||
radius := Value;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sarea then begin
|
||||
scatter_area := Value;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = szero then begin
|
||||
if Value < 0 then Value := 0;
|
||||
if Value > 1 then Value := 1;
|
||||
zero := Round(Value);
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationPostCircleCrop), false, false);
|
||||
|
||||
end.
|
||||
311
Variations/varPostCrop.pas
Normal file
311
Variations/varPostCrop.pas
Normal file
@ -0,0 +1,311 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varPostCrop;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationPostCrop = class(TBaseVariation)
|
||||
const
|
||||
n_x0 : string = 'post_crop_left';
|
||||
n_y0 : string = 'post_crop_top';
|
||||
n_x1 : string = 'post_crop_right';
|
||||
n_y1 : string = 'post_crop_bottom';
|
||||
n_s : string = 'post_crop_scatter_area';
|
||||
n_z : string = 'post_crop_zero';
|
||||
n : string = 'post_crop';
|
||||
n_z1 : string = 'post_crop_high'; // AV
|
||||
n_z0 : string = 'post_crop_low'; //AV
|
||||
n_3D : string = 'post_crop_use3D'; // AV
|
||||
private
|
||||
x0, y0, x1, y1, z0, z1, s, w, h, l: double;
|
||||
_x0, _y0, _x1, _y1, _z0, _z1: double;
|
||||
z, c3D: byte;
|
||||
|
||||
procedure Calc2D;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationPostCrop.Prepare;
|
||||
begin
|
||||
if (x0 < x1) then begin
|
||||
_x0 := x0;
|
||||
_x1 := x1;
|
||||
end else begin
|
||||
_x0 := x1;
|
||||
_x1 := x0;
|
||||
end;
|
||||
|
||||
if (y0 < y1) then begin
|
||||
_y0 := y0;
|
||||
_y1 := y1;
|
||||
end else begin
|
||||
_y0 := y1;
|
||||
_y1 := y0;
|
||||
end;
|
||||
|
||||
if (z0 < z1) then begin
|
||||
_z0 := z0;
|
||||
_z1 := z1;
|
||||
end else begin
|
||||
_z0 := z1;
|
||||
_z1 := z0;
|
||||
end;
|
||||
|
||||
w := (_x1 - _x0) * 0.5 * s;
|
||||
h := (_y1 - _y0) * 0.5 * s;
|
||||
l := (_z1 - _z0) * 0.5 * s;
|
||||
end;
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
procedure TVariationPostCrop.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
if (c3D = 0) then f := Calc2D
|
||||
else f := CalcFunction;
|
||||
end;
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
procedure TVariationPostCrop.CalcFunction;
|
||||
var x, y, tz: double;
|
||||
begin
|
||||
x := FPx^;
|
||||
y := FPy^;
|
||||
tz := FPz^;
|
||||
|
||||
if ((x < _x0) or (x > _x1) or (y < _y0) or (y > _y1) or (tz < _z0) or (tz > _z1))
|
||||
and (z <> 0) then begin
|
||||
x := 0; y := 0; tz := 0;
|
||||
end else begin
|
||||
if x < _x0 then x := _x0 + random * w
|
||||
else if x > _x1 then x := _x1 - random * w;
|
||||
if y < _y0 then y := _y0 + random * h
|
||||
else if y > _y1 then y := _y1 - random * h;
|
||||
if tz < _z0 then tz := _z0 + random * l
|
||||
else if tz > _z1 then tz := _z1 - random * l;
|
||||
end;
|
||||
|
||||
FPx^ := VVAR * x;
|
||||
FPy^ := VVAR * y;
|
||||
FPz^ := VVAR * tz;
|
||||
end;
|
||||
|
||||
procedure TVariationPostCrop.Calc2D;
|
||||
var x, y: double;
|
||||
begin
|
||||
x := FPx^;
|
||||
y := FPy^;
|
||||
|
||||
if ((x < _x0) or (x > _x1) or (y < _y0) or (y > _y1)) and (z <> 0) then begin
|
||||
x := 0; y := 0;
|
||||
end else begin
|
||||
if x < _x0 then x := _x0 + random * w
|
||||
else if x > _x1 then x := _x1 - random * w;
|
||||
if y < _y0 then y := _y0 + random * h
|
||||
else if y > _y1 then y := _y1 - random * h;
|
||||
end;
|
||||
|
||||
FPx^ := VVAR * x;
|
||||
FPy^ := VVAR * y;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationPostCrop.Create;
|
||||
begin
|
||||
x0 := -1; x1 := 1;
|
||||
y0 := -1; y1 := 1;
|
||||
z0 := -1; z1 := 1;
|
||||
c3D := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationPostCrop.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationPostCrop.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationPostCrop.GetName: string;
|
||||
begin
|
||||
Result := n;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPostCrop.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := n_x0;
|
||||
1: Result := n_y0;
|
||||
2: Result := n_x1;
|
||||
3: Result := n_y1;
|
||||
4: Result := n_z0;
|
||||
5: Result := n_z1;
|
||||
6: Result := n_s;
|
||||
7: Result := n_z;
|
||||
8: Result := n_3D;
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPostCrop.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = n_x0 then begin
|
||||
x0 := Value;
|
||||
Result := True;
|
||||
end else if Name = n_y0 then begin
|
||||
y0 := Value;
|
||||
Result := True;
|
||||
end else if Name = n_x1 then begin
|
||||
x1 := Value;
|
||||
Result := True;
|
||||
end else if Name = n_y1 then begin
|
||||
y1 := Value;
|
||||
Result := True;
|
||||
end else if Name = n_z0 then begin
|
||||
z0 := Value;
|
||||
Result := True;
|
||||
end else if Name = n_z1 then begin
|
||||
z1 := Value;
|
||||
Result := True;
|
||||
end else if Name = n_s then begin
|
||||
if (Value < -1) then Value := -1;
|
||||
if (Value > 1) then Value := 1;
|
||||
s := Value;
|
||||
Result := True;
|
||||
end else if Name = n_z then begin
|
||||
if (Value > 1) then Value := 1;
|
||||
if (Value < 0) then Value := 0;
|
||||
z := Round(Value);
|
||||
Result := True;
|
||||
end else if Name = n_3d then begin
|
||||
if (Value > 1) then Value := 1;
|
||||
if (Value < 0) then Value := 0;
|
||||
c3D := Round(Value);
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
function TVariationPostCrop.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = n_x0 then begin
|
||||
x0 := -1;
|
||||
Result := True;
|
||||
end else if Name = n_y0 then begin
|
||||
y0 := -1;
|
||||
Result := True;
|
||||
end else if Name = n_x1 then begin
|
||||
x1 := 1;
|
||||
Result := True;
|
||||
end else if Name = n_y1 then begin
|
||||
y1 := 1;
|
||||
Result := True;
|
||||
end else if Name = n_z0 then begin
|
||||
z0 := -1;
|
||||
Result := True;
|
||||
end else if Name = n_z1 then begin
|
||||
z1 := 1;
|
||||
Result := True;
|
||||
end else if Name = n_s then begin
|
||||
s := 0;
|
||||
Result := True;
|
||||
end else if Name = n_z then begin
|
||||
z := 0;
|
||||
Result := True;
|
||||
end else if Name = n_3D then begin
|
||||
c3D := 0;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPostCrop.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 9
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPostCrop.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = n_x0 then begin
|
||||
Value := x0;
|
||||
Result := True;
|
||||
end else if Name = n_y0 then begin
|
||||
Value := y0;
|
||||
Result := True;
|
||||
end else if Name = n_x1 then begin
|
||||
Value := x1;
|
||||
Result := True;
|
||||
end else if Name = n_y1 then begin
|
||||
Value := y1;
|
||||
Result := True;
|
||||
end else if Name = n_z0 then begin
|
||||
Value := z0;
|
||||
Result := True;
|
||||
end else if Name = n_z1 then begin
|
||||
Value := z1;
|
||||
Result := True;
|
||||
end else if Name = n_s then begin
|
||||
Value := s;
|
||||
Result := True;
|
||||
end else if Name = n_z then begin
|
||||
Value := z;
|
||||
Result := True;
|
||||
end else if Name = n_3D then begin
|
||||
Value := c3D;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationPostCrop), true, false);
|
||||
end.
|
||||
376
Variations/varPostCurl.pas
Normal file
376
Variations/varPostCurl.pas
Normal file
@ -0,0 +1,376 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varPostCurl;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
const
|
||||
variation_name = 'post_curl';
|
||||
num_vars = 2;
|
||||
|
||||
{$ifdef Apo7X64}
|
||||
{$else}
|
||||
{$define _ASM_}
|
||||
{$endif}
|
||||
|
||||
type
|
||||
TVariationPostCurl = class(TBaseVariation)
|
||||
private
|
||||
c1, c2, c2x2: double;
|
||||
|
||||
procedure CalcZeroC2;
|
||||
procedure CalcZeroC1;
|
||||
procedure CalcZeroC2C1;
|
||||
public
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
// TVariationPostCurl
|
||||
|
||||
///////////////////////////////
|
||||
procedure TVariationPostCurl.Prepare;
|
||||
begin
|
||||
// AV: fixed - it's wrong when vvar <> 1
|
||||
//c1 := c1 * VVAR;
|
||||
//c2 := c2 * VVAR;
|
||||
c2x2 := 2 * c2;
|
||||
end;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationPostCurl.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
if IsZero(c1) then begin
|
||||
if IsZero(c2) then
|
||||
f := CalcZeroC2C1
|
||||
else
|
||||
f := CalcZeroC1
|
||||
end
|
||||
else begin
|
||||
if IsZero(c2) then
|
||||
f := CalcZeroC2
|
||||
else
|
||||
f := CalcFunction
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationPostCurl.CalcFunction;
|
||||
{$ifndef _ASM_}
|
||||
var
|
||||
x, y, r, re, im: double;
|
||||
begin
|
||||
x := FPx^;
|
||||
y := FPy^;
|
||||
|
||||
re := 1 + c1 * x + c2 * (sqr(x) - sqr(y));
|
||||
im := c1 * y + c2x2 * x * y;
|
||||
|
||||
r := vvar / (sqr(re) + sqr(im));
|
||||
FPx^ := (x * re + y * im) * r;
|
||||
FPy^ := (y * re - x * im) * r;
|
||||
{$else}
|
||||
asm
|
||||
mov edx, [eax + FTx]
|
||||
|
||||
fld qword ptr [edx + 24] // FPy
|
||||
fld qword ptr [edx + 16] // FPx
|
||||
fld st(1)
|
||||
fmul st, st(1)
|
||||
fmul qword ptr [eax + c2x2]
|
||||
fld st(2)
|
||||
fmul qword ptr [eax + c1]
|
||||
faddp
|
||||
fld st(2)
|
||||
fmul st, st
|
||||
fld st(2)
|
||||
fmul st, st
|
||||
fsubrp
|
||||
fmul qword ptr [eax + c2]
|
||||
fld1
|
||||
faddp
|
||||
fld st(2)
|
||||
fmul qword ptr [eax + c1]
|
||||
faddp
|
||||
|
||||
fld st(1)
|
||||
fmul st, st
|
||||
fld st(1)
|
||||
fmul st, st
|
||||
faddp
|
||||
fdivr qword ptr [eax + vvar]
|
||||
|
||||
fld st(3)
|
||||
fmul st, st(2)
|
||||
fld st(5)
|
||||
fmul st, st(4)
|
||||
faddp
|
||||
fmul st, st(1)
|
||||
|
||||
fstp qword ptr [edx + 16] // FPx
|
||||
|
||||
fxch st(4)
|
||||
fmulp
|
||||
fxch st(2)
|
||||
fmulp
|
||||
fsubp
|
||||
fmulp
|
||||
|
||||
fstp qword ptr [edx + 24] // FPy
|
||||
{$endif}
|
||||
end;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationPostCurl.CalcZeroC2; // AV: Mobius case
|
||||
{$ifndef _ASM_}
|
||||
var
|
||||
r, x, y: double;
|
||||
re, im: double;
|
||||
begin
|
||||
x := FPx^;
|
||||
y := FPy^;
|
||||
re := 1 + c1 * x;
|
||||
im := c1 * y;
|
||||
|
||||
r := vvar / (sqr(re) + sqr(im));
|
||||
|
||||
FPx^ := (x*re + y*im) * r;
|
||||
FPy^ := (y*re - x*im) * r;
|
||||
//FPz^ := vvar * FPz^;
|
||||
{$else}
|
||||
asm
|
||||
mov edx, [eax + FTx]
|
||||
|
||||
fld qword ptr [edx + 24] // FPy
|
||||
fld qword ptr [edx + 16] // FPx
|
||||
fld st(1)
|
||||
fld qword ptr [eax + c1]
|
||||
fmul st(1), st
|
||||
fmul st, st(2)
|
||||
fld1
|
||||
faddp
|
||||
|
||||
fld st(1)
|
||||
fmul st, st
|
||||
fld st(1)
|
||||
fmul st, st
|
||||
faddp
|
||||
fdivr qword ptr [eax + vvar]
|
||||
|
||||
fld st(3)
|
||||
fmul st, st(2)
|
||||
fld st(5)
|
||||
fmul st, st(4)
|
||||
faddp
|
||||
fmul st, st(1)
|
||||
|
||||
fstp qword ptr [edx + 16] // FPx
|
||||
|
||||
fxch st(4)
|
||||
fmulp
|
||||
fxch st(2)
|
||||
fmulp
|
||||
fsubp
|
||||
fmulp
|
||||
|
||||
fstp qword ptr [edx + 24] // FPy
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TVariationPostCurl.CalcZeroC1;
|
||||
{$ifndef _ASM_}
|
||||
var
|
||||
r, x, y: double;
|
||||
re, im: double;
|
||||
begin
|
||||
x := FPx^;
|
||||
y := FPy^;
|
||||
re := 1 + c2*(sqr(x) - sqr(y));
|
||||
im := c2x2 * x * y;
|
||||
|
||||
r := vvar / (sqr(re) + sqr(im));
|
||||
|
||||
FPx^ := (x*re + y*im) * r;
|
||||
FPy^ := (y*re - x*im) * r;
|
||||
|
||||
{$else}
|
||||
asm
|
||||
mov edx, [eax + FTx]
|
||||
|
||||
fld qword ptr [edx + 24] // FPy
|
||||
fld qword ptr [edx + 16] // FPx
|
||||
fld st(1)
|
||||
fmul st, st(1)
|
||||
fmul qword ptr [eax + c2x2]
|
||||
fld st(2)
|
||||
fmul st, st
|
||||
fld st(2)
|
||||
fmul st, st
|
||||
fsubrp
|
||||
fmul qword ptr [eax + c2]
|
||||
fld1
|
||||
faddp
|
||||
|
||||
fld st(1)
|
||||
fmul st, st
|
||||
fld st(1)
|
||||
fmul st, st
|
||||
faddp
|
||||
fdivr qword ptr [eax + vvar]
|
||||
|
||||
fld st(3)
|
||||
fmul st, st(2)
|
||||
fld st(5)
|
||||
fmul st, st(4)
|
||||
faddp
|
||||
fmul st, st(1)
|
||||
|
||||
fstp qword ptr [edx + 16] // FPx
|
||||
|
||||
fxch st(4)
|
||||
fmulp
|
||||
fxch st(2)
|
||||
fmulp
|
||||
fsubp
|
||||
fmulp
|
||||
|
||||
fstp qword ptr [edx + 24] // FPy
|
||||
//fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TVariationPostCurl.CalcZeroC2C1; // AV: linear case
|
||||
{$ifndef _ASM_}
|
||||
var
|
||||
r: double;
|
||||
begin
|
||||
FPx^ := vvar * FPx^;
|
||||
FPy^ := vvar * FPy^;
|
||||
{$else}
|
||||
asm
|
||||
fld qword ptr [eax + vvar]
|
||||
mov edx, [eax + FTx]
|
||||
fld qword ptr [edx + 16] // FPx
|
||||
fmul st, st(1)
|
||||
fstp qword ptr [edx + 16]
|
||||
|
||||
fld qword ptr [edx + 24] // FPy
|
||||
fmulp
|
||||
fstp qword ptr [edx + 24]
|
||||
//fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
|
||||
class function TVariationPostCurl.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationPostCurl.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationPostCurl.GetName: string;
|
||||
begin
|
||||
Result := variation_name;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPostCurl.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index of
|
||||
0: Result := 'post_curl_c1';
|
||||
1: Result := 'post_curl_c2';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPostCurl.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'post_curl_c1' then begin
|
||||
c1 := value;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = 'post_curl_c2' then begin
|
||||
c2 := value;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationPostCurl.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'post_curl_c1' then begin
|
||||
c1 := 0;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = 'post_curl_c2' then begin
|
||||
c2 := 0;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPostCurl.GetNrVariables: integer;
|
||||
begin
|
||||
Result := num_vars;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPostCurl.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'post_curl_c1' then begin
|
||||
value := c1;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = 'post_curl_c2' then begin
|
||||
value := c2;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationPostCurl), false, false);
|
||||
end.
|
||||
276
Variations/varPostCurl3D.pas
Normal file
276
Variations/varPostCurl3D.pas
Normal file
@ -0,0 +1,276 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varPostCurl3D;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
const
|
||||
variation_name = 'post_curl3D';
|
||||
num_vars = 3;
|
||||
var_cx_name = 'post_curl3D_cx';
|
||||
var_cy_name = 'post_curl3D_cy';
|
||||
var_cz_name = 'post_curl3D_cz';
|
||||
|
||||
type
|
||||
TVariationPostCurl3D = class(TBaseVariation)
|
||||
private
|
||||
cx, cy, cz: double;
|
||||
//_cx, _cy, _cz, // AV: now unused
|
||||
cx2, cy2, cz2, c2,
|
||||
c2x, c2y, c2z: double;
|
||||
|
||||
procedure CalcCx;
|
||||
procedure CalcCy;
|
||||
procedure CalcCz;
|
||||
procedure CalcLinear;
|
||||
public
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
// TVariationCurl3D
|
||||
|
||||
procedure TVariationPostCurl3D.Prepare;
|
||||
begin
|
||||
// AV : fixed when VVAR <> 1
|
||||
//_cx := VVAR * cx;
|
||||
//_cy := VVAR * cy;
|
||||
//_cz := VVAR * cz;
|
||||
|
||||
c2x := 2 * cx;
|
||||
c2y := 2 * cy;
|
||||
c2z := 2 * cz;
|
||||
|
||||
cx2 := sqr(cx);
|
||||
cy2 := sqr(cy);
|
||||
cz2 := sqr(cz);
|
||||
|
||||
c2 := cx2 + cy2 + cz2;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationPostCurl3D.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
|
||||
if IsZero(cx) then begin
|
||||
if IsZero(cy) then begin
|
||||
if IsZero(cz) then
|
||||
f := CalcLinear
|
||||
else
|
||||
f := CalcCz;
|
||||
end
|
||||
else begin
|
||||
if IsZero(cz) then
|
||||
f := CalcCy
|
||||
else
|
||||
f := CalcFunction;
|
||||
end
|
||||
end
|
||||
else begin
|
||||
if IsZero(cy) and IsZero(cz) then
|
||||
f := CalcCx
|
||||
else
|
||||
f := CalcFunction;
|
||||
end;
|
||||
|
||||
f := CalcFunction;
|
||||
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationPostCurl3D.CalcFunction;
|
||||
var
|
||||
x, y, z, r, r2: double;
|
||||
begin
|
||||
x := Max(-1e100, Min(FPx^, 1e100)); // <--- got weird FP overflow there...
|
||||
y := Max(-1e100, Min(FPy^, 1e100));
|
||||
z := Max(-1e100, Min(FPz^, 1e100));
|
||||
|
||||
r2 := sqr(x) + sqr(y) + sqr(z);
|
||||
r := vvar / (r2 * c2 + c2x * x - c2y * y + c2z * z + 1);
|
||||
|
||||
FPx^ := r * (x + cx * r2);
|
||||
FPy^ := r * (y - cy * r2); // AV: fixed the sign
|
||||
FPz^ := r * (z + cz * r2);
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationPostCurl3D.CalcCx;
|
||||
var
|
||||
x, r, r2: double;
|
||||
begin
|
||||
r2 := sqr(FPx^) + sqr(FPy^) + sqr(FPz^);
|
||||
|
||||
r := vvar / (cx2*r2 + c2x*FPx^ + 1);
|
||||
|
||||
FPx^ := r * (FPx^ + cx*r2);
|
||||
FPy^ := r * FPy^;
|
||||
FPz^ := r * FPz^;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationPostCurl3D.CalcCy;
|
||||
var
|
||||
r, r2: double;
|
||||
begin
|
||||
r2 := sqr(FPx^) + sqr(FPy^) + sqr(FPz^);
|
||||
|
||||
r := vvar / (cy2*r2 - c2y*FPy^ + 1);
|
||||
|
||||
FPx^ := r * FPx^;
|
||||
FPy^ := r * (FPy^ - cy*r2);
|
||||
FPz^ := r * FPz^;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationPostCurl3D.CalcCz;
|
||||
var
|
||||
r, r2: double;
|
||||
begin
|
||||
r2 := sqr(FPx^) + sqr(FPy^) + sqr(FPz^);
|
||||
|
||||
r := vvar / (cz2*r2 + c2z*FPz^ + 1);
|
||||
|
||||
FPx^ := r * FPx^;
|
||||
FPy^ := r * FPy^;
|
||||
FPz^ := r * (FPz^ + cz*r2);
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationPostCurl3D.CalcLinear;
|
||||
var
|
||||
r: double;
|
||||
begin
|
||||
FPx^ := vvar * FTx^;
|
||||
FPy^ := vvar * FTy^;
|
||||
FPz^ := vvar * FTz^;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class function TVariationPostCurl3D.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationPostCurl3D.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationPostCurl3D.GetName: string;
|
||||
begin
|
||||
Result := variation_name;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPostCurl3D.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index of
|
||||
0: Result := var_cx_name;
|
||||
1: Result := var_cy_name;
|
||||
2: Result := var_cz_name;
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPostCurl3D.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = var_cx_name then begin
|
||||
cx := value;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = var_cy_name then begin
|
||||
cy := value;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = var_cz_name then begin
|
||||
cz := value;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationPostCurl3D.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = var_cx_name then begin
|
||||
cx := 0;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = var_cy_name then begin
|
||||
cy := 0;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = var_cz_name then begin
|
||||
cz := 0;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPostCurl3D.GetNrVariables: integer;
|
||||
begin
|
||||
Result := num_vars;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPostCurl3D.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = var_cx_name then begin
|
||||
value := cx;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = var_cy_name then begin
|
||||
value := cy;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = var_cz_name then begin
|
||||
value := cz;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationPostCurl3D), true, false);
|
||||
end.
|
||||
348
Variations/varPostFalloff2.pas
Normal file
348
Variations/varPostFalloff2.pas
Normal file
@ -0,0 +1,348 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varPostFalloff2;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationPostFalloff2 = class(TBaseVariation)
|
||||
const
|
||||
n_scatter : string = 'post_falloff2_scatter';
|
||||
n_mindist : string = 'post_falloff2_mindist';
|
||||
n_mul_x : string = 'post_falloff2_mul_x';
|
||||
n_mul_y : string = 'post_falloff2_mul_y';
|
||||
n_mul_z : string = 'post_falloff2_mul_z';
|
||||
n_mul_c : string = 'post_falloff2_mul_c';
|
||||
n_x0 : string = 'post_falloff2_x0';
|
||||
n_y0 : string = 'post_falloff2_y0';
|
||||
n_z0 : string = 'post_falloff2_z0';
|
||||
n_invert : string = 'post_falloff2_invert';
|
||||
n_blurtype : string = 'post_falloff2_type';
|
||||
|
||||
private
|
||||
rmax: double;
|
||||
x0, y0, z0: double;
|
||||
scatter, mindist: double;
|
||||
invert, blurtype: integer;
|
||||
mul_x, mul_y, mul_z, mul_c: double;
|
||||
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
procedure CalcFunctionRadial;
|
||||
procedure CalcFunctionGaussian;
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationPostFalloff2.Prepare;
|
||||
begin
|
||||
rmax := 0.04 * scatter;
|
||||
end;
|
||||
|
||||
procedure TVariationPostFalloff2.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
if blurtype = 1 then f := CalcFunctionRadial
|
||||
else if blurtype = 2 then f := CalcFunctionGaussian
|
||||
else f := CalcFunction;
|
||||
end;
|
||||
procedure TVariationPostFalloff2.CalcFunction;
|
||||
var
|
||||
in_x, in_y, in_z, d: double;
|
||||
begin
|
||||
in_x := FPx^;
|
||||
in_y := FPy^;
|
||||
in_z := FPz^;
|
||||
|
||||
d := sqrt(sqr(in_x - x0) + sqr(in_y - y0) + sqr(in_z - z0));
|
||||
if (invert <> 0) then d := 1 - d; if (d < 0) then d := 0;
|
||||
d := (d - mindist) * rmax; if (d < 0) then d := 0;
|
||||
|
||||
FPx^ := VVAR * (in_x + mul_x * random * d);
|
||||
FPy^ := VVAR * (in_y + mul_y * random * d);
|
||||
FPz^ := VVAR * (in_z + mul_z * random * d);
|
||||
color^ := Abs(Frac(color^ + mul_c * random * d));
|
||||
end;
|
||||
procedure TVariationPostFalloff2.CalcFunctionRadial;
|
||||
var
|
||||
in_x, in_y, in_z, d, r_in: double;
|
||||
sigma, phi, r, sins, coss, sinp, cosp: double;
|
||||
begin
|
||||
in_x := FPx^;
|
||||
in_y := FPy^;
|
||||
in_z := FPz^;
|
||||
|
||||
r_in := sqrt(sqr(in_x) + sqr(in_y) + sqr(in_z)) + 1e-6;
|
||||
d := sqrt(sqr(in_x - x0) + sqr(in_y - y0) + sqr(in_z - z0));
|
||||
if (invert <> 0) then d := 1 - d; if (d < 0) then d := 0;
|
||||
d := (d - mindist) * rmax; if (d < 0) then d := 0;
|
||||
|
||||
sigma := ArcSin(in_z / r_in) + mul_z * random * d;
|
||||
phi := ArcTan2(in_y, in_x) + mul_y * random * d;
|
||||
r := r_in + mul_x * random * d;
|
||||
|
||||
SinCos(sigma, sins, coss);
|
||||
SinCos(phi, sinp, cosp);
|
||||
|
||||
FPx^ := VVAR * (r * coss * cosp);
|
||||
FPy^ := VVAR * (r * coss * sinp);
|
||||
FPz^ := VVAR * (sins);
|
||||
color^ := Abs(Frac(color^ + mul_c * random * d));
|
||||
end;
|
||||
procedure TVariationPostFalloff2.CalcFunctionGaussian;
|
||||
var
|
||||
in_x, in_y, in_z, d: double;
|
||||
sigma, phi, r, sins, coss, sinp, cosp: double;
|
||||
begin
|
||||
in_x := FPx^;
|
||||
in_y := FPy^;
|
||||
in_z := FPz^;
|
||||
|
||||
d := sqrt(sqr(in_x - x0) + sqr(in_y - y0) + sqr(in_z - z0));
|
||||
if (invert <> 0) then d := 1 - d; if (d < 0) then d := 0;
|
||||
d := (d - mindist) * rmax; if (d < 0) then d := 0;
|
||||
|
||||
sigma := d * random * 2 * PI;
|
||||
phi := d * random * PI;
|
||||
r := d * random;
|
||||
|
||||
SinCos(sigma, sins, coss);
|
||||
SinCos(phi, sinp, cosp);
|
||||
|
||||
FPx^ := VVAR * (in_x + mul_x * r * coss * cosp);
|
||||
FPy^ := VVAR * (in_y + mul_y * r * coss * sinp);
|
||||
FPz^ := VVAR * (in_z + mul_z * r * sins);
|
||||
color^ := Abs(Frac(color^ + mul_c * random * d));
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationPostFalloff2.Create;
|
||||
begin
|
||||
scatter := 1;
|
||||
mindist := 0.5;
|
||||
mul_x := 1;
|
||||
mul_y := 1;
|
||||
mul_z := 0;
|
||||
mul_c := 0;
|
||||
x0 := 0;
|
||||
y0 := 0;
|
||||
z0 := 0;
|
||||
invert := 0;
|
||||
blurtype := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationPostFalloff2.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationPostFalloff2.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationPostFalloff2.GetName: string;
|
||||
begin
|
||||
Result := 'post_falloff2';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPostFalloff2.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := n_scatter;
|
||||
1: Result := n_mindist;
|
||||
2: Result := n_mul_x;
|
||||
3: Result := n_mul_y;
|
||||
4: Result := n_mul_z;
|
||||
5: Result := n_mul_c;
|
||||
6: Result := n_x0;
|
||||
7: Result := n_y0;
|
||||
8: Result := n_z0;
|
||||
9: Result := n_invert;
|
||||
10: Result := n_blurtype;
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPostFalloff2.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = n_scatter then begin
|
||||
if Value < 1e-6 then Value := 1e-6;
|
||||
scatter := Value;
|
||||
Result := True;
|
||||
end else if Name = n_mindist then begin
|
||||
if Value < 0 then Value := 0;
|
||||
mindist := Value;
|
||||
Result := True;
|
||||
end else if Name = n_mul_x then begin
|
||||
if Value < 0 then Value := 0
|
||||
else if Value > 1 then Value := 1;
|
||||
mul_x := Value;
|
||||
Result := True;
|
||||
end else if Name = n_mul_y then begin
|
||||
if Value < 0 then Value := 0
|
||||
else if Value > 1 then Value := 1;
|
||||
mul_y := Value;
|
||||
Result := True;
|
||||
end else if Name = n_mul_z then begin
|
||||
if Value < 0 then Value := 0
|
||||
else if Value > 1 then Value := 1;
|
||||
mul_z := Value;
|
||||
Result := True;
|
||||
end else if Name = n_mul_c then begin
|
||||
if Value < 0 then Value := 0
|
||||
else if Value > 1 then Value := 1;
|
||||
mul_c := Value;
|
||||
Result := True;
|
||||
end else if Name = n_x0 then begin
|
||||
x0 := Value;
|
||||
Result := True;
|
||||
end else if Name = n_y0 then begin
|
||||
y0 := Value;
|
||||
Result := True;
|
||||
end else if Name = n_z0 then begin
|
||||
z0 := Value;
|
||||
Result := True;
|
||||
end else if Name = n_invert then begin
|
||||
if (Value > 1) then Value := 1;
|
||||
if (Value < 0) then Value := 0;
|
||||
invert := Round(Value);
|
||||
Result := True;
|
||||
end else if Name = n_blurtype then begin
|
||||
if (Value > 2) then Value := 2;
|
||||
if (Value < 0) then Value := 0;
|
||||
blurtype := Round(Value);
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
function TVariationPostFalloff2.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = n_scatter then begin
|
||||
scatter := 1;
|
||||
Result := True;
|
||||
end else if Name = n_mindist then begin
|
||||
mindist := 0.5;
|
||||
Result := True;
|
||||
end else if Name = n_mul_x then begin
|
||||
mul_x := 1;
|
||||
Result := True;
|
||||
end else if Name = n_mul_y then begin
|
||||
mul_y := 1;
|
||||
Result := True;
|
||||
end else if Name = n_mul_z then begin
|
||||
mul_z := 0;
|
||||
Result := True;
|
||||
end else if Name = n_mul_c then begin
|
||||
mul_c := 0;
|
||||
Result := True;
|
||||
end else if Name = n_x0 then begin
|
||||
x0 := 0;
|
||||
Result := True;
|
||||
end else if Name = n_y0 then begin
|
||||
y0 := 0;
|
||||
Result := True;
|
||||
end else if Name = n_z0 then begin
|
||||
z0 := 0;
|
||||
Result := True;
|
||||
end else if Name = n_invert then begin
|
||||
invert := 0;
|
||||
Result := True;
|
||||
end else if Name = n_blurtype then begin
|
||||
blurtype := 0;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPostFalloff2.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 11
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPostFalloff2.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = n_scatter then begin
|
||||
Value := scatter;
|
||||
Result := True;
|
||||
end else if Name = n_mindist then begin
|
||||
Value := mindist;
|
||||
Result := True;
|
||||
end else if Name = n_mul_x then begin
|
||||
Value := mul_x;
|
||||
Result := True;
|
||||
end else if Name = n_mul_y then begin
|
||||
Value := mul_y;
|
||||
Result := True;
|
||||
end else if Name = n_mul_z then begin
|
||||
Value := mul_z;
|
||||
Result := True;
|
||||
end else if Name = n_mul_c then begin
|
||||
Value := mul_c;
|
||||
Result := True;
|
||||
end else if Name = n_x0 then begin
|
||||
Value := x0;
|
||||
Result := True;
|
||||
end else if Name = n_y0 then begin
|
||||
Value := y0;
|
||||
Result := True;
|
||||
end else if Name = n_z0 then begin
|
||||
Value := z0;
|
||||
Result := True;
|
||||
end else if Name = n_invert then begin
|
||||
Value := invert;
|
||||
Result := True;
|
||||
end else if Name = n_blurtype then begin
|
||||
Value := blurtype;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationPostFalloff2), true, true);
|
||||
end.
|
||||
162
Variations/varPostSinusoidal.pas
Normal file
162
Variations/varPostSinusoidal.pas
Normal file
@ -0,0 +1,162 @@
|
||||
{ Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina }
|
||||
|
||||
unit varPostSinusoidal;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
{$ifdef Apo7X64}
|
||||
{$else}
|
||||
{$define _ASM_}
|
||||
{$endif}
|
||||
|
||||
type
|
||||
TVariationPostSinusoidal = class(TBaseVariation)
|
||||
private
|
||||
use3D: byte;
|
||||
procedure CalcFlat;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
|
||||
procedure CalcFunction; override;
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationPostSinusoidal }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationPostSinusoidal.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
if use3D = 0 then
|
||||
f := CalcFlat
|
||||
else f := CalcFunction;
|
||||
end;
|
||||
|
||||
procedure TVariationPostSinusoidal.CalcFlat;
|
||||
{$ifndef _ASM_}
|
||||
begin
|
||||
FPx^ := vvar * sin(FPx^);
|
||||
FPy^ := vvar * sin(FPy^);
|
||||
{$else}
|
||||
asm // AV: added inline asm code
|
||||
fld qword ptr [eax + vvar]
|
||||
mov edx, [eax + FTx]
|
||||
fld qword ptr [edx + 16] // FPx
|
||||
fsin
|
||||
fmul st, st(1)
|
||||
fstp qword ptr [edx + 16]
|
||||
|
||||
fld qword ptr [edx + 24] // FPy
|
||||
fsin
|
||||
fmulp
|
||||
fstp qword ptr [edx + 24]
|
||||
|
||||
fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TVariationPostSinusoidal.CalcFunction;
|
||||
{$ifndef _ASM_}
|
||||
begin
|
||||
FPx^ := vvar * sin(FPx^);
|
||||
FPy^ := vvar * sin(FPy^);
|
||||
FPz^ := vvar * sin(FPz^); // AV: changed from linear scale
|
||||
{$else}
|
||||
asm // AV: added inline asm code
|
||||
fld qword ptr [eax + vvar]
|
||||
mov edx, [eax + FTx]
|
||||
fld qword ptr [edx + 16] // FPx
|
||||
fsin
|
||||
fmul st, st(1)
|
||||
fstp qword ptr [edx + 16]
|
||||
|
||||
fld qword ptr [edx + 24] // FPy
|
||||
fsin
|
||||
fmul st, st(1)
|
||||
fstp qword ptr [edx + 24]
|
||||
|
||||
fld qword ptr [edx + 40] // FPz
|
||||
fsin
|
||||
fmulp
|
||||
fstp qword ptr [edx + 40]
|
||||
|
||||
fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationPostSinusoidal.Create;
|
||||
begin
|
||||
use3D := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationPostSinusoidal.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationPostSinusoidal.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationPostSinusoidal.GetName: string;
|
||||
begin
|
||||
Result := 'post_sinusoidal';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPostSinusoidal.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index of
|
||||
0: Result := 'post_sinusoidal_use3D';
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPostSinusoidal.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'post_sinusoidal_use3D' then begin
|
||||
if (Value > 1) then Value := 1;
|
||||
if (Value < 0) then Value := 0;
|
||||
use3D := Round(Value);
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPostSinusoidal.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 1;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPostSinusoidal.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'post_sinusoidal_use3D' then begin
|
||||
Value := use3D;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationPostSinusoidal), true, false);
|
||||
end.
|
||||
80
Variations/varPostSpherical.pas
Normal file
80
Variations/varPostSpherical.pas
Normal file
@ -0,0 +1,80 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varPostSpherical;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationPostSpherical = class(TBaseVariation)
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationPostSpherical }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationPostSpherical.CalcFunction;
|
||||
var r: double;
|
||||
begin
|
||||
r := vvar / (sqr(FPx^) + sqr(FPy^) + 10e-300);
|
||||
FPx^ := FPx^ * r;
|
||||
FPy^ := FPy^ * r;
|
||||
// FPz^ := VVAR * FPz^;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationPostSpherical.Create;
|
||||
begin
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationPostSpherical.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationPostSpherical.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationPostSpherical.GetName: string;
|
||||
begin
|
||||
Result := 'post_spherical';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationPostSpherical), false, false);
|
||||
end.
|
||||
61
Variations/varPower.pas
Normal file
61
Variations/varPower.pas
Normal file
@ -0,0 +1,61 @@
|
||||
{ Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina }
|
||||
|
||||
unit varPower;
|
||||
|
||||
interface
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationPower = class(TBaseVariation)
|
||||
private
|
||||
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
////////////////////////
|
||||
|
||||
procedure TVariationPower.CalcFunction;
|
||||
var
|
||||
r, FLength, FSinA, FCosA: double;
|
||||
begin
|
||||
FLength := sqrt(sqr(FTx^) + sqr(FTy^)) + 1E-300;
|
||||
FSinA := FTx^ / FLength;
|
||||
FCosA := FTy^ / FLength;
|
||||
r := vvar * Math.Power(FLength, FSinA);
|
||||
FPx^ := FPx^ + r * FCosA;
|
||||
FPy^ := FPy^ + r * FSinA;
|
||||
end;
|
||||
|
||||
constructor TVariationPower.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
end;
|
||||
|
||||
class function TVariationPower.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationPower.Create;
|
||||
end;
|
||||
|
||||
class function TVariationPower.GetName: string;
|
||||
begin
|
||||
Result := 'power';
|
||||
end;
|
||||
|
||||
//////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationPower), false, false);
|
||||
|
||||
end.
|
||||
188
Variations/varPreBoarders2.pas
Normal file
188
Variations/varPreBoarders2.pas
Normal file
@ -0,0 +1,188 @@
|
||||
{ Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina }
|
||||
|
||||
unit varPreBoarders2;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
const
|
||||
sb2c = 'pre_boarders2_c';
|
||||
sleft = 'pre_boarders2_left';
|
||||
sright = 'pre_boarders2_right';
|
||||
eps: double = 1e-30;
|
||||
type
|
||||
TVariationPreBoarders2 = class(TBaseVariation)
|
||||
private
|
||||
b2c, left, right, cc, cl, cr: double;
|
||||
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationPreBoarders2 }
|
||||
|
||||
//////////////////////////////////////////
|
||||
procedure TVariationPreBoarders2.Prepare;
|
||||
begin
|
||||
cc := abs(b2c);
|
||||
cl := cc * abs(left);
|
||||
cr := cc + (cc * abs(right));
|
||||
end;
|
||||
|
||||
//////////////////////////////////////////
|
||||
procedure TVariationPreBoarders2.CalcFunction;
|
||||
var
|
||||
roundX, roundY, offsetX, offsetY: double;
|
||||
begin
|
||||
roundX := round(FTx^);
|
||||
roundY := round(FTy^);
|
||||
offsetX := FTx^ - roundX;
|
||||
offsetY := FTy^ - roundY;
|
||||
|
||||
if (random >= cr) then
|
||||
begin
|
||||
FTx^ := VVAR * (offsetX * cc + roundX);
|
||||
FTy^ := VVAR * (offsetY * cc + roundY);
|
||||
end
|
||||
else begin
|
||||
if (abs(offsetX) >= abs(offsetY)) then
|
||||
begin
|
||||
if(offsetX >= 0.0) then
|
||||
begin
|
||||
FTx^ := VVAR * (offsetX * cc + roundX + cl);
|
||||
FTy^ := VVAR * (offsetY * cc + roundY + cl * offsetY / offsetX);
|
||||
end
|
||||
else begin
|
||||
FTx^ := VVAR * (offsetX * cc + roundX - cl);
|
||||
FTy^ := VVAR * (offsetY * cc + roundY - cl * offsetY / offsetX);
|
||||
end;
|
||||
end
|
||||
else begin
|
||||
if(offsetY >= 0.0) then
|
||||
begin
|
||||
FTy^ := VVAR * (offsetY * cc + roundY + cl);
|
||||
FTx^ := VVAR * (offsetX * cc + roundX + offsetX / offsetY * cl);
|
||||
end
|
||||
else begin
|
||||
FTy^ := VVAR * (offsetY * cc + roundY - cl);
|
||||
FTx^ := VVAR * (offsetX * cc + roundX - offsetX / offsetY * cl);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
constructor TVariationPreBoarders2.Create;
|
||||
begin
|
||||
b2c := 0.5;
|
||||
left := 0.5;
|
||||
right := 0.5;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationPreBoarders2.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationPreBoarders2.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationPreBoarders2.GetName: string;
|
||||
begin
|
||||
Result := 'pre_boarders2';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPreBoarders2.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index of
|
||||
0: Result := sb2c;
|
||||
1: Result := sleft;
|
||||
2: Result := sright;
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPreBoarders2.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = sb2c then begin
|
||||
if abs(value) = 0 then value := eps;
|
||||
b2c := value;
|
||||
Result := True;
|
||||
end else if Name = sleft then begin
|
||||
if abs(value) = 0 then value := eps;
|
||||
left := Value;
|
||||
Result := True;
|
||||
end else if Name = sright then begin
|
||||
if abs(value) = 0 then value := eps;
|
||||
right := Value;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationPreBoarders2.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = sb2c then begin
|
||||
b2c := 0.5;
|
||||
Result := True;
|
||||
end else if Name = sleft then begin
|
||||
left := 0.5;
|
||||
Result := True;
|
||||
end else if Name = sright then begin
|
||||
right := 0.5;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
function TVariationPreBoarders2.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 3;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPreBoarders2.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = sb2c then begin
|
||||
Value := b2c;
|
||||
Result := True;
|
||||
end else if Name = sleft then begin
|
||||
Value := left;
|
||||
Result := True;
|
||||
end else if Name = sright then begin
|
||||
Value := right;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationPreBoarders2), false, false);
|
||||
end.
|
||||
227
Variations/varPreBwraps.pas
Normal file
227
Variations/varPreBwraps.pas
Normal file
@ -0,0 +1,227 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varPreBwraps;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationPreBwraps = class(TBaseVariation)
|
||||
private
|
||||
pre_bwraps_cellsize, pre_bwraps_space, pre_bwraps_gain,
|
||||
pre_bwraps_inner_twist, pre_bwraps_outer_twist,
|
||||
g2, r2, rfactor: double;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationPreBwraps.Prepare;
|
||||
var
|
||||
max_bubble, radius: double;
|
||||
begin
|
||||
radius := 0.5 * (pre_bwraps_cellsize / (1.0 + sqr(pre_bwraps_space)));
|
||||
g2 := sqr(pre_bwraps_gain) / (radius + 1e-6) + 1e-6;
|
||||
max_bubble := g2 * radius;
|
||||
|
||||
if (max_bubble > 2.0) then max_bubble := 1.0
|
||||
else max_bubble := max_bubble * (1.0 / (sqr(max_bubble)/4.0 + 1.0));
|
||||
|
||||
r2 := sqr(radius);
|
||||
rfactor := radius / max_bubble;
|
||||
end;
|
||||
|
||||
procedure TVariationPreBwraps.CalcFunction;
|
||||
var
|
||||
Vx, Vy,
|
||||
Cx, Cy,
|
||||
Lx, Ly,
|
||||
r, theta, s, c : double;
|
||||
begin
|
||||
Vx := FTx^;
|
||||
Vy := FTy^;
|
||||
|
||||
if (pre_bwraps_cellsize <> 0.0) then
|
||||
begin
|
||||
Cx := (floor(Vx / pre_bwraps_cellsize) + 0.5) * pre_bwraps_cellsize;
|
||||
Cy := (floor(Vy / pre_bwraps_cellsize) + 0.5) * pre_bwraps_cellsize;
|
||||
|
||||
Lx := Vx - Cx;
|
||||
Ly := Vy - Cy;
|
||||
|
||||
if ((sqr(Lx) + sqr(Ly)) <= r2) then
|
||||
begin
|
||||
Lx := Lx * g2;
|
||||
Ly := Ly * g2;
|
||||
|
||||
r := rfactor / ((sqr(Lx) + sqr(Ly)) / 4.0 + 1);
|
||||
|
||||
Lx := Lx * r;
|
||||
Ly := Ly * r;
|
||||
|
||||
r := (sqr(Lx) + sqr(Ly)) / r2;
|
||||
theta := pre_bwraps_inner_twist * (1.0 - r) + pre_bwraps_outer_twist * r;
|
||||
SinCos(theta, s, c);
|
||||
|
||||
Vx := Cx + c * Lx + s * Ly;
|
||||
Vy := Cy - s * Lx + c * Ly;
|
||||
|
||||
FTx^ := VVAR * Vx;
|
||||
FTy^ := VVAR * Vy;
|
||||
FTz^ := VVAR * FTz^;
|
||||
end;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationPreBwraps.Create;
|
||||
begin
|
||||
pre_bwraps_cellsize := 1;
|
||||
pre_bwraps_space := 0;
|
||||
pre_bwraps_gain := 1;
|
||||
pre_bwraps_inner_twist := 0;
|
||||
pre_bwraps_outer_twist := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationPreBwraps.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationPreBwraps.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationPreBwraps.GetName: string;
|
||||
begin
|
||||
Result := 'pre_bwraps';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPreBwraps.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'pre_bwraps_cellsize';
|
||||
1: Result := 'pre_bwraps_space';
|
||||
2: Result := 'pre_bwraps_gain';
|
||||
3: Result := 'pre_bwraps_inner_twist';
|
||||
4: Result := 'pre_bwraps_outer_twist';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPreBwraps.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'pre_bwraps_cellsize' then begin
|
||||
pre_bwraps_cellsize := Value;
|
||||
Result := True;
|
||||
end else if Name = 'pre_bwraps_space' then begin
|
||||
pre_bwraps_space := Value;
|
||||
Result := True;
|
||||
end else if Name = 'pre_bwraps_gain' then begin
|
||||
pre_bwraps_gain := Value;
|
||||
Result := True;
|
||||
end else if Name = 'pre_bwraps_inner_twist' then begin
|
||||
pre_bwraps_inner_twist := Value;
|
||||
Result := True;
|
||||
end else if Name = 'pre_bwraps_outer_twist' then begin
|
||||
pre_bwraps_outer_twist := Value;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
function TVariationPreBwraps.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'pre_bwraps_cellsize' then begin
|
||||
pre_bwraps_cellsize := 1;
|
||||
Result := True;
|
||||
end else if Name = 'pre_bwraps_space' then begin
|
||||
pre_bwraps_space := 0;
|
||||
Result := True;
|
||||
end else if Name = 'pre_bwraps_gain' then begin
|
||||
pre_bwraps_gain := 1;
|
||||
Result := True;
|
||||
end else if Name = 'pre_bwraps_inner_twist' then begin
|
||||
pre_bwraps_inner_twist := 0;
|
||||
Result := True;
|
||||
end else if Name = 'pre_bwraps_outer_twist' then begin
|
||||
pre_bwraps_outer_twist := 0;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPreBwraps.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 5
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPreBwraps.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'pre_bwraps_cellsize' then begin
|
||||
if Value = 0 then Value := 1e-6;
|
||||
Value := pre_bwraps_cellsize;
|
||||
Result := True;
|
||||
end else if Name = 'pre_bwraps_space' then begin
|
||||
Value := pre_bwraps_space;
|
||||
Result := True;
|
||||
end else if Name = 'pre_bwraps_gain' then begin
|
||||
Value := pre_bwraps_gain;
|
||||
Result := True;
|
||||
end else if Name = 'pre_bwraps_inner_twist' then begin
|
||||
Value := pre_bwraps_inner_twist;
|
||||
Result := True;
|
||||
end else if Name = 'pre_bwraps_outer_twist' then begin
|
||||
Value := pre_bwraps_outer_twist;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationPreBwraps), true, false);
|
||||
end.
|
||||
202
Variations/varPreCircleCrop.pas
Normal file
202
Variations/varPreCircleCrop.pas
Normal file
@ -0,0 +1,202 @@
|
||||
{ Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina }
|
||||
|
||||
unit varPreCircleCrop;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationPreCircleCrop = class(TBaseVariation)
|
||||
|
||||
const
|
||||
sx : string = 'pre_circlecrop_x';
|
||||
sy : string = 'pre_circlecrop_y';
|
||||
sradius : string = 'pre_circlecrop_radius';
|
||||
szero : string = 'pre_circlecrop_zero';
|
||||
sarea : string = 'pre_circlecrop_scatter_area';
|
||||
private
|
||||
x0, y0, radius, scatter_area, ca: double;
|
||||
zero: byte;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationPreCircleCrop }
|
||||
|
||||
//////////////////////////////////////////
|
||||
|
||||
procedure TVariationPreCircleCrop.Prepare;
|
||||
begin
|
||||
ca := max(-1.0, min(scatter_area, 1.0));
|
||||
end;
|
||||
|
||||
procedure TVariationPreCircleCrop.CalcFunction;
|
||||
var
|
||||
x, y, rad, ang, rdc, sn, cn: double;
|
||||
begin
|
||||
x := FTx^ - x0;
|
||||
y := FTy^ - y0;
|
||||
rad := Hypot(x, y);
|
||||
|
||||
if (rad > radius) then
|
||||
begin
|
||||
if (zero = 1) then
|
||||
begin
|
||||
FTx^ := 0;
|
||||
FTy^ := 0;
|
||||
end else
|
||||
begin
|
||||
ang := arctan2(y, x);
|
||||
SinCos(ang, sn, cn);
|
||||
rdc := radius + (random * 0.5 * ca);
|
||||
|
||||
FTx^ := vvar * rdc * cn + x0;
|
||||
FTy^ := vvar * rdc * sn + y0;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
FTx^ := vvar * x + x0;
|
||||
FTy^ := vvar * y + y0;
|
||||
end;
|
||||
end;
|
||||
|
||||
constructor TVariationPreCircleCrop.Create;
|
||||
begin
|
||||
x0 := 0;
|
||||
y0 := 0;
|
||||
radius := 1;
|
||||
scatter_area := 0;
|
||||
zero := 0;
|
||||
end;
|
||||
|
||||
class function TVariationPreCircleCrop.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationPreCircleCrop.Create;
|
||||
end;
|
||||
|
||||
class function TVariationPreCircleCrop.GetName: string;
|
||||
begin
|
||||
Result := 'pre_circlecrop';
|
||||
end;
|
||||
|
||||
function TVariationPreCircleCrop.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 5;
|
||||
end;
|
||||
|
||||
function TVariationPreCircleCrop.GetVariable(const Name: string;
|
||||
var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = sx then begin
|
||||
Value := x0;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sy then begin
|
||||
Value := y0;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sradius then begin
|
||||
Value := radius;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sarea then begin
|
||||
Value := scatter_area;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = szero then begin
|
||||
Value := zero;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationPreCircleCrop.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := sradius;
|
||||
1: Result := sx;
|
||||
2: Result := sy;
|
||||
3: Result := sarea;
|
||||
4: Result := szero;
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationPreCircleCrop.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = sx then begin
|
||||
x0 := 0;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sy then begin
|
||||
y0 := 0;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sradius then begin
|
||||
radius := 1;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sarea then begin
|
||||
scatter_area := 0;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = szero then begin
|
||||
zero := 0;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationPreCircleCrop.SetVariable(const Name: string;
|
||||
var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = sx then begin
|
||||
x0 := Value;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sy then begin
|
||||
y0 := Value;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sradius then begin
|
||||
radius := Value;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sarea then begin
|
||||
scatter_area := Value;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = szero then begin
|
||||
if Value < 0 then Value := 0;
|
||||
if Value > 1 then Value := 1;
|
||||
zero := Round(Value);
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationPreCircleCrop), false, false);
|
||||
|
||||
end.
|
||||
311
Variations/varPreCrop.pas
Normal file
311
Variations/varPreCrop.pas
Normal file
@ -0,0 +1,311 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varPreCrop;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationPreCrop = class(TBaseVariation)
|
||||
const
|
||||
n_x0 : string = 'pre_crop_left';
|
||||
n_y0 : string = 'pre_crop_top';
|
||||
n_x1 : string = 'pre_crop_right';
|
||||
n_y1 : string = 'pre_crop_bottom';
|
||||
n_s : string = 'pre_crop_scatter_area';
|
||||
n_z : string = 'pre_crop_zero';
|
||||
n : string = 'pre_crop';
|
||||
n_z1 : string = 'pre_crop_high'; // AV
|
||||
n_z0 : string = 'pre_crop_low'; //AV
|
||||
n_3D : string = 'pre_crop_use3D'; // AV
|
||||
private
|
||||
x0, y0, x1, y1, z0, z1, s, w, h, l: double;
|
||||
_x0, _y0, _x1, _y1, _z0, _z1: double;
|
||||
z, c3D: byte;
|
||||
|
||||
procedure Calc2D;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationPreCrop.Prepare;
|
||||
begin
|
||||
if (x0 < x1) then begin
|
||||
_x0 := x0;
|
||||
_x1 := x1;
|
||||
end else begin
|
||||
_x0 := x1;
|
||||
_x1 := x0;
|
||||
end;
|
||||
|
||||
if (y0 < y1) then begin
|
||||
_y0 := y0;
|
||||
_y1 := y1;
|
||||
end else begin
|
||||
_y0 := y1;
|
||||
_y1 := y0;
|
||||
end;
|
||||
|
||||
if (z0 < z1) then begin
|
||||
_z0 := z0;
|
||||
_z1 := z1;
|
||||
end else begin
|
||||
_z0 := z1;
|
||||
_z1 := z0;
|
||||
end;
|
||||
|
||||
w := (_x1 - _x0) * 0.5 * s;
|
||||
h := (_y1 - _y0) * 0.5 * s;
|
||||
l := (_z1 - _z0) * 0.5 * s;
|
||||
end;
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
procedure TVariationPreCrop.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
if (c3D = 0) then f := Calc2D
|
||||
else f := CalcFunction;
|
||||
end;
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
|
||||
procedure TVariationPreCrop.CalcFunction;
|
||||
var x, y, tz: double;
|
||||
begin
|
||||
x := FTx^;
|
||||
y := FTy^;
|
||||
tz := FTz^;
|
||||
|
||||
if ((x < _x0) or (x > _x1) or (y < _y0) or (y > _y1) or (tz < _z0) or (tz > _z1))
|
||||
and (z <> 0) then begin
|
||||
x := 0; y := 0; tz := 0;
|
||||
end else begin
|
||||
if x < _x0 then x := _x0 + random * w
|
||||
else if x > _x1 then x := _x1 - random * w;
|
||||
if y < _y0 then y := _y0 + random * h
|
||||
else if y > _y1 then y := _y1 - random * h;
|
||||
if tz < _z0 then tz := _z0 + random * l
|
||||
else if tz > _z1 then tz := _z1 - random * l;
|
||||
end;
|
||||
|
||||
FTx^ := VVAR * x;
|
||||
FTy^ := VVAR * y;
|
||||
FTz^ := VVAR * tz;
|
||||
end;
|
||||
|
||||
procedure TVariationPreCrop.Calc2D;
|
||||
var x, y: double;
|
||||
begin
|
||||
x := FTx^;
|
||||
y := FTy^;
|
||||
|
||||
if ((x < _x0) or (x > _x1) or (y < _y0) or (y > _y1)) and (z <> 0) then begin
|
||||
x := 0; y := 0;
|
||||
end else begin
|
||||
if x < _x0 then x := _x0 + random * w
|
||||
else if x > _x1 then x := _x1 - random * w;
|
||||
if y < _y0 then y := _y0 + random * h
|
||||
else if y > _y1 then y := _y1 - random * h;
|
||||
end;
|
||||
|
||||
FTx^ := VVAR * x;
|
||||
FTy^ := VVAR * y;
|
||||
end;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationPreCrop.Create;
|
||||
begin
|
||||
x0 := -1; x1 := 1;
|
||||
y0 := -1; y1 := 1;
|
||||
z0 := -1; z1 := 1;
|
||||
c3D := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationPreCrop.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationPreCrop.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationPreCrop.GetName: string;
|
||||
begin
|
||||
Result := n;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPreCrop.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := n_x0;
|
||||
1: Result := n_y0;
|
||||
2: Result := n_x1;
|
||||
3: Result := n_y1;
|
||||
4: Result := n_z0;
|
||||
5: Result := n_z1;
|
||||
6: Result := n_s;
|
||||
7: Result := n_z;
|
||||
8: Result := n_3D;
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPreCrop.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = n_x0 then begin
|
||||
x0 := Value;
|
||||
Result := True;
|
||||
end else if Name = n_y0 then begin
|
||||
y0 := Value;
|
||||
Result := True;
|
||||
end else if Name = n_x1 then begin
|
||||
x1 := Value;
|
||||
Result := True;
|
||||
end else if Name = n_y1 then begin
|
||||
y1 := Value;
|
||||
Result := True;
|
||||
end else if Name = n_z0 then begin
|
||||
z0 := Value;
|
||||
Result := True;
|
||||
end else if Name = n_z1 then begin
|
||||
z1 := Value;
|
||||
Result := True;
|
||||
end else if Name = n_s then begin
|
||||
if (Value < -1) then Value := -1;
|
||||
if (Value > 1) then Value := 1;
|
||||
s := Value;
|
||||
Result := True;
|
||||
end else if Name = n_z then begin
|
||||
if (Value > 1) then Value := 1;
|
||||
if (Value < 0) then Value := 0;
|
||||
z := Round(Value);
|
||||
Result := True;
|
||||
end else if Name = n_3D then begin
|
||||
if (Value > 1) then Value := 1;
|
||||
if (Value < 0) then Value := 0;
|
||||
c3D := Round(Value);
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
function TVariationPreCrop.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = n_x0 then begin
|
||||
x0 := -1;
|
||||
Result := True;
|
||||
end else if Name = n_y0 then begin
|
||||
y0 := -1;
|
||||
Result := True;
|
||||
end else if Name = n_x1 then begin
|
||||
x1 := 1;
|
||||
Result := True;
|
||||
end else if Name = n_y1 then begin
|
||||
y1 := 1;
|
||||
Result := True;
|
||||
end else if Name = n_z0 then begin
|
||||
z0 := -1;
|
||||
Result := True;
|
||||
end else if Name = n_z1 then begin
|
||||
z1 := 1;
|
||||
Result := True;
|
||||
end else if Name = n_s then begin
|
||||
s := 0;
|
||||
Result := True;
|
||||
end else if Name = n_z then begin
|
||||
z := 0;
|
||||
Result := True;
|
||||
end else if Name = n_3D then begin
|
||||
c3D := 0;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPreCrop.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 9
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPreCrop.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = n_x0 then begin
|
||||
Value := x0;
|
||||
Result := True;
|
||||
end else if Name = n_y0 then begin
|
||||
Value := y0;
|
||||
Result := True;
|
||||
end else if Name = n_x1 then begin
|
||||
Value := x1;
|
||||
Result := True;
|
||||
end else if Name = n_y1 then begin
|
||||
Value := y1;
|
||||
Result := True;
|
||||
end else if Name = n_z0 then begin
|
||||
Value := z0;
|
||||
Result := True;
|
||||
end else if Name = n_z1 then begin
|
||||
Value := z1;
|
||||
Result := True;
|
||||
end else if Name = n_s then begin
|
||||
Value := s;
|
||||
Result := True;
|
||||
end else if Name = n_z then begin
|
||||
Value := z;
|
||||
Result := True;
|
||||
end else if Name = n_3D then begin
|
||||
Value := c3D;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationPreCrop), true, false);
|
||||
end.
|
||||
120
Variations/varPreDisc.pas
Normal file
120
Variations/varPreDisc.pas
Normal file
@ -0,0 +1,120 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varPreDisc;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationPreDisc = class(TBaseVariation)
|
||||
private
|
||||
vvar_by_pi: double;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationPreDisc }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationPreDisc.Prepare;
|
||||
begin
|
||||
vvar_by_pi := vvar / PI;
|
||||
end;
|
||||
|
||||
procedure TVariationPreDisc.CalcFunction;
|
||||
var
|
||||
r, sinr, cosr: double;
|
||||
begin
|
||||
SinCos(PI * sqrt(sqr(FTx^) + sqr(FTy^)), sinr, cosr);
|
||||
r := vvar_by_pi * arctan2(FTx^, FTy^);
|
||||
FTx^ := sinr * r;
|
||||
FTy^ := cosr * r;
|
||||
// FTz^ := VVAR * FTz^;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationPreDisc.Create;
|
||||
begin
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationPreDisc.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationPreDisc.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationPreDisc.GetName: string;
|
||||
begin
|
||||
Result := 'pre_disc';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPreDisc.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
Result := '';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPreDisc.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPreDisc.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 0
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPreDisc.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationPreDisc), false, false);
|
||||
end.
|
||||
348
Variations/varPreFalloff2.pas
Normal file
348
Variations/varPreFalloff2.pas
Normal file
@ -0,0 +1,348 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varPreFalloff2;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationPreFalloff2 = class(TBaseVariation)
|
||||
const
|
||||
n_scatter : string = 'pre_falloff2_scatter';
|
||||
n_mindist : string = 'pre_falloff2_mindist';
|
||||
n_mul_x : string = 'pre_falloff2_mul_x';
|
||||
n_mul_y : string = 'pre_falloff2_mul_y';
|
||||
n_mul_z : string = 'pre_falloff2_mul_z';
|
||||
n_mul_c : string = 'pre_falloff2_mul_c';
|
||||
n_x0 : string = 'pre_falloff2_x0';
|
||||
n_y0 : string = 'pre_falloff2_y0';
|
||||
n_z0 : string = 'pre_falloff2_z0';
|
||||
n_invert : string = 'pre_falloff2_invert';
|
||||
n_blurtype : string = 'pre_falloff2_type';
|
||||
|
||||
private
|
||||
rmax: double;
|
||||
x0, y0, z0: double;
|
||||
scatter, mindist: double;
|
||||
invert, blurtype: integer;
|
||||
mul_x, mul_y, mul_z, mul_c: double;
|
||||
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
procedure CalcFunctionRadial;
|
||||
procedure CalcFunctionGaussian;
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationPreFalloff2.Prepare;
|
||||
begin
|
||||
rmax := 0.04 * scatter;
|
||||
end;
|
||||
|
||||
procedure TVariationPreFalloff2.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
if blurtype = 1 then f := CalcFunctionRadial
|
||||
else if blurtype = 2 then f := CalcFunctionGaussian
|
||||
else f := CalcFunction;
|
||||
end;
|
||||
procedure TVariationPreFalloff2.CalcFunction;
|
||||
var
|
||||
in_x, in_y, in_z, d: double;
|
||||
begin
|
||||
in_x := FTx^;
|
||||
in_y := FTy^;
|
||||
in_z := FTz^;
|
||||
|
||||
d := sqrt(sqr(in_x - x0) + sqr(in_y - y0) + sqr(in_z - z0));
|
||||
if (invert <> 0) then d := 1 - d; if (d < 0) then d := 0;
|
||||
d := (d - mindist) * rmax; if (d < 0) then d := 0;
|
||||
|
||||
FTx^ := VVAR * (in_x + mul_x * random * d);
|
||||
FTy^ := VVAR * (in_y + mul_y * random * d);
|
||||
FTz^ := VVAR * (in_z + mul_z * random * d);
|
||||
color^ := Abs(Frac(color^ + mul_c * random * d));
|
||||
end;
|
||||
procedure TVariationPreFalloff2.CalcFunctionRadial;
|
||||
var
|
||||
in_x, in_y, in_z, d, r_in: double;
|
||||
sigma, phi, r, sins, coss, sinp, cosp: double;
|
||||
begin
|
||||
in_x := FTx^;
|
||||
in_y := FTy^;
|
||||
in_z := FTz^;
|
||||
|
||||
r_in := sqrt(sqr(in_x) + sqr(in_y) + sqr(in_z)) + 1e-6;
|
||||
d := sqrt(sqr(in_x - x0) + sqr(in_y - y0) + sqr(in_z - z0));
|
||||
if (invert <> 0) then d := 1 - d; if (d < 0) then d := 0;
|
||||
d := (d - mindist) * rmax; if (d < 0) then d := 0;
|
||||
|
||||
sigma := ArcSin(in_z / r_in) + mul_z * random * d;
|
||||
phi := ArcTan2(in_y, in_x) + mul_y * random * d;
|
||||
r := r_in + mul_x * random * d;
|
||||
|
||||
SinCos(sigma, sins, coss);
|
||||
SinCos(phi, sinp, cosp);
|
||||
|
||||
FTx^ := VVAR * (r * coss * cosp);
|
||||
FTy^ := VVAR * (r * coss * sinp);
|
||||
FTz^ := VVAR * (sins);
|
||||
color^ := Abs(Frac(color^ + mul_c * random * d));
|
||||
end;
|
||||
procedure TVariationPreFalloff2.CalcFunctionGaussian;
|
||||
var
|
||||
in_x, in_y, in_z, d: double;
|
||||
sigma, phi, r, sins, coss, sinp, cosp: double;
|
||||
begin
|
||||
in_x := FTx^;
|
||||
in_y := FTy^;
|
||||
in_z := FTz^;
|
||||
|
||||
d := sqrt(sqr(in_x - x0) + sqr(in_y - y0) + sqr(in_z - z0));
|
||||
if (invert <> 0) then d := 1 - d; if (d < 0) then d := 0;
|
||||
d := (d - mindist) * rmax; if (d < 0) then d := 0;
|
||||
|
||||
sigma := d * random * 2 * PI;
|
||||
phi := d * random * PI;
|
||||
r := d * random;
|
||||
|
||||
SinCos(sigma, sins, coss);
|
||||
SinCos(phi, sinp, cosp);
|
||||
|
||||
FTx^ := VVAR * (in_x + mul_x * r * coss * cosp);
|
||||
FTy^ := VVAR * (in_y + mul_y * r * coss * sinp);
|
||||
FTz^ := VVAR * (in_z + mul_z * r * sins);
|
||||
color^ := Abs(Frac(color^ + mul_c * random * d));
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationPreFalloff2.Create;
|
||||
begin
|
||||
scatter := 1;
|
||||
mindist := 0.5;
|
||||
mul_x := 1;
|
||||
mul_y := 1;
|
||||
mul_z := 0;
|
||||
mul_c := 0;
|
||||
x0 := 0;
|
||||
y0 := 0;
|
||||
z0 := 0;
|
||||
invert := 0;
|
||||
blurtype := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationPreFalloff2.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationPreFalloff2.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationPreFalloff2.GetName: string;
|
||||
begin
|
||||
Result := 'pre_falloff2';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPreFalloff2.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := n_scatter;
|
||||
1: Result := n_mindist;
|
||||
2: Result := n_mul_x;
|
||||
3: Result := n_mul_y;
|
||||
4: Result := n_mul_z;
|
||||
5: Result := n_mul_c;
|
||||
6: Result := n_x0;
|
||||
7: Result := n_y0;
|
||||
8: Result := n_z0;
|
||||
9: Result := n_invert;
|
||||
10: Result := n_blurtype;
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPreFalloff2.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = n_scatter then begin
|
||||
if Value < 1e-6 then Value := 1e-6;
|
||||
scatter := Value;
|
||||
Result := True;
|
||||
end else if Name = n_mindist then begin
|
||||
if Value < 0 then Value := 0;
|
||||
mindist := Value;
|
||||
Result := True;
|
||||
end else if Name = n_mul_x then begin
|
||||
if Value < 0 then Value := 0
|
||||
else if Value > 1 then Value := 1;
|
||||
mul_x := Value;
|
||||
Result := True;
|
||||
end else if Name = n_mul_y then begin
|
||||
if Value < 0 then Value := 0
|
||||
else if Value > 1 then Value := 1;
|
||||
mul_y := Value;
|
||||
Result := True;
|
||||
end else if Name = n_mul_z then begin
|
||||
if Value < 0 then Value := 0
|
||||
else if Value > 1 then Value := 1;
|
||||
mul_z := Value;
|
||||
Result := True;
|
||||
end else if Name = n_mul_c then begin
|
||||
if Value < 0 then Value := 0
|
||||
else if Value > 1 then Value := 1;
|
||||
mul_c := Value;
|
||||
Result := True;
|
||||
end else if Name = n_x0 then begin
|
||||
x0 := Value;
|
||||
Result := True;
|
||||
end else if Name = n_y0 then begin
|
||||
y0 := Value;
|
||||
Result := True;
|
||||
end else if Name = n_z0 then begin
|
||||
z0 := Value;
|
||||
Result := True;
|
||||
end else if Name = n_invert then begin
|
||||
if (Value > 1) then Value := 1;
|
||||
if (Value < 0) then Value := 0;
|
||||
invert := Round(Value);
|
||||
Result := True;
|
||||
end else if Name = n_blurtype then begin
|
||||
if (Value > 2) then Value := 2;
|
||||
if (Value < 0) then Value := 0;
|
||||
blurtype := Round(Value);
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
function TVariationPreFalloff2.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = n_scatter then begin
|
||||
scatter := 1;
|
||||
Result := True;
|
||||
end else if Name = n_mindist then begin
|
||||
mindist := 0.5;
|
||||
Result := True;
|
||||
end else if Name = n_mul_x then begin
|
||||
mul_x := 1;
|
||||
Result := True;
|
||||
end else if Name = n_mul_y then begin
|
||||
mul_y := 1;
|
||||
Result := True;
|
||||
end else if Name = n_mul_z then begin
|
||||
mul_z := 0;
|
||||
Result := True;
|
||||
end else if Name = n_mul_c then begin
|
||||
mul_c := 0;
|
||||
Result := True;
|
||||
end else if Name = n_x0 then begin
|
||||
x0 := 0;
|
||||
Result := True;
|
||||
end else if Name = n_y0 then begin
|
||||
y0 := 0;
|
||||
Result := True;
|
||||
end else if Name = n_z0 then begin
|
||||
z0 := 0;
|
||||
Result := True;
|
||||
end else if Name = n_invert then begin
|
||||
invert := 0;
|
||||
Result := True;
|
||||
end else if Name = n_blurtype then begin
|
||||
blurtype := 0;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPreFalloff2.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 11
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPreFalloff2.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = n_scatter then begin
|
||||
Value := scatter;
|
||||
Result := True;
|
||||
end else if Name = n_mindist then begin
|
||||
Value := mindist;
|
||||
Result := True;
|
||||
end else if Name = n_mul_x then begin
|
||||
Value := mul_x;
|
||||
Result := True;
|
||||
end else if Name = n_mul_y then begin
|
||||
Value := mul_y;
|
||||
Result := True;
|
||||
end else if Name = n_mul_z then begin
|
||||
Value := mul_z;
|
||||
Result := True;
|
||||
end else if Name = n_mul_c then begin
|
||||
Value := mul_c;
|
||||
Result := True;
|
||||
end else if Name = n_x0 then begin
|
||||
Value := x0;
|
||||
Result := True;
|
||||
end else if Name = n_y0 then begin
|
||||
Value := y0;
|
||||
Result := True;
|
||||
end else if Name = n_z0 then begin
|
||||
Value := z0;
|
||||
Result := True;
|
||||
end else if Name = n_invert then begin
|
||||
Value := invert;
|
||||
Result := True;
|
||||
end else if Name = n_blurtype then begin
|
||||
Value := blurtype;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationPreFalloff2), true, true);
|
||||
end.
|
||||
184
Variations/varPreSinusoidal.pas
Normal file
184
Variations/varPreSinusoidal.pas
Normal file
@ -0,0 +1,184 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varPreSinusoidal;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
{$ifdef Apo7X64}
|
||||
{$else}
|
||||
{$define _ASM_}
|
||||
{$endif}
|
||||
|
||||
type
|
||||
TVariationPreSinusoidal = class(TBaseVariation)
|
||||
private
|
||||
use3D: byte;
|
||||
procedure CalcFlat;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
|
||||
procedure CalcFunction; override;
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationPreSinusoidal }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationPreSinusoidal.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
if use3D = 0 then
|
||||
f := CalcFlat
|
||||
else f := CalcFunction;
|
||||
end;
|
||||
|
||||
procedure TVariationPreSinusoidal.CalcFlat;
|
||||
{$ifndef _ASM_}
|
||||
begin
|
||||
FTx^ := vvar * sin(FTx^);
|
||||
FTy^ := vvar * sin(FTy^);
|
||||
{$else}
|
||||
asm // AV: added inline asm code
|
||||
fld qword ptr [eax + vvar]
|
||||
mov edx, [eax + FTx]
|
||||
fld qword ptr [edx] // FTx
|
||||
fsin
|
||||
fmul st, st(1)
|
||||
fstp qword ptr [edx]
|
||||
|
||||
fld qword ptr [edx + 8] // FTy
|
||||
fsin
|
||||
fmulp
|
||||
fstp qword ptr [edx + 8]
|
||||
|
||||
fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TVariationPreSinusoidal.CalcFunction;
|
||||
{$ifndef _ASM_}
|
||||
begin
|
||||
FTx^ := vvar * sin(FTx^);
|
||||
FTy^ := vvar * sin(FTy^);
|
||||
FTz^ := vvar * sin(FTz^); // AV: changed from linear scale
|
||||
{$else}
|
||||
asm // AV: added inline asm code
|
||||
fld qword ptr [eax + vvar]
|
||||
mov edx, [eax + FTx]
|
||||
fld qword ptr [edx] // FTx
|
||||
fsin
|
||||
fmul st, st(1)
|
||||
fstp qword ptr [edx]
|
||||
|
||||
fld qword ptr [edx + 8] // FTy
|
||||
fsin
|
||||
fmul st, st(1)
|
||||
fstp qword ptr [edx + 8]
|
||||
|
||||
fld qword ptr [edx + 32] // FTz
|
||||
fsin
|
||||
fmulp
|
||||
fstp qword ptr [edx + 32]
|
||||
|
||||
fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationPreSinusoidal.Create;
|
||||
begin
|
||||
use3D := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationPreSinusoidal.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationPreSinusoidal.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationPreSinusoidal.GetName: string;
|
||||
begin
|
||||
Result := 'pre_sinusoidal';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPreSinusoidal.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index of
|
||||
0: Result := 'pre_sinusoidal_use3D';
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPreSinusoidal.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'pre_sinusoidal_use3D' then begin
|
||||
if (Value > 1) then Value := 1;
|
||||
if (Value < 0) then Value := 0;
|
||||
use3D := Round(Value);
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPreSinusoidal.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 1;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationPreSinusoidal.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'pre_sinusoidal_use3D' then begin
|
||||
Value := use3D;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationPreSinusoidal), true, false);
|
||||
end.
|
||||
80
Variations/varPreSpherical.pas
Normal file
80
Variations/varPreSpherical.pas
Normal file
@ -0,0 +1,80 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varPreSpherical;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationPreSpherical = class(TBaseVariation)
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationPreSpherical }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationPreSpherical.CalcFunction;
|
||||
var r: double;
|
||||
begin
|
||||
r := vvar / (sqr(FTx^) + sqr(FTy^) + 10e-300);
|
||||
FTx^ := FTx^ * r;
|
||||
FTy^ := FTy^ * r;
|
||||
// FTz^ := VVAR * FTz^;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationPreSpherical.Create;
|
||||
begin
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationPreSpherical.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationPreSpherical.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationPreSpherical.GetName: string;
|
||||
begin
|
||||
Result := 'pre_spherical';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationPreSpherical), false, false);
|
||||
end.
|
||||
274
Variations/varProjective.pas
Normal file
274
Variations/varProjective.pas
Normal file
@ -0,0 +1,274 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varProjective;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationProjective = class(TBaseVariation)
|
||||
private
|
||||
pr_A, pr_B, pr_C, pr_A1, pr_B1, pr_C1, pr_A2, pr_B2, pr_C2: double;
|
||||
pr_mode: byte;
|
||||
procedure CalcPre;
|
||||
procedure CalcPost;
|
||||
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationProjective.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
case pr_mode of
|
||||
0: f := CalcPre;
|
||||
1: f := CalcFunction;
|
||||
else f := CalcPost;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TVariationProjective.CalcPost;
|
||||
var x, y, denom: double;
|
||||
begin
|
||||
x := FPx^;
|
||||
y := FPy^;
|
||||
|
||||
denom := pr_A * x + pr_B * y + pr_C;
|
||||
if (abs(denom) < 1E-20) then denom := 1E-20;
|
||||
|
||||
FPx^ := VVAR * (pr_A1 * x + pr_B1 * y + pr_C1) / denom;
|
||||
FPy^ := VVAR * (pr_A2 * x + pr_B2 * y + pr_C2) / denom;
|
||||
//FPz^ := VVAR * FPz^;
|
||||
end;
|
||||
|
||||
procedure TVariationProjective.CalcFunction;
|
||||
var x, y, denom: double;
|
||||
begin
|
||||
x := FTx^;
|
||||
y := FTy^;
|
||||
|
||||
denom := pr_A * x + pr_B * y + pr_C;
|
||||
if (abs(denom) < 1E-20) then denom := 1E-20;
|
||||
|
||||
FPx^ := FPx^ + VVAR * (pr_A1 * x + pr_B1 * y + pr_C1) / denom;
|
||||
FPy^ := FPy^ + VVAR * (pr_A2 * x + pr_B2 * y + pr_C2) / denom;
|
||||
//FPz^ := FPz^ + VVAR * FTz^;
|
||||
end;
|
||||
|
||||
procedure TVariationProjective.CalcPre;
|
||||
var x, y, denom: double;
|
||||
begin
|
||||
x := FTx^;
|
||||
y := FTy^;
|
||||
|
||||
denom := pr_A * x + pr_B * y + pr_C;
|
||||
if (abs(denom) < 1E-20) then denom := 1E-20;
|
||||
|
||||
FTx^ := VVAR * (pr_A1 * x + pr_B1 * y + pr_C1) / denom;
|
||||
FTy^ := VVAR * (pr_A2 * x + pr_B2 * y + pr_C2) / denom;
|
||||
//FTz^ := VVAR * FTz^;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationProjective.Create;
|
||||
begin
|
||||
pr_A := 0; pr_B := 0; pr_C := 1; // denominator coefs
|
||||
pr_A1 := 1; pr_B1 := 0; pr_C1 := 0; // x-enumerator coefs
|
||||
pr_A2 := 0; pr_B2 := 1; pr_C2 := 0; // y-enumerator coefs
|
||||
pr_mode := 1; // order of applying
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationProjective.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationProjective.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationProjective.GetName: string;
|
||||
begin
|
||||
Result := 'projective';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationProjective.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'pr_A';
|
||||
1: Result := 'pr_B';
|
||||
2: Result := 'pr_C';
|
||||
3: Result := 'pr_A1';
|
||||
4: Result := 'pr_B1';
|
||||
5: Result := 'pr_C1';
|
||||
6: Result := 'pr_A2';
|
||||
7: Result := 'pr_B2';
|
||||
8: Result := 'pr_C2';
|
||||
9: Result := 'projective_mode';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationProjective.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'pr_A' then begin
|
||||
pr_A := Value;
|
||||
Result := True;
|
||||
end else if Name = 'pr_B' then begin
|
||||
pr_B := Value;
|
||||
Result := True;
|
||||
end else if Name = 'pr_C' then begin
|
||||
pr_C := Value;
|
||||
Result := True;
|
||||
end else if Name = 'pr_A1' then begin
|
||||
pr_A1 := Value;
|
||||
Result := True;
|
||||
end else if Name = 'pr_B1' then begin
|
||||
pr_B1 := Value;
|
||||
Result := True;
|
||||
end else if Name = 'pr_C1' then begin
|
||||
pr_C1 := Value;
|
||||
Result := True;
|
||||
end else if Name = 'pr_A2' then begin
|
||||
pr_A2 := Value;
|
||||
Result := True;
|
||||
end else if Name = 'pr_B2' then begin
|
||||
pr_B2 := Value;
|
||||
Result := True;
|
||||
end else if Name = 'pr_C2' then begin
|
||||
pr_C2 := Value;
|
||||
Result := True;
|
||||
end else if Name = 'projective_mode' then begin
|
||||
if (Value < 0) then Value := 0;
|
||||
if (Value > 2) then Value := 2;
|
||||
pr_mode := Round(Value);
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
function TVariationProjective.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'pr_A' then begin
|
||||
pr_A := 0;
|
||||
Result := True;
|
||||
end else if Name = 'pr_B' then begin
|
||||
pr_B := 0;
|
||||
Result := True;
|
||||
end else if Name = 'pr_C' then begin
|
||||
pr_C := 1;
|
||||
Result := True;
|
||||
end else if Name = 'pr_A1' then begin
|
||||
pr_A1 := 1;
|
||||
Result := True;
|
||||
end else if Name = 'pr_B1' then begin
|
||||
pr_B1 := 0;
|
||||
Result := True;
|
||||
end else if Name = 'pr_C1' then begin
|
||||
pr_C1 := 0;
|
||||
Result := True;
|
||||
end else if Name = 'pr_A2' then begin
|
||||
pr_A2 := 0;
|
||||
Result := True;
|
||||
end else if Name = 'pr_B2' then begin
|
||||
pr_B2:= 1;
|
||||
Result := True;
|
||||
end else if Name = 'pr_C2' then begin
|
||||
pr_C2 := 0;
|
||||
Result := True;
|
||||
end else if Name = 'projective_mode' then begin
|
||||
pr_mode := 1;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationProjective.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 10
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationProjective.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'pr_A' then begin
|
||||
Value := pr_A;
|
||||
Result := True;
|
||||
end else if Name = 'pr_B' then begin
|
||||
Value := pr_B;
|
||||
Result := True;
|
||||
end else if Name = 'pr_C' then begin
|
||||
Value := pr_C;
|
||||
Result := True;
|
||||
end else if Name = 'pr_A1' then begin
|
||||
Value := pr_A1;
|
||||
Result := True;
|
||||
end else if Name = 'pr_B1' then begin
|
||||
Value := pr_B1;
|
||||
Result := True;
|
||||
end else if Name = 'pr_C1' then begin
|
||||
Value := pr_C1;
|
||||
Result := True;
|
||||
end else if Name = 'pr_A2' then begin
|
||||
Value := pr_A2;
|
||||
Result := True;
|
||||
end else if Name = 'pr_B2' then begin
|
||||
Value := pr_B2;
|
||||
Result := True;
|
||||
end else if Name = 'pr_C2' then begin
|
||||
Value := pr_C2;
|
||||
Result := True;
|
||||
end else if Name = 'projective_mode' then begin
|
||||
Value := pr_mode;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationProjective), false, false);
|
||||
end.
|
||||
372
Variations/varRadialBlur.pas
Normal file
372
Variations/varRadialBlur.pas
Normal file
@ -0,0 +1,372 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varRadialBlur;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
{$ifdef Apo7X64}
|
||||
{$else}
|
||||
AsmRandom,
|
||||
{$endif}
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
const
|
||||
var_name = 'radial_blur';
|
||||
var_a_name = 'radial_blur_angle';
|
||||
|
||||
{$ifdef Apo7X64}
|
||||
{$else}
|
||||
{$define _ASM_}
|
||||
{$endif}
|
||||
|
||||
type
|
||||
TVariationRadialBlur = class(TBaseVariation)
|
||||
private
|
||||
angle,
|
||||
spin_var, zoom_var: double;
|
||||
|
||||
rnd: array[0..3] of double;
|
||||
N: integer;
|
||||
|
||||
procedure CalcZoom;
|
||||
procedure CalcSpin;
|
||||
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
math;
|
||||
|
||||
// TVariationRadialBlur
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationRadialBlur.Create;
|
||||
begin
|
||||
angle := random * 2 - 1;
|
||||
end;
|
||||
|
||||
procedure TVariationRadialBlur.Prepare;
|
||||
begin
|
||||
spin_var := vvar * sin(angle * pi/2);
|
||||
zoom_var := vvar * cos(angle * pi/2);
|
||||
|
||||
N := 0;
|
||||
rnd[0] := random;
|
||||
rnd[1] := random;
|
||||
rnd[2] := random;
|
||||
rnd[3] := random;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationRadialBlur.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
if IsZero(spin_var) then f := CalcZoom
|
||||
else if IsZero(zoom_var) then f := CalcSpin
|
||||
else f := CalcFunction;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationRadialBlur.CalcFunction;
|
||||
{$ifndef _ASM_}
|
||||
var
|
||||
rndG, rz, ra: double;
|
||||
sina, cosa: extended;
|
||||
begin
|
||||
rndG := (rnd[0] + rnd[1] + rnd[2] + rnd[3] - 2);
|
||||
rnd[N] := random;
|
||||
N := (N+1) and $3;
|
||||
|
||||
ra := sqrt(sqr(FTx^) + sqr(FTy^));
|
||||
SinCos(arctan2(FTy^, FTx^) + spin_var * rndG, sina, cosa);
|
||||
rz := zoom_var * rndG - 1;
|
||||
|
||||
FPx^ := FPx^ + ra * cosa + rz * FTx^;
|
||||
FPy^ := FPy^ + ra * sina + rz * FTy^;
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
{$else}
|
||||
asm
|
||||
mov edx, [eax + FTx]
|
||||
// AV: for Apo7X.15C compatibility
|
||||
fld qword ptr [eax + vvar]
|
||||
fmul qword ptr [edx + 32] // FTz
|
||||
fadd qword ptr [edx + 40] // FPz
|
||||
fstp qword ptr [edx + 40]
|
||||
// main code
|
||||
fld qword ptr [edx + 8] // FTy
|
||||
fld qword ptr [edx] // FTx
|
||||
|
||||
fld st(1)
|
||||
fmul st, st
|
||||
fld st(1)
|
||||
fmul st, st
|
||||
faddp
|
||||
fsqrt
|
||||
|
||||
fld st(2)
|
||||
fld st(2)
|
||||
fpatan
|
||||
|
||||
fld qword ptr [eax + rnd]
|
||||
fadd qword ptr [eax + rnd+8]
|
||||
fadd qword ptr [eax + rnd+16]
|
||||
fadd qword ptr [eax + rnd+24]
|
||||
fld1
|
||||
fsub st(1), st
|
||||
fsub st(1), st
|
||||
|
||||
fld st(1)
|
||||
fmul qword ptr [eax + zoom_var]
|
||||
fsubrp
|
||||
|
||||
fmul st(4), st
|
||||
fmulp st(5), st
|
||||
|
||||
fmul qword ptr [eax + spin_var]
|
||||
faddp
|
||||
|
||||
call AsmRandExt
|
||||
mov edx, [eax + N]
|
||||
fstp qword ptr [eax + rnd + edx*8]
|
||||
inc edx
|
||||
and edx,$03
|
||||
mov [eax + N], edx
|
||||
|
||||
fsincos
|
||||
|
||||
fmul st, st(2)
|
||||
faddp st(3), st
|
||||
fmulp
|
||||
faddp st(2), st
|
||||
mov edx, [eax + FPx]
|
||||
fadd qword ptr [edx]
|
||||
fstp qword ptr [edx]
|
||||
fadd qword ptr [edx + 8]
|
||||
fstp qword ptr [edx + 8]
|
||||
fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationRadialBlur.CalcZoom;
|
||||
{$ifndef _ASM_}
|
||||
var
|
||||
r: double;
|
||||
begin
|
||||
r := zoom_var * (rnd[0] + rnd[1] + rnd[2] + rnd[3] - 2);
|
||||
|
||||
rnd[N] := random;
|
||||
N := (N+1) and $3;
|
||||
|
||||
FPx^ := FPx^ + r * FTx^;
|
||||
FPy^ := FPy^ + r * FTy^;
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
{$else}
|
||||
asm
|
||||
fld qword ptr [eax + rnd]
|
||||
fadd qword ptr [eax + rnd+8]
|
||||
fadd qword ptr [eax + rnd+16]
|
||||
fadd qword ptr [eax + rnd+24]
|
||||
fld1
|
||||
fadd st, st
|
||||
fsubp st(1), st
|
||||
fmul qword ptr [eax + zoom_var]
|
||||
|
||||
call AsmRandExt
|
||||
mov edx, [eax + N]
|
||||
fstp qword ptr [eax + rnd + edx*8]
|
||||
inc edx
|
||||
and edx,$03
|
||||
mov [eax + N], edx
|
||||
|
||||
mov edx, [eax + FTx]
|
||||
// AV: for Apo7X.15C compatibility
|
||||
fld qword ptr [eax + vvar]
|
||||
fmul qword ptr [edx + 32] // FTz
|
||||
fadd qword ptr [edx + 40] // FPz
|
||||
fstp qword ptr [edx + 40]
|
||||
// main code
|
||||
fld qword ptr [edx + 8] // FTy
|
||||
fld qword ptr [edx]
|
||||
|
||||
fmul st, st(2)
|
||||
fadd qword ptr [edx + 16]
|
||||
fstp qword ptr [edx + 16]
|
||||
fmulp
|
||||
fadd qword ptr [edx + 24]
|
||||
fstp qword ptr [edx + 24]
|
||||
fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationRadialBlur.CalcSpin;
|
||||
{$ifndef _ASM_}
|
||||
var
|
||||
r: double;
|
||||
sina, cosa: extended;
|
||||
begin
|
||||
SinCos(arctan2(FTy^, FTx^) + spin_var * (rnd[0] + rnd[1] + rnd[2] + rnd[3] - 2),
|
||||
sina, cosa);
|
||||
r := sqrt(sqr(FTx^) + sqr(FTy^));
|
||||
|
||||
rnd[N] := random;
|
||||
N := (N+1) and $3;
|
||||
|
||||
FPx^ := FPx^ + r * cosa - FTx^;
|
||||
FPy^ := FPy^ + r * sina - FTy^;
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
{$else}
|
||||
asm
|
||||
mov edx, [eax + FTx]
|
||||
// AV: for Apo7X.15C compatibility
|
||||
fld qword ptr [eax + vvar]
|
||||
fmul qword ptr [edx + 32] // FTz
|
||||
fadd qword ptr [edx + 40] // FPz
|
||||
fstp qword ptr [edx + 40]
|
||||
|
||||
// main code
|
||||
fld qword ptr [edx + 8]
|
||||
fld qword ptr [edx]
|
||||
fld st(1)
|
||||
fld st(1)
|
||||
fpatan
|
||||
|
||||
fld qword ptr [eax + rnd]
|
||||
fadd qword ptr [eax + rnd+8]
|
||||
fadd qword ptr [eax + rnd+16]
|
||||
fadd qword ptr [eax + rnd+24]
|
||||
fld1
|
||||
fadd st, st
|
||||
fsubp st(1), st
|
||||
fmul qword ptr [eax + spin_var]
|
||||
|
||||
call AsmRandExt
|
||||
mov edx, [eax + N]
|
||||
fstp qword ptr [eax + rnd + edx*8]
|
||||
inc edx
|
||||
and edx,$03
|
||||
mov [eax + N], edx
|
||||
|
||||
faddp
|
||||
fsincos
|
||||
|
||||
fld st(3)
|
||||
fmul st,st
|
||||
fld st(3)
|
||||
fmul st,st
|
||||
faddp
|
||||
fsqrt
|
||||
fmul st(2), st
|
||||
fmulp st(1), st
|
||||
mov edx, [eax + FPx]
|
||||
fadd qword ptr [edx]
|
||||
fsubrp st(2),st
|
||||
|
||||
fadd qword ptr [edx + 8]
|
||||
fsubrp st(2), st
|
||||
fstp qword ptr [edx]
|
||||
fstp qword ptr [edx + 8]
|
||||
fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationRadialBlur.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationRadialBlur.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationRadialBlur.GetName: string;
|
||||
begin
|
||||
Result := var_name;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationRadialBlur.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index of
|
||||
0: Result := var_a_name;
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationRadialBlur.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = var_a_name then begin
|
||||
Value := angle;
|
||||
Result := true;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationRadialBlur.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = var_a_name then begin
|
||||
angle := Value;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationRadialBlur.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = var_a_name then begin
|
||||
if angle <> 0 then angle := 0
|
||||
else if angle = 0 then angle := 1;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationRadialBlur.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 1;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationRadialBlur), true, false);
|
||||
end.
|
||||
220
Variations/varRectangles.pas
Normal file
220
Variations/varRectangles.pas
Normal file
@ -0,0 +1,220 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
{
|
||||
This variation was started by Michael Faber
|
||||
}
|
||||
|
||||
unit varRectangles;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationRectangles = class(TBaseVariation)
|
||||
private
|
||||
FRectanglesX, FRectanglesY, FRectanglesZ: double;
|
||||
r3D: byte;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
procedure CalcFunction; override;
|
||||
procedure CalcZeroX;
|
||||
procedure CalcZeroY;
|
||||
procedure CalcZeroXY;
|
||||
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationRectangles }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
procedure TVariationRectangles.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
if IsZero(FRectanglesX) then begin
|
||||
if IsZero(FRectanglesY) then
|
||||
f := CalcZeroXY
|
||||
else
|
||||
f := CalcZeroX;
|
||||
end
|
||||
else if IsZero(FRectanglesY) then
|
||||
f := CalcZeroY
|
||||
else f := CalcFunction;
|
||||
end;
|
||||
|
||||
procedure TVariationRectangles.CalcFunction;
|
||||
begin
|
||||
FPx^ := FPx^ + vvar * ((2*floor(FTx^/FRectanglesX) + 1)*FRectanglesX - FTx^);
|
||||
FPy^ := FPy^ + vvar * ((2*floor(FTy^/FRectanglesY) + 1)*FRectanglesY - FTy^);
|
||||
if (r3D <> 0) then
|
||||
begin
|
||||
if IsZero(FRectanglesZ) then
|
||||
FPz^ := FPz^ + vvar * FTz^
|
||||
else
|
||||
FPz^ := FPz^ + vvar * ((2*floor(FTz^/FRectanglesZ) + 1) * FRectanglesZ - FTz^);;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TVariationRectangles.CalcZeroX;
|
||||
begin
|
||||
FPx^ := FPx^ + vvar * FTx^;
|
||||
FPy^ := FPy^ + vvar * ((2*floor(FTy^/FRectanglesY) + 1)*FRectanglesY - FTy^);
|
||||
if (r3D <> 0) then
|
||||
begin
|
||||
if IsZero(FRectanglesZ) then
|
||||
FPz^ := FPz^ + vvar * FTz^
|
||||
else
|
||||
FPz^ := FPz^ + vvar * ((2*floor(FTz^/FRectanglesZ) + 1) * FRectanglesZ - FTz^);;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TVariationRectangles.CalcZeroY;
|
||||
begin
|
||||
FPx^ := FPx^ + vvar * ((2*floor(FTx^/FRectanglesX) + 1)*FRectanglesX - FTx^);
|
||||
FPy^ := FPy^ + vvar * FTy^;
|
||||
if (r3D <> 0) then
|
||||
begin
|
||||
if IsZero(FRectanglesZ) then
|
||||
FPz^ := FPz^ + vvar * FTz^
|
||||
else
|
||||
FPz^ := FPz^ + vvar * ((2*floor(FTz^/FRectanglesZ) + 1) * FRectanglesZ - FTz^);;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TVariationRectangles.CalcZeroXY;
|
||||
begin
|
||||
FPx^ := FPx^ + vvar * FTx^;
|
||||
FPy^ := FPy^ + vvar * FTy^;
|
||||
if (r3D <> 0) then
|
||||
begin
|
||||
if IsZero(FRectanglesZ) then
|
||||
FPz^ := FPz^ + vvar * FTz^
|
||||
else
|
||||
FPz^ := FPz^ + vvar * ((2*floor(FTz^/FRectanglesZ) + 1) * FRectanglesZ - FTz^);;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationRectangles.GetName: string;
|
||||
begin
|
||||
Result := 'rectangles';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationRectangles.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'rectangles_x';
|
||||
1: Result := 'rectangles_y';
|
||||
2: Result := 'rectangles_z';
|
||||
3: Result := 'rectangles_use3D';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationRectangles.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 4;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationRectangles.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'rectangles_x' then begin
|
||||
FRectanglesX := Value;
|
||||
Result := True;
|
||||
end else if Name = 'rectangles_y' then begin
|
||||
FRectanglesY := Value;
|
||||
Result := True;
|
||||
end else if Name = 'rectangles_z' then begin
|
||||
FRectanglesZ := Value;
|
||||
Result := True;
|
||||
end else if Name = 'rectangles_use3D' then begin
|
||||
if (Value > 1) then Value := 1;
|
||||
if (Value < 0) then Value := 0;
|
||||
r3D := Round(Value);
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationRectangles.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'rectangles_x' then begin
|
||||
Value := FRectanglesX;
|
||||
Result := True;
|
||||
end else if Name = 'rectangles_y' then begin
|
||||
Value := FRectanglesY;
|
||||
Result := True;
|
||||
end else if Name = 'rectangles_z' then begin
|
||||
Value := FRectanglesZ;
|
||||
Result := True;
|
||||
end else if Name = 'rectangles_use3D' then begin
|
||||
Value := r3D;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationRectangles.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
|
||||
FRectanglesX := 1.0;
|
||||
FRectanglesY := 1.0;
|
||||
FRectanglesZ := 0.0;
|
||||
r3D := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationRectangles.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationRectangles.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationRectangles), true, false);
|
||||
end.
|
||||
|
||||
180
Variations/varRings2.pas
Normal file
180
Variations/varRings2.pas
Normal file
@ -0,0 +1,180 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varRings2;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationRings2 = class(TBaseVariation)
|
||||
private
|
||||
FVal, dx: double;
|
||||
old: byte;
|
||||
procedure CalcRings;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationRings2 }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationRings2.Prepare;
|
||||
begin
|
||||
dx := sqr(FVal) + 1E-10;
|
||||
end;
|
||||
|
||||
procedure TVariationRings2.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
if old = 1 then
|
||||
f := CalcRings
|
||||
else f := CalcFunction;
|
||||
end;
|
||||
|
||||
procedure TVariationRings2.CalcRings;
|
||||
var
|
||||
r: double;
|
||||
Length: double;
|
||||
begin
|
||||
Length := sqrt(sqr(FTx^) + sqr(FTy^)) + 1E-300; // AV: avoid division by zero
|
||||
|
||||
r := vvar * (2 - dx * (System.Int((Length/dx + 1)/2) * 2 / Length + 1));
|
||||
|
||||
// AV: conversion into 'rings', which swaps X and Y
|
||||
FPx^ := FPx^ + r * FTy^;
|
||||
FPy^ := FPy^ + r * FTx^;
|
||||
end;
|
||||
|
||||
procedure TVariationRings2.CalcFunction;
|
||||
var
|
||||
r: double;
|
||||
Length: double;
|
||||
begin
|
||||
Length := sqrt(sqr(FTx^) + sqr(FTy^)) + 1E-300; // AV: avoid division by zero
|
||||
{ // all this range-checking crap only slows us down...
|
||||
if (FTx^ < -EPS) or (FTx^ > EPS) or (FTy^ < -EPS) or (FTy^ > EPS) then
|
||||
Angle := arctan2(FTx^, FTy^)
|
||||
else
|
||||
Angle := 0.0;
|
||||
} // ...and besides, we don't need arctan() if we have Length!
|
||||
|
||||
// dx := sqr(FVal) + EPS; - we can precalc it!!!
|
||||
// r := Length + dx - System.Int((Length + dx)/(2 * dx)) * 2 * dx - dx + Length * (1-dx);
|
||||
// ^^^^......he he, lots of useless calculations......^^^^
|
||||
r := vvar * (2 - dx * (System.Int((Length/dx + 1)/2) * 2 / Length + 1));
|
||||
|
||||
FPx^ := FPx^ + r * FTx^;
|
||||
FPy^ := FPy^ + r * FTy^;
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationRings2.Create;
|
||||
begin
|
||||
FVal := Random * 2;
|
||||
old := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationRings2.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationRings2.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationRings2.GetName: string;
|
||||
begin
|
||||
Result := 'rings2';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationRings2.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'rings2_val';
|
||||
1: Result := 'rings2_old';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationRings2.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'rings2_val' then begin
|
||||
FVal := Value;
|
||||
Result := True;
|
||||
end else if Name = 'rings2_old' then begin
|
||||
if (Value < 0) then Value := 0;
|
||||
if (Value > 1) then Value := 1;
|
||||
old := Round(Value);
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationRings2.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 2
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationRings2.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'rings2_val' then begin
|
||||
Value := FVal;
|
||||
Result := True;
|
||||
end else if Name = 'rings2_old' then begin
|
||||
Value := old;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationRings2), true, false);
|
||||
end.
|
||||
127
Variations/varScry.pas
Normal file
127
Variations/varScry.pas
Normal file
@ -0,0 +1,127 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varScry;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationScry = class(TBaseVariation)
|
||||
private
|
||||
v: double;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationScry.Prepare;
|
||||
begin
|
||||
if (VVAR = 0) then
|
||||
v := 1.0 / 1e-6
|
||||
else v := 1.0 / vvar;
|
||||
end;
|
||||
|
||||
procedure TVariationScry.CalcFunction;
|
||||
var t, r : double;
|
||||
begin
|
||||
t := sqr(FTx^) + sqr(FTy^);
|
||||
r := 1.0 / (sqrt(t) * (t + v));
|
||||
|
||||
FPx^ := FPx^ + FTx^ * r;
|
||||
FPy^ := FPy^ + FTy^ * r;
|
||||
|
||||
FPz^ := FPz^ + vvar * FTz^;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationScry.Create;
|
||||
begin
|
||||
v := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationScry.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationScry.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationScry.GetName: string;
|
||||
begin
|
||||
Result := 'scry';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationScry.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
Result := '';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationScry.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
function TVariationScry.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationScry.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 0
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationScry.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationScry), true, false);
|
||||
end.
|
||||
133
Variations/varSecant.pas
Normal file
133
Variations/varSecant.pas
Normal file
@ -0,0 +1,133 @@
|
||||
{ Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina }
|
||||
|
||||
unit varSecant;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationSecant = class(TBaseVariation)
|
||||
private
|
||||
old: byte;
|
||||
procedure CalcSecant2;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
|
||||
procedure CalcFunction; override;
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationSecant }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationSecant.Create;
|
||||
begin
|
||||
old := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationSecant.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
if old = 1 then f := CalcFunction
|
||||
else f := CalcSecant2;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
procedure TVariationSecant.CalcFunction;
|
||||
var
|
||||
r: double;
|
||||
begin
|
||||
r := sqrt(sqr(FTx^) + sqr(FTy^)) * vvar;
|
||||
r := cos(r);
|
||||
if (r = 0) then exit;
|
||||
FPx^ := FPx^ + FTx^ * vvar;
|
||||
FPy^ := FPy^ + 1 / r;
|
||||
end;
|
||||
|
||||
procedure TVariationSecant.CalcSecant2;
|
||||
var
|
||||
r: double;
|
||||
begin
|
||||
r := sqrt(sqr(FTx^) + sqr(FTy^)) * vvar;
|
||||
r := cos(r);
|
||||
if (r = 0) then exit;
|
||||
FPx^ := FPx^ + FTx^ * vvar;
|
||||
if (r < 0) then
|
||||
FPy^ := FPy^ + (1 / r + 1) * vvar
|
||||
else
|
||||
FPy^ := FPy^ + (1 / r - 1) * vvar;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationSecant.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationSecant.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationSecant.GetName: string;
|
||||
begin
|
||||
Result := 'secant2';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationSecant.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'secant2_old';
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationSecant.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'secant2_old' then
|
||||
begin
|
||||
if Value < 0 then Value := 0;
|
||||
if Value > 1 then Value := 1;
|
||||
old := Round(value);
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationSecant.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 1;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationSecant.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'secant2_old' then
|
||||
begin
|
||||
Value := old;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationSecant), false, false);
|
||||
end.
|
||||
223
Variations/varSeparation.pas
Normal file
223
Variations/varSeparation.pas
Normal file
@ -0,0 +1,223 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varSeparation;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationSeparation = class(TBaseVariation)
|
||||
private
|
||||
separation_x, separation_y, separation_z: double;
|
||||
separation_xinside, separation_yinside, separation_zinside: double;
|
||||
sqx, sqy, sqz: double;
|
||||
s3D: byte;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationSeparation.Prepare;
|
||||
begin
|
||||
sqx := sqr(separation_x);
|
||||
sqy := sqr(separation_y);
|
||||
sqz := sqr(separation_z);
|
||||
end;
|
||||
|
||||
/////////////////////////////////////////////
|
||||
procedure TVariationSeparation.CalcFunction;
|
||||
begin
|
||||
if(FTx^ > 0.0) then
|
||||
FPx^ := FPx^ + VVAR * (sqrt(sqr(FTx^) + sqx)- FTx^ * (separation_xinside))
|
||||
else
|
||||
FPx^ := FPx^ - VVAR * (sqrt(sqr(FTx^) + sqx)+ FTx^ * (separation_xinside));
|
||||
|
||||
if(FTy^ > 0.0) then
|
||||
FPy^ := FPy^ + VVAR * (sqrt(sqr(FTy^) + sqy)- FTy^ * (separation_yinside))
|
||||
else
|
||||
FPy^ := FPy^ - VVAR * (sqrt(sqr(FTy^) + sqy)+ FTy^ * (separation_yinside));
|
||||
|
||||
if (s3D <> 0) then begin
|
||||
if(FTz^ > 0.0) then
|
||||
FPz^ := FPz^ + VVAR * (sqrt(sqr(FTz^) + sqz) - FTz^ * (separation_zinside))
|
||||
else
|
||||
FPz^ := FPz^ - VVAR * (sqrt(sqr(FTz^) + sqz) + FTz^ * (separation_zinside));
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationSeparation.Create;
|
||||
begin
|
||||
separation_x := 1;
|
||||
separation_y := 1;
|
||||
separation_xinside := 0;
|
||||
separation_yinside := 0;
|
||||
separation_z := 0;
|
||||
separation_zinside := 0;
|
||||
s3D := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationSeparation.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationSeparation.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationSeparation.GetName: string;
|
||||
begin
|
||||
Result := 'separation';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationSeparation.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'separation_x';
|
||||
1: Result := 'separation_y';
|
||||
2: Result := 'separation_xinside';
|
||||
3: Result := 'separation_yinside';
|
||||
4: Result := 'separation_z';
|
||||
5: Result := 'separation_zinside';
|
||||
6: Result := 'separation_use3D';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationSeparation.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'separation_x' then begin
|
||||
separation_x := Value;
|
||||
Result := True;
|
||||
end else if Name = 'separation_y' then begin
|
||||
separation_y := Value;
|
||||
Result := True;
|
||||
end else if Name = 'separation_xinside' then begin
|
||||
separation_xinside := Value;
|
||||
Result := True;
|
||||
end else if Name = 'separation_yinside' then begin
|
||||
separation_yinside := Value;
|
||||
Result := True;
|
||||
end else if Name = 'separation_z' then begin
|
||||
separation_z := Value;
|
||||
Result := True;
|
||||
end else if Name = 'separation_zinside' then begin
|
||||
separation_zinside := Value;
|
||||
Result := True;
|
||||
end else if Name = 'separation_use3D' then begin
|
||||
if (Value > 1) then Value := 1;
|
||||
if (Value < 0) then Value := 0;
|
||||
s3D := Round(Value);
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
function TVariationSeparation.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'separation_x' then begin
|
||||
separation_x := 1;
|
||||
Result := True;
|
||||
end else if Name = 'separation_y' then begin
|
||||
separation_y := 1;
|
||||
Result := True;
|
||||
end else if Name = 'separation_xinside' then begin
|
||||
separation_xinside := 0;
|
||||
Result := True;
|
||||
end else if Name = 'separation_yinside' then begin
|
||||
separation_yinside := 0;
|
||||
Result := True;
|
||||
end else if Name = 'separation_z' then begin
|
||||
separation_z := 0;
|
||||
Result := True;
|
||||
end else if Name = 'separation_zinside' then begin
|
||||
separation_zinside := 0;
|
||||
Result := True;
|
||||
end else if Name = 'separation_use3D' then begin
|
||||
s3D := 0;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationSeparation.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 7
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationSeparation.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'separation_x' then begin
|
||||
Value := separation_x;
|
||||
Result := True;
|
||||
end else if Name = 'separation_y' then begin
|
||||
Value := separation_y;
|
||||
Result := True;
|
||||
end else if Name = 'separation_xinside' then begin
|
||||
Value := separation_xinside;
|
||||
Result := True;
|
||||
end else if Name = 'separation_yinside' then begin
|
||||
Value := separation_yinside;
|
||||
Result := True;
|
||||
end else if Name = 'separation_z' then begin
|
||||
Value := separation_z;
|
||||
Result := True;
|
||||
end else if Name = 'separation_zinside' then begin
|
||||
Value := separation_zinside;
|
||||
Result := True;
|
||||
end else if Name = 'separation_use3D' then begin
|
||||
Value := s3D;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationSeparation), true, false);
|
||||
end.
|
||||
188
Variations/varSinusoidal.pas
Normal file
188
Variations/varSinusoidal.pas
Normal file
@ -0,0 +1,188 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varSinusoidal;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
{$ifdef Apo7X64}
|
||||
{$else}
|
||||
{$define _ASM_}
|
||||
{$endif}
|
||||
|
||||
type
|
||||
TVariationSinusoidal = class(TBaseVariation)
|
||||
private
|
||||
use3D: byte;
|
||||
procedure CalcFlat;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
|
||||
procedure CalcFunction; override;
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationSinusoidal }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationSinusoidal.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
if use3D = 0 then
|
||||
f := CalcFlat
|
||||
else f := CalcFunction;
|
||||
end;
|
||||
|
||||
procedure TVariationSinusoidal.CalcFlat;
|
||||
{$ifndef _ASM_}
|
||||
begin
|
||||
FPx^ := FPx^ + vvar * sin(FTx^);
|
||||
FPy^ := FPy^ + vvar * sin(FTy^);
|
||||
{$else}
|
||||
asm
|
||||
fld qword ptr [eax + vvar]
|
||||
mov edx, [eax + FTx]
|
||||
fld qword ptr [edx] // FTx
|
||||
fsin
|
||||
fmul st, st(1)
|
||||
fadd qword ptr [edx + 16] // FPx
|
||||
fstp qword ptr [edx + 16]
|
||||
|
||||
fld qword ptr [edx + 8] // FTy
|
||||
fsin
|
||||
fmulp
|
||||
fadd qword ptr [edx + 24] // FPy
|
||||
fstp qword ptr [edx + 24]
|
||||
|
||||
fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TVariationSinusoidal.CalcFunction;
|
||||
{$ifndef _ASM_}
|
||||
begin
|
||||
FPx^ := FPx^ + vvar * sin(FTx^);
|
||||
FPy^ := FPy^ + vvar * sin(FTy^);
|
||||
FPz^ := FPz^ + vvar * sin(FTz^); // AV: changed from linear scale
|
||||
{$else}
|
||||
asm // AV: added inline asm code
|
||||
fld qword ptr [eax + vvar]
|
||||
mov edx, [eax + FTx]
|
||||
fld qword ptr [edx] // FTx
|
||||
fsin
|
||||
fmul st, st(1)
|
||||
fadd qword ptr [edx + 16] // FPx
|
||||
fstp qword ptr [edx + 16]
|
||||
|
||||
fld qword ptr [edx + 8] // FTy
|
||||
fsin
|
||||
fmul st, st(1)
|
||||
fadd qword ptr [edx + 24] // FPy
|
||||
fstp qword ptr [edx + 24]
|
||||
|
||||
fld qword ptr [edx + 32] // FTz
|
||||
fsin
|
||||
fmulp
|
||||
fadd qword ptr [edx + 40] // FPz
|
||||
fstp qword ptr [edx + 40]
|
||||
|
||||
fwait
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationSinusoidal.Create;
|
||||
begin
|
||||
use3D := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationSinusoidal.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationSinusoidal.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationSinusoidal.GetName: string;
|
||||
begin
|
||||
Result := 'sinusoidal';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationSinusoidal.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index of
|
||||
0: Result := 'sinusoidal_use3D';
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationSinusoidal.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'sinusoidal_use3D' then begin
|
||||
if (Value > 1) then Value := 1;
|
||||
if (Value < 0) then Value := 0;
|
||||
use3D := Round(Value);
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationSinusoidal.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 1;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationSinusoidal.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'sinusoidal_use3D' then begin
|
||||
Value := use3D;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationSinusoidal), true, false);
|
||||
end.
|
||||
328
Variations/varSphereCrop.pas
Normal file
328
Variations/varSphereCrop.pas
Normal file
@ -0,0 +1,328 @@
|
||||
{ Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina }
|
||||
|
||||
unit varSphereCrop;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationSphereCrop = class(TBaseVariation)
|
||||
|
||||
const
|
||||
sx : string = 'spherecrop_x';
|
||||
sy : string = 'spherecrop_y';
|
||||
sz : string = 'spherecrop_z';
|
||||
sradius : string = 'spherecrop_radius';
|
||||
szero : string = 'spherecrop_zero';
|
||||
sarea : string = 'spherecrop_scatter_area';
|
||||
smode: string = 'spherecrop_mode';
|
||||
private
|
||||
x0, y0, z0, radius, scatter_area, ca: double;
|
||||
zero, mode: byte;
|
||||
|
||||
procedure CalcPre;
|
||||
procedure CalcPost;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationSphereCrop }
|
||||
|
||||
//////////////////////////////////////////
|
||||
|
||||
procedure TVariationSphereCrop.Prepare;
|
||||
begin
|
||||
ca := max(-1.0, min(scatter_area, 1.0));
|
||||
end;
|
||||
|
||||
procedure TVariationSphereCrop.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
case mode of
|
||||
0: f := CalcPre;
|
||||
1: f := CalcFunction;
|
||||
else f := CalcPost;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TVariationSphereCrop.CalcFunction;
|
||||
var
|
||||
x, y, z, rad, rdc: double;
|
||||
ang, phi, sn, cn, sz, cz: double;
|
||||
begin
|
||||
x := FTx^ - x0;
|
||||
y := FTy^ - y0;
|
||||
z := FTz^ - z0;
|
||||
rad := Math.Hypot(x, y, z);
|
||||
|
||||
if (rad > radius) then
|
||||
begin
|
||||
if (zero = 1) then
|
||||
begin
|
||||
FPx^ := FPx^;
|
||||
FPy^ := FPy^;
|
||||
FPz^ := FPz^;
|
||||
end else
|
||||
begin
|
||||
ang := arctan2(y, x);
|
||||
SinCos(ang, sn, cn);
|
||||
phi := arcsin(z / rad);
|
||||
SinCos(phi, sz, cz);
|
||||
rdc := radius + (random * 0.5 * ca);
|
||||
|
||||
FPx^ := FPx^ + vvar * rdc * cn * cz + x0;
|
||||
FPy^ := FPy^ + vvar * rdc * sn * cz + y0;
|
||||
FPz^ := FPz^ + vvar * rdc * sz + z0;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
FPx^ := FPx^ + vvar * x + x0;
|
||||
FPy^ := FPy^ + vvar * y + y0;
|
||||
FPz^ := FPz^ + vvar * z + z0;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TVariationSphereCrop.CalcPost;
|
||||
var
|
||||
x, y, z, rad, rdc: double;
|
||||
ang, phi, sn, cn, sz, cz: double;
|
||||
begin
|
||||
x := FPx^ - x0;
|
||||
y := FPy^ - y0;
|
||||
z := FPz^ - z0;
|
||||
rad := Math.Hypot(x, y, z);
|
||||
|
||||
if (rad > radius) then
|
||||
begin
|
||||
if (zero = 1) then
|
||||
begin
|
||||
FPx^ := 0;
|
||||
FPy^ := 0;
|
||||
FPz^ := 0;
|
||||
end else
|
||||
begin
|
||||
ang := arctan2(y, x);
|
||||
SinCos(ang, sn, cn);
|
||||
phi := arcsin(z / rad);
|
||||
SinCos(phi, sz, cz);
|
||||
rdc := radius + (random * 0.5 * ca);
|
||||
|
||||
FPx^ := vvar * rdc * cn * cz + x0;
|
||||
FPy^ := vvar * rdc * sn * cz + y0;
|
||||
FPz^ := vvar * rdc * sz + z0;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
FPx^ := vvar * x + x0;
|
||||
FPy^ := vvar * y + y0;
|
||||
FPz^ := vvar * z + z0;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TVariationSphereCrop.CalcPre;
|
||||
var
|
||||
x, y, z, rad, rdc: double;
|
||||
ang, phi, sn, cn, sz, cz: double;
|
||||
begin
|
||||
x := FTx^ - x0;
|
||||
y := FTy^ - y0;
|
||||
z := FTz^ - z0;
|
||||
rad := Math.Hypot(x, y, z);
|
||||
|
||||
if (rad > radius) then
|
||||
begin
|
||||
if (zero = 1) then
|
||||
begin
|
||||
FTx^ := 0;
|
||||
FTy^ := 0;
|
||||
FTz^ := 0;
|
||||
end else
|
||||
begin
|
||||
ang := arctan2(y, x);
|
||||
SinCos(ang, sn, cn);
|
||||
phi := arcsin(z / rad);
|
||||
SinCos(phi, sz, cz);
|
||||
rdc := radius + (random * 0.5 * ca);
|
||||
|
||||
FTx^ := vvar * rdc * cn * cz + x0;
|
||||
FTy^ := vvar * rdc * sn * cz + y0;
|
||||
FTz^ := vvar * rdc * sz + z0;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
FTx^ := vvar * x + x0;
|
||||
FTy^ := vvar * y + y0;
|
||||
FTz^ := vvar * z + z0;
|
||||
end;
|
||||
end;
|
||||
|
||||
constructor TVariationSphereCrop.Create;
|
||||
begin
|
||||
x0 := 0;
|
||||
y0 := 0;
|
||||
z0 := 0;
|
||||
radius := 1;
|
||||
scatter_area := 0;
|
||||
zero := 0;
|
||||
mode := 1;
|
||||
end;
|
||||
|
||||
class function TVariationSphereCrop.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationSphereCrop.Create;
|
||||
end;
|
||||
|
||||
class function TVariationSphereCrop.GetName: string;
|
||||
begin
|
||||
Result := 'spherecrop';
|
||||
end;
|
||||
|
||||
function TVariationSphereCrop.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 7;
|
||||
end;
|
||||
|
||||
function TVariationSphereCrop.GetVariable(const Name: string;
|
||||
var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = sx then begin
|
||||
Value := x0;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sy then begin
|
||||
Value := y0;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sz then begin
|
||||
Value := z0;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sradius then begin
|
||||
Value := radius;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sarea then begin
|
||||
Value := scatter_area;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = szero then begin
|
||||
Value := zero;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = smode then begin
|
||||
Value := mode;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationSphereCrop.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := sradius;
|
||||
1: Result := sx;
|
||||
2: Result := sy;
|
||||
3: Result := sz;
|
||||
4: Result := sarea;
|
||||
5: Result := szero;
|
||||
6: Result := smode;
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationSphereCrop.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = sx then begin
|
||||
x0 := 0;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sy then begin
|
||||
y0 := 0;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sz then begin
|
||||
z0 := 0;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sradius then begin
|
||||
radius := 1;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sarea then begin
|
||||
scatter_area := 0;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = szero then begin
|
||||
zero := 0;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = smode then begin
|
||||
mode := 1;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationSphereCrop.SetVariable(const Name: string;
|
||||
var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = sx then begin
|
||||
x0 := Value;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sy then begin
|
||||
y0 := Value;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sz then begin
|
||||
z0 := Value;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sradius then begin
|
||||
radius := Value;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = sarea then begin
|
||||
scatter_area := Value;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = szero then begin
|
||||
if Value < 0 then Value := 0;
|
||||
if Value > 1 then Value := 1;
|
||||
zero := Round(Value);
|
||||
Result := True;
|
||||
end
|
||||
else if Name = smode then begin
|
||||
if Value < 0 then Value := 0;
|
||||
if Value > 2 then Value := 2;
|
||||
mode := Round(Value);
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationSphereCrop), true, false);
|
||||
|
||||
end.
|
||||
263
Variations/varSphyp3D.pas
Normal file
263
Variations/varSphyp3D.pas
Normal file
@ -0,0 +1,263 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varSphyp3D;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
const
|
||||
ssx = 'sphyp3D_stretchX';
|
||||
ssy = 'sphyp3D_stretchY';
|
||||
ssz = 'sphyp3D_stretchZ';
|
||||
szon = 'sphyp3D_zOn';
|
||||
|
||||
EPS: double = 1E-100;
|
||||
|
||||
type
|
||||
TVariationSphyp3D = class(TBaseVariation)
|
||||
private
|
||||
sx, sy, sz: double;
|
||||
zon: byte;
|
||||
|
||||
procedure CalcLinear;
|
||||
procedure CalcSpherical;
|
||||
procedure CalcHyperbolicX;
|
||||
procedure CalcHyperbolicY;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure CalcFunction; override;
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationSphyp3D }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationSphyp3D.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
if (sx = 1) and (sy = 1) and (sz = 1) then f := CalcSpherical
|
||||
else if (sx = 0) and (sy = 0) and (sz = 0) then f := CalcLinear
|
||||
else if (sx = 1) and (sy = 0) then f := CalcHyperbolicX
|
||||
else if (sx = 0) and (sy = 1) then f := CalcHyperbolicY
|
||||
else f := CalcFunction;
|
||||
end;
|
||||
|
||||
//////////////////////////////////////////
|
||||
procedure TVariationSphyp3D.CalcFunction;
|
||||
var t, rx, ry, rz: double;
|
||||
begin
|
||||
t := sqr(FTx^) + sqr(FTy^) + sqr(FTz^) + EPS;
|
||||
|
||||
rx := vvar * power(t, -sx);
|
||||
ry := vvar * power(t, -sy);
|
||||
|
||||
FPx^ := FPx^ + FTx^ * rx;
|
||||
FPy^ := FPy^ + FTy^ * ry;
|
||||
// Optional 3D calculation
|
||||
if (zon = 1) then begin
|
||||
rz := vvar * power(t, -sz);
|
||||
FPz^ := FPz^ + FTz^ * rz;
|
||||
end;
|
||||
end;
|
||||
|
||||
//////////////////////////////////////////
|
||||
procedure TVariationSphyp3D.CalcHyperbolicX;
|
||||
var t, r: double;
|
||||
begin
|
||||
t := sqr(FTx^) + sqr(FTy^) + sqr(FTz^) + EPS;
|
||||
r := vvar / t;
|
||||
|
||||
FPx^ := FPx^ + FTx^ * r;
|
||||
FPy^ := FPy^ + FTy^ * vvar;
|
||||
// Optional 3D calculation
|
||||
if (zon = 1) then begin
|
||||
r := vvar * power(t, -sz);
|
||||
FPz^ := FPz^ + FTz^ * r;
|
||||
end;
|
||||
end;
|
||||
//////////////////////////////////////////
|
||||
procedure TVariationSphyp3D.CalcHyperbolicY;
|
||||
var t, r: double;
|
||||
begin
|
||||
t := sqr(FTx^) + sqr(FTy^) + sqr(FTz^) + EPS;
|
||||
r := vvar / t;
|
||||
|
||||
FPx^ := FPx^ + FTx^ * vvar;
|
||||
FPy^ := FPy^ + FTy^ * r;
|
||||
// Optional 3D calculation
|
||||
if (zon = 1) then begin
|
||||
r := vvar * power(t, -sz);
|
||||
FPz^ := FPz^ + FTz^ * r;
|
||||
end;
|
||||
end;
|
||||
//////////////////////////////////////////
|
||||
procedure TVariationSphyp3D.CalcSpherical; // default case
|
||||
var t: double;
|
||||
begin
|
||||
t := sqr(FTx^) + sqr(FTy^) + sqr(FTz^) + EPS;
|
||||
t := vvar / t;
|
||||
|
||||
FPx^ := FPx^ + FTx^ * t;
|
||||
FPy^ := FPy^ + FTy^ * t;
|
||||
// Optional 3D calculation
|
||||
if (zon = 1) then
|
||||
FPz^ := FPz^ + FTz^ * t;
|
||||
|
||||
end;
|
||||
|
||||
//////////////////////////////////////////
|
||||
procedure TVariationSphyp3D.CalcLinear;
|
||||
begin
|
||||
|
||||
FPx^ := FPx^ + FTx^ * vvar;
|
||||
FPy^ := FPy^ + FTy^ * vvar;
|
||||
// Optional 3D calculation
|
||||
if (zon = 1) then
|
||||
FPz^ := FPz^ + FTz^ * vvar;
|
||||
end;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationSphyp3D.Create;
|
||||
begin
|
||||
sx := 1;
|
||||
sy := 1;
|
||||
sz := 1;
|
||||
zon := 1;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationSphyp3D.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationSphyp3D.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationSphyp3D.GetName: string;
|
||||
begin
|
||||
Result := 'sphyp3D';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationSphyp3D.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index of
|
||||
0: Result := ssx;
|
||||
1: Result := ssy;
|
||||
2: Result := ssz;
|
||||
3: Result := szon;
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationSphyp3D.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = ssx then begin
|
||||
sx := Value;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = ssy then begin
|
||||
sy := value;
|
||||
Result := True;
|
||||
end else if Name = ssz then begin
|
||||
sz := value;
|
||||
Result := True;
|
||||
end else if Name = szon then begin
|
||||
if (Value > 1) then Value := 1;
|
||||
if (Value < 0) then Value := 0;
|
||||
zon := Round(Value);
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationSphyp3D.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = ssx then begin
|
||||
sx := 1;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = ssy then begin
|
||||
sy := 1;
|
||||
Result := True;
|
||||
end else if Name = ssz then begin
|
||||
sz := 1;
|
||||
Result := True;
|
||||
end else if Name = szon then begin
|
||||
zon := IfThen(zon = 0, 1, 0);
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
function TVariationSphyp3D.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 4;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationSphyp3D.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = ssx then begin
|
||||
Value := sx;
|
||||
Result := true;
|
||||
end
|
||||
else if Name = ssy then begin
|
||||
Value := sy;
|
||||
Result := true;
|
||||
end else if Name = ssz then begin
|
||||
Value := sz;
|
||||
Result := true;
|
||||
end else if Name = szon then begin
|
||||
Value := zon;
|
||||
Result := true;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationSphyp3D), true, false);
|
||||
end.
|
||||
|
||||
163
Variations/varSplits.pas
Normal file
163
Variations/varSplits.pas
Normal file
@ -0,0 +1,163 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varSplits;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationSplits = class(TBaseVariation)
|
||||
private
|
||||
splits_x, splits_y, splits_z: double;
|
||||
splits_use3D: byte;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
procedure TVariationSplits.CalcFunction;
|
||||
begin
|
||||
if(FTx^ >= 0.0) then
|
||||
FPx^ := FPx^ + VVAR * (FTx^ + splits_x)
|
||||
else
|
||||
FPx^ := FPx^ + VVAR * (FTx^ - splits_x);
|
||||
|
||||
if(FTy^ >= 0.0) then
|
||||
FPy^ := FPy^ + VVAR * (FTy^ + splits_y)
|
||||
else
|
||||
FPy^ := FPy^ + VVAR * (FTy^ - splits_y);
|
||||
|
||||
if (splits_use3D <> 0) then
|
||||
begin
|
||||
if(FTz^ >= 0.0) then
|
||||
FPz^ := FPz^ + VVAR * (FTz^ + splits_z)
|
||||
else
|
||||
FPz^ := FPz^ + VVAR * (FTz^ - splits_z);
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationSplits.Create;
|
||||
begin
|
||||
splits_x := 0;
|
||||
splits_y := 0;
|
||||
splits_z := 0;
|
||||
splits_use3D := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationSplits.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationSplits.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationSplits.GetName: string;
|
||||
begin
|
||||
Result := 'splits';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationSplits.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'splits_x';
|
||||
1: Result := 'splits_y';
|
||||
2: Result := 'splits_z';
|
||||
3: Result := 'splits_use3D';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationSplits.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'splits_x' then begin
|
||||
splits_x := Value;
|
||||
Result := True;
|
||||
end else if Name = 'splits_y' then begin
|
||||
splits_y := Value;
|
||||
Result := True;
|
||||
end else if Name = 'splits_z' then begin
|
||||
splits_z := Value;
|
||||
Result := True;
|
||||
end else if Name = 'splits_use3D' then begin
|
||||
if (value < 0) then Value := 0;
|
||||
if (value > 1) then Value := 1;
|
||||
splits_use3D := Round(Value);
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationSplits.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 4
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationSplits.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'splits_x' then begin
|
||||
Value := splits_x;
|
||||
Result := True;
|
||||
end else if Name = 'splits_y' then begin
|
||||
Value := splits_y;
|
||||
Result := True;
|
||||
end else if Name = 'splits_z' then begin
|
||||
Value := splits_z;
|
||||
Result := True;
|
||||
end else if Name = 'splits_use3D' then begin
|
||||
Value := splits_use3D;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationSplits), true, false);
|
||||
end.
|
||||
323
Variations/varSuperShape.pas
Normal file
323
Variations/varSuperShape.pas
Normal file
@ -0,0 +1,323 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varSuperShape;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationSuperShape = class(TBaseVariation)
|
||||
private
|
||||
m, n1, n2, n3, rnd, holes, pa, pb: double;
|
||||
inv, p: double;
|
||||
|
||||
procedure CalcRnd;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
procedure Prepare; override;
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure CalcFunction; override;
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override; // AV: for speed
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationSuperShape }
|
||||
|
||||
{ Optimized by Alice V. Koryagina }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationSuperShape.Prepare; // AV: added some precalc
|
||||
begin
|
||||
inv := 1.0 - rnd;
|
||||
p := -1 / n1; // assert (n1 <> 0)
|
||||
end;
|
||||
|
||||
procedure TVariationSuperShape.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
if rnd < 1.0 then
|
||||
f := CalcFunction
|
||||
else
|
||||
f := CalcRnd;
|
||||
end;
|
||||
|
||||
procedure TVariationSuperShape.CalcFunction;
|
||||
var
|
||||
r, theta : double;
|
||||
t1, t2, dist: double;
|
||||
t1a, t2a: double;
|
||||
begin
|
||||
(*
|
||||
theta := 0; // AV: why?
|
||||
if n1 = 0 then // AV: we can check it at startup
|
||||
r := 0 // AV: why?
|
||||
else begin
|
||||
theta := ArcTan2(FTy^, FTx^);
|
||||
SinCos((m * theta + pi)/4, t2, t1);
|
||||
|
||||
t1 := abs(t1);
|
||||
t1 := power(t1, n2);
|
||||
|
||||
t2 := abs(t2);
|
||||
t2 := power(t2, n3);
|
||||
|
||||
dist := power(t1 + t2, -1 / n1); // AV: we can precalc it
|
||||
|
||||
// AV: why do we we check this const value at every point?
|
||||
if rnd < 1.0 then
|
||||
r := (rnd * random + (1.0 - rnd) * sqrt(sqr(FTx^) + sqr(FTy^))- holes) * dist
|
||||
else
|
||||
r := (rnd * random - holes) * dist;
|
||||
end;
|
||||
|
||||
if (r = 0) then // AV: useless assignments...
|
||||
begin
|
||||
FPx^ := FPx^;
|
||||
FPy^ := FPy^;
|
||||
end
|
||||
else
|
||||
begin
|
||||
SinCos(theta, t2a, t1a);
|
||||
FPx^ := FPx^ + vvar * r * t1a;
|
||||
FPy^ := FPy^ + vvar * r * t2a;
|
||||
end;
|
||||
*)
|
||||
|
||||
theta := ArcTan2(FTy^, FTx^);
|
||||
SinCos((m * theta + pi)/4, t2, t1);
|
||||
|
||||
t1 := abs(t1 / pa); // AV: added missng super_shape_a
|
||||
t1 := power(t1, n2);
|
||||
|
||||
t2 := abs(t2 / pb); // AV: added missng super_shape_b
|
||||
t2 := power(t2, n3);
|
||||
|
||||
dist := power(t1 + t2, p);
|
||||
r := (rnd * random + inv * sqrt(sqr(FTx^) + sqr(FTy^))- holes) * dist;
|
||||
|
||||
SinCos(theta, t2a, t1a);
|
||||
FPx^ := FPx^ + vvar * r * t1a;
|
||||
FPy^ := FPy^ + vvar * r * t2a;
|
||||
end;
|
||||
|
||||
procedure TVariationSuperShape.CalcRnd; // AV
|
||||
var
|
||||
r, theta : double;
|
||||
t1, t2, dist: double;
|
||||
t1a, t2a: double;
|
||||
begin
|
||||
theta := ArcTan2(FTy^, FTx^);
|
||||
SinCos((m * theta + pi)/4, t2, t1);
|
||||
|
||||
t1 := abs(t1 / pa);
|
||||
t1 := power(t1, n2);
|
||||
|
||||
t2 := abs(t2 / pb);
|
||||
t2 := power(t2, n3);
|
||||
|
||||
dist := power(t1 + t2, p);
|
||||
|
||||
r := (rnd * random - holes) * dist;
|
||||
|
||||
SinCos(theta, t2a, t1a);
|
||||
FPx^ := FPx^ + vvar * r * t1a;
|
||||
FPy^ := FPy^ + vvar * r * t2a;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationSuperShape.Create;
|
||||
begin
|
||||
m := 5.0;
|
||||
n1 := 2.0;
|
||||
n2 := 0.3;
|
||||
n3 := 0.3;
|
||||
rnd := 0.0;
|
||||
holes := 1.0;
|
||||
pa := 1;
|
||||
pb := 1;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationSuperShape.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationSuperShape.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationSuperShape.GetName: string;
|
||||
begin
|
||||
Result := 'super_shape';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationSuperShape.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'super_shape_m';
|
||||
1: Result := 'super_shape_n1';
|
||||
2: Result := 'super_shape_n2';
|
||||
3: Result := 'super_shape_n3';
|
||||
4: Result := 'super_shape_rnd';
|
||||
5: Result := 'super_shape_holes';
|
||||
6: Result := 'super_shape_a';
|
||||
7: Result := 'super_shape_b';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationSuperShape.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'super_shape_m' then begin
|
||||
m := Value;
|
||||
Result := True;
|
||||
end else if Name = 'super_shape_n1' then begin
|
||||
if abs(Value) < 1E-6 then Value := 1E-6; // AV: prevent useless checks
|
||||
n1 := Value;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = 'super_shape_n2' then begin
|
||||
n2 := Value;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = 'super_shape_n3' then begin
|
||||
n3 := Value;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = 'super_shape_rnd' then begin
|
||||
if Value > 1.0 then
|
||||
rnd := 1.0
|
||||
else if Value < 0.0 then
|
||||
rnd := 0.0
|
||||
else
|
||||
rnd := Value;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = 'super_shape_holes' then begin
|
||||
holes := Value;
|
||||
Result := True;
|
||||
end else if Name = 'super_shape_a' then begin
|
||||
if abs(Value) < 1E-4 then Value := 1E-4;
|
||||
pa := Value;
|
||||
Result := True;
|
||||
end else if Name = 'super_shape_b' then begin
|
||||
if abs(Value) < 1E-4 then Value := 1E-4;
|
||||
pb := Value;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationSuperShape.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'super_shape_m' then begin
|
||||
m:= 5;
|
||||
Result := True;
|
||||
end else if Name = 'super_shape_n1' then begin
|
||||
n1 := 2;
|
||||
Result := True;
|
||||
end else if Name = 'super_shape_n2' then begin
|
||||
n2 := 0.3;
|
||||
Result := True;
|
||||
end else if Name = 'super_shape_n3' then begin
|
||||
n3 := 0.3;
|
||||
Result := True;
|
||||
end else if Name = 'super_shape_rnd' then begin
|
||||
rnd := 0;
|
||||
Result := True;
|
||||
end else if Name = 'super_shape_holes' then begin
|
||||
holes := 1;
|
||||
Result := True;
|
||||
end else if Name = 'super_shape_a' then begin
|
||||
pa := 1;
|
||||
Result := True;
|
||||
end else if Name = 'super_shape_b' then begin
|
||||
pb := 1;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationSuperShape.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 8;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationSuperShape.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'super_shape_m' then begin
|
||||
Value := m;
|
||||
Result := True;
|
||||
end else if Name = 'super_shape_n1' then begin
|
||||
Value := n1;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = 'super_shape_n2' then begin
|
||||
Value := n2;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = 'super_shape_n3' then begin
|
||||
Value := n3;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = 'super_shape_rnd' then begin
|
||||
Value := rnd;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = 'super_shape_holes' then begin
|
||||
Value := holes;
|
||||
Result := True;
|
||||
end else if Name = 'super_shape_a' then begin
|
||||
Value := pa;
|
||||
Result := True;
|
||||
end else if Name = 'super_shape_b' then begin
|
||||
Value := pb;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationSuperShape), false, false);
|
||||
end.
|
||||
62
Variations/varTangent.pas
Normal file
62
Variations/varTangent.pas
Normal file
@ -0,0 +1,62 @@
|
||||
{ Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina }
|
||||
|
||||
unit varTangent;
|
||||
|
||||
interface
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationTangent = class(TBaseVariation)
|
||||
private
|
||||
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
////////////////////////
|
||||
|
||||
procedure TVariationTangent.CalcFunction;
|
||||
var
|
||||
sx, cx, sy, cy: double;
|
||||
begin
|
||||
SinCos(FTx^, sx, cx);
|
||||
SinCos(FTy^, sy, cy);
|
||||
if cx = 0 then cx := 1e-20;
|
||||
if cy = 0 then cy := 1e-20;
|
||||
FPx^ := FPx^ + vvar * sx / cy;
|
||||
FPy^ := FPy^ + vvar * sy / cy;
|
||||
// AV: added real 3D support
|
||||
FPz^ := FPz^ + vvar * sx / cx;
|
||||
end;
|
||||
|
||||
constructor TVariationTangent.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
end;
|
||||
|
||||
class function TVariationTangent.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationTangent.Create;
|
||||
end;
|
||||
|
||||
class function TVariationTangent.GetName: string;
|
||||
begin
|
||||
Result := 'tangent';
|
||||
end;
|
||||
|
||||
//////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationTangent), true, false);
|
||||
|
||||
end.
|
||||
117
Variations/varTanhSpiral.pas
Normal file
117
Variations/varTanhSpiral.pas
Normal file
@ -0,0 +1,117 @@
|
||||
{
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
"Chaotica" Copyright (C) 2019 Glare Technologies Limited
|
||||
}
|
||||
|
||||
unit varTanhSpiral;
|
||||
|
||||
interface
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationTanhSpiral = class(TBaseVariation)
|
||||
private
|
||||
ta: double;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
////////////////////////
|
||||
|
||||
procedure TVariationTanhSpiral.CalcFunction;
|
||||
var
|
||||
t, aux, sn, cn, snh, cnh: double;
|
||||
begin
|
||||
t := (random - 0.5) * 6.28318530717959;
|
||||
|
||||
SinCos(ta * t, sn, cn);
|
||||
SinhCosh(t, snh, cnh);
|
||||
|
||||
aux := (cn + cnh);
|
||||
if aux = 0 then aux := 1e-20;
|
||||
aux := vvar / aux;
|
||||
|
||||
FPx^ := FPx^ + snh * aux;
|
||||
FPy^ := FPy^ + sn * aux;
|
||||
end;
|
||||
|
||||
constructor TVariationTanhSpiral.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
ta := 4;
|
||||
end;
|
||||
|
||||
class function TVariationTanhSpiral.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationTanhSpiral.Create;
|
||||
end;
|
||||
|
||||
class function TVariationTanhSpiral.GetName: string;
|
||||
begin
|
||||
Result := 'tanh_spiral';
|
||||
end;
|
||||
|
||||
function TVariationTanhSpiral.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 1;
|
||||
end;
|
||||
|
||||
function TVariationTanhSpiral.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'tanh_spiral_a';
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationTanhSpiral.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'tanh_spiral_a' then begin
|
||||
Value := ta;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationTanhSpiral.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'tanh_spiral_a' then begin
|
||||
ta := Value;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationTanhSpiral.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'tanh_spiral_a' then begin
|
||||
ta := 4;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
//////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationTanhSpiral), false, false);
|
||||
|
||||
end.
|
||||
179
Variations/varTaurus.pas
Normal file
179
Variations/varTaurus.pas
Normal file
@ -0,0 +1,179 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varTaurus;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationTaurus = class(TBaseVariation)
|
||||
private
|
||||
r, n, inv, sor: double;
|
||||
invr, inv1, sor1: double;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
|
||||
procedure CalcFunction; override;
|
||||
procedure Prepare; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationTaurus.Prepare;
|
||||
begin
|
||||
invr := inv * r;
|
||||
inv1 := (1 - inv) * r;
|
||||
sor1 := 1 - sor;
|
||||
end;
|
||||
|
||||
procedure TVariationTaurus.CalcFunction;
|
||||
var
|
||||
sx, cx, sy, cy, ir: double;
|
||||
begin
|
||||
SinCos(FTx^, sx, cx);
|
||||
SinCos(FTy^, sy, cy);
|
||||
ir := invr + inv1 * cos(n * FTx^);
|
||||
|
||||
FPx^ := FPx^ + VVAR * (cx * (ir + sy));
|
||||
FPy^ := FPy^ + VVAR * (sx * (ir + sy));
|
||||
FPz^ := FPz^ + VVAR * (sor * cy) + (sor1 * FTy^);
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationTaurus.Create;
|
||||
begin
|
||||
r := 3;
|
||||
n := 5;
|
||||
inv := 0;
|
||||
sor := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationTaurus.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationTaurus.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationTaurus.GetName: string;
|
||||
begin
|
||||
Result := 'taurus';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationTaurus.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'taurus_r';
|
||||
1: Result := 'taurus_n';
|
||||
2: Result := 'taurus_inv';
|
||||
3: Result := 'taurus_sor';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationTaurus.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'taurus_r' then begin
|
||||
r := Value;
|
||||
Result := True;
|
||||
end else if Name = 'taurus_n' then begin
|
||||
n := Value;
|
||||
Result := True;
|
||||
end else if Name = 'taurus_inv' then begin
|
||||
inv := Value;
|
||||
Result := True;
|
||||
end else if Name = 'taurus_sor' then begin
|
||||
sor := Value;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationTaurus.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'taurus_r' then begin
|
||||
r := 3;
|
||||
Result := True;
|
||||
end else if Name = 'taurus_n' then begin
|
||||
n := 5;
|
||||
Result := True;
|
||||
end else if Name = 'taurus_inv' then begin
|
||||
inv := 0;
|
||||
Result := True;
|
||||
end else if Name = 'taurus_sor' then begin
|
||||
sor := IfThen(sor = 0, 1, 0);
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationTaurus.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 4;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationTaurus.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'taurus_r' then begin
|
||||
Value := r;
|
||||
Result := True;
|
||||
end else if Name = 'taurus_n' then begin
|
||||
Value := n;
|
||||
Result := True;
|
||||
end else if Name = 'taurus_inv' then begin
|
||||
Value := inv;
|
||||
Result := True;
|
||||
end else if Name = 'taurus_sor' then begin
|
||||
Value := sor;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationTaurus), true, false);
|
||||
end.
|
||||
311
Variations/varTriangleCrop.pas
Normal file
311
Variations/varTriangleCrop.pas
Normal file
@ -0,0 +1,311 @@
|
||||
{ Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina }
|
||||
|
||||
unit varTriangleCrop;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationTriangleCrop = class(TBaseVariation)
|
||||
private
|
||||
alpha, beta, Cx, Cy, Ax, Ay: double;
|
||||
mode, zero: byte;
|
||||
function IsP_Inside(Cx, Cy, Px, Py: double): boolean;
|
||||
procedure CalcPre;
|
||||
procedure CalcPost;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
procedure GetCalcFunction(var f: TCalcFunction); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TVariationTriangleCrop }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
procedure TVariationTriangleCrop.Prepare;
|
||||
var
|
||||
side, gamma, sa, ca: double;
|
||||
begin
|
||||
gamma := (180 - alpha - beta) * pi / 180;
|
||||
side := sin(beta * pi / 180) / sin(gamma);
|
||||
SinCos(alpha * pi / 180, sa, ca);
|
||||
Cx := side * ca;
|
||||
Cy := -side * sa;
|
||||
end;
|
||||
|
||||
procedure TVariationTriangleCrop.GetCalcFunction(var f: TCalcFunction);
|
||||
begin
|
||||
case mode of
|
||||
0: f := CalcPre;
|
||||
1: f := CalcFunction;
|
||||
else f := CalcPost;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationTriangleCrop.IsP_Inside(Cx, Cy, Px, Py: double): boolean;
|
||||
var
|
||||
m, n : double;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
m := Py / Cy;
|
||||
if (m >= 0) and (m <= 1) then
|
||||
begin
|
||||
n := Px - m * Cx;
|
||||
if (n >= 0) and ((m + n) <= 1) then
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TVariationTriangleCrop.CalcPre;
|
||||
var x, y, k: double;
|
||||
begin
|
||||
x := FTx^ - Ax;
|
||||
y := FTy^ + Ay;
|
||||
|
||||
if not IsP_Inside(Cx, Cy, x, y) then
|
||||
begin
|
||||
if (zero = 1) then
|
||||
begin
|
||||
x := 0; y := 0; // put the point into origin
|
||||
end
|
||||
else begin // put it on triangle's edge
|
||||
k := random;
|
||||
if (random(2) = 1) then
|
||||
begin
|
||||
x := k * Cx + random(2)*(1 - k);
|
||||
y := k * Cy;
|
||||
end else
|
||||
begin
|
||||
x := random(2)* k;
|
||||
y := 0;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
FTx^ := vvar * x + Ax;
|
||||
FTy^ := vvar * y - Ay;
|
||||
end;
|
||||
|
||||
procedure TVariationTriangleCrop.CalcFunction;
|
||||
var x, y, k: double;
|
||||
begin
|
||||
x := FTx^ - Ax;
|
||||
y := FTy^ + Ay;
|
||||
|
||||
if not IsP_Inside(Cx, Cy, x, y) then
|
||||
begin
|
||||
if (zero = 1) then
|
||||
begin
|
||||
x := 0; y := 0; // put the point into origin
|
||||
end
|
||||
else begin // put it on triangle's edge
|
||||
k := random;
|
||||
if (random(2) = 1) then
|
||||
begin
|
||||
x := k * Cx + random(2)*(1 - k);
|
||||
y := k * Cy;
|
||||
end else
|
||||
begin
|
||||
x := random(2)* k;
|
||||
y := 0;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
FPx^ := FPx^ + vvar * x + Ax;
|
||||
FPy^ := FPy^ + vvar * y - Ay;
|
||||
end;
|
||||
|
||||
procedure TVariationTriangleCrop.CalcPost;
|
||||
var x, y, k: double;
|
||||
begin
|
||||
x := FPx^ - Ax;
|
||||
y := FPy^ + Ay;
|
||||
|
||||
if not IsP_Inside(Cx, Cy, x, y) then
|
||||
begin
|
||||
if (zero = 1) then
|
||||
begin
|
||||
x := 0; y := 0; // put the point into origin
|
||||
end
|
||||
else begin // put it on triangle's edge
|
||||
k := random;
|
||||
if (random(2) = 1) then
|
||||
begin
|
||||
x := k * Cx + random(2)*(1 - k);
|
||||
y := k * Cy;
|
||||
end else
|
||||
begin
|
||||
x := random(2)* k;
|
||||
y := 0;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
FPx^ := vvar * x + Ax;
|
||||
FPy^ := vvar * y - Ay;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationTriangleCrop.Create;
|
||||
begin
|
||||
alpha := 60;
|
||||
beta := 60;
|
||||
mode := 1;
|
||||
zero := 0;
|
||||
Ax := 0;
|
||||
Ay := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationTriangleCrop.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationTriangleCrop.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationTriangleCrop.GetName: string;
|
||||
begin
|
||||
Result := 'trianglecrop';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationTriangleCrop.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'trianglecrop_alpha';
|
||||
1: Result := 'trianglecrop_beta';
|
||||
2: Result := 'trianglecrop_Ax';
|
||||
3: Result := 'trianglecrop_Ay';
|
||||
4: Result := 'trianglecrop_zero_edges';
|
||||
5: Result := 'trianglecrop_mode';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationTriangleCrop.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'trianglecrop_alpha' then begin
|
||||
if (value < 1) then Value := 1;
|
||||
if (value > (179 - beta)) then Value := 179 - beta;
|
||||
alpha := Value;
|
||||
Result := True;
|
||||
end else if Name = 'trianglecrop_beta' then begin
|
||||
if (value < 1) then Value := 1;
|
||||
if (value > (179 - alpha)) then Value := 179 - alpha;
|
||||
beta := Value;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = 'trianglecrop_mode' then begin
|
||||
if (value < 0) then Value := 0;
|
||||
if (value > 2) then Value := 2;
|
||||
mode := Round(Value);
|
||||
Result := True;
|
||||
end
|
||||
else if Name = 'trianglecrop_zero_edges' then begin
|
||||
if (value < 0) then Value := 0;
|
||||
if (value > 1) then Value := 1;
|
||||
zero := Round(Value);
|
||||
Result := True;
|
||||
end
|
||||
else if Name = 'trianglecrop_Ax' then begin
|
||||
Ax := Value;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = 'trianglecrop_Ay' then begin
|
||||
Ay := Value;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationTriangleCrop.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'trianglecrop_alpha' then
|
||||
begin
|
||||
alpha:= 60;
|
||||
Result := True;
|
||||
end else if Name = 'trianglecrop_beta' then
|
||||
begin
|
||||
beta := 60;
|
||||
Result := True;
|
||||
end else if Name = 'trianglecrop_mode' then
|
||||
begin
|
||||
mode := 1;
|
||||
Result := True;
|
||||
end else if Name = 'trianglecrop_zero_edges' then
|
||||
begin
|
||||
zero := IfThen(zero = 1, 0, 1);
|
||||
Result := True;
|
||||
end
|
||||
else if Name = 'trianglecrop_Ax' then begin
|
||||
Ax := 0;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = 'trianglecrop_Ay' then begin
|
||||
Ay := 0;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationTriangleCrop.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 6;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationTriangleCrop.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'trianglecrop_alpha' then begin
|
||||
Value := alpha;
|
||||
Result := True;
|
||||
end else if Name = 'trianglecrop_beta' then begin
|
||||
Value := beta;
|
||||
Result := True;
|
||||
end else if Name = 'trianglecrop_mode' then begin
|
||||
Value := mode;
|
||||
Result := True;
|
||||
end else if Name = 'trianglecrop_zero_edges' then begin
|
||||
Value := zero;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = 'trianglecrop_Ax' then begin
|
||||
Value := Ax;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = 'trianglecrop_Ay' then begin
|
||||
Value := Ay;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationTriangleCrop), false, false);
|
||||
end.
|
||||
112
Variations/varTwinTrian.pas
Normal file
112
Variations/varTwinTrian.pas
Normal file
@ -0,0 +1,112 @@
|
||||
{ Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina }
|
||||
|
||||
unit varTwinTrian;
|
||||
|
||||
interface
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationTwinTrian = class(TBaseVariation)
|
||||
private
|
||||
angle: double;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
////////////////////////
|
||||
|
||||
procedure TVariationTwinTrian.CalcFunction;
|
||||
var
|
||||
r, diff, sinr, cosr: double;
|
||||
begin
|
||||
r := sqrt(sqr(FTx^) + sqr(FTy^)) * vvar;
|
||||
SinCos(r * random, sinr, cosr);
|
||||
if sinr <> 0 then
|
||||
diff := Math.Log10(sinr * sinr) + cosr
|
||||
else
|
||||
diff := -30;
|
||||
r := vvar * FTx^;
|
||||
FPx^ := FPx^ + r * diff;
|
||||
FPy^ := FPy^ + r * (diff - sinr * angle);
|
||||
end;
|
||||
|
||||
constructor TVariationTwinTrian.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
angle := pi;
|
||||
end;
|
||||
|
||||
class function TVariationTwinTrian.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationTwinTrian.Create;
|
||||
end;
|
||||
|
||||
class function TVariationTwinTrian.GetName: string;
|
||||
begin
|
||||
Result := 'twintrian';
|
||||
end;
|
||||
|
||||
function TVariationTwinTrian.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 1;
|
||||
end;
|
||||
|
||||
function TVariationTwinTrian.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'twintrian_angle';
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationTwinTrian.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'twintrian_angle' then begin
|
||||
Value := angle;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationTwinTrian.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'twintrian_angle' then begin
|
||||
angle := Value;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationTwinTrian.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'twintrian_angle' then begin
|
||||
angle := pi;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
//////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationTwinTrian), false, false);
|
||||
|
||||
end.
|
||||
90
Variations/varUnpolar.pas
Normal file
90
Variations/varUnpolar.pas
Normal file
@ -0,0 +1,90 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varUnpolar;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationUnpolar = class(TBaseVariation)
|
||||
private
|
||||
vvar_pi: double;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationUnpolar.Prepare;
|
||||
begin
|
||||
vvar_pi := vvar / pi * 0.5;
|
||||
end;
|
||||
|
||||
procedure TVariationUnpolar.CalcFunction;
|
||||
var
|
||||
r, sn, cn: double;
|
||||
begin
|
||||
r := exp(FTy^);
|
||||
sincos(FTx^, sn, cn);
|
||||
|
||||
FPx^ := FPx^ + vvar_pi * r * sn;
|
||||
FPy^ := FPy^ + vvar_pi * r * cn;
|
||||
// FPz^ := FPz^ + vvar * FTz^;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationUnpolar.Create;
|
||||
begin
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationUnpolar.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationUnpolar.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationUnpolar.GetName: string;
|
||||
begin
|
||||
Result := 'unpolar';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationUnpolar), false, false);
|
||||
end.
|
||||
188
Variations/varWaves2.pas
Normal file
188
Variations/varWaves2.pas
Normal file
@ -0,0 +1,188 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varWaves2;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationWaves2 = class(TBaseVariation)
|
||||
private
|
||||
waves2_freqx, waves2_freqy, waves2_freqz: double;
|
||||
waves2_scalex, waves2_scaley, waves2_scalez: double;
|
||||
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationWaves2.Prepare;
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure TVariationWaves2.CalcFunction;
|
||||
begin
|
||||
FPx^ := FPx^ + VVAR * (FTx^ + waves2_scalex * sin(FTy^ * waves2_freqx));
|
||||
FPy^ := FPy^ + VVAR * (FTy^ + waves2_scaley * sin(FTx^ * waves2_freqy));
|
||||
FPz^ := FPz^ + VVAR * (FTz^ + waves2_scalez * sin(sqrt(sqr(FTx^)+sqr(FTy^)) * waves2_freqz));
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationWaves2.Create;
|
||||
begin
|
||||
waves2_freqx := 2; waves2_scalex := 1;
|
||||
waves2_freqy := 2; waves2_scaley := 1;
|
||||
waves2_freqz := 0; waves2_scalez := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationWaves2.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationWaves2.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationWaves2.GetName: string;
|
||||
begin
|
||||
Result := 'waves2';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationWaves2.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'waves2_freqx';
|
||||
1: Result := 'waves2_freqy';
|
||||
2: Result := 'waves2_freqz';
|
||||
3: Result := 'waves2_scalex';
|
||||
4: Result := 'waves2_scaley';
|
||||
5: Result := 'waves2_scalez';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationWaves2.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'waves2_freqx' then begin
|
||||
waves2_freqx := Value;
|
||||
Result := True;
|
||||
end else if Name = 'waves2_freqy' then begin
|
||||
waves2_freqy := Value;
|
||||
Result := True;
|
||||
end else if Name = 'waves2_freqz' then begin
|
||||
waves2_freqz := Value;
|
||||
Result := True;
|
||||
end else if Name = 'waves2_scalex' then begin
|
||||
waves2_scalex := Value;
|
||||
Result := True;
|
||||
end else if Name = 'waves2_scaley' then begin
|
||||
waves2_scaley := Value;
|
||||
Result := True;
|
||||
end else if Name = 'waves2_scalez' then begin
|
||||
waves2_scalez := Value;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
function TVariationWaves2.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'waves2_freqx' then begin
|
||||
waves2_freqx := 2;
|
||||
Result := True;
|
||||
end else if Name = 'waves2_freqy' then begin
|
||||
waves2_freqy := 2;
|
||||
Result := True;
|
||||
end else if Name = 'waves2_freqz' then begin
|
||||
waves2_freqz := 0;
|
||||
Result := True;
|
||||
end else if Name = 'waves2_scalex' then begin
|
||||
waves2_scalex := 1;
|
||||
Result := True;
|
||||
end else if Name = 'waves2_scaley' then begin
|
||||
waves2_scaley := 1;
|
||||
Result := True;
|
||||
end else if Name = 'waves2_scalez' then begin
|
||||
waves2_scalez := 0;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationWaves2.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 6
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationWaves2.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'waves2_freqx' then begin
|
||||
Value := waves2_freqx;
|
||||
Result := True;
|
||||
end else if Name = 'waves2_freqy' then begin
|
||||
Value := waves2_freqy;
|
||||
Result := True;
|
||||
end else if Name = 'waves2_freqz' then begin
|
||||
Value := waves2_freqz;
|
||||
Result := True;
|
||||
end else if Name = 'waves2_scalex' then begin
|
||||
Value := waves2_scalex;
|
||||
Result := True;
|
||||
end else if Name = 'waves2_scaley' then begin
|
||||
Value := waves2_scaley;
|
||||
Result := True;
|
||||
end else if Name = 'waves2_scalez' then begin
|
||||
Value := waves2_scalez;
|
||||
Result := True;
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationWaves2), true, false);
|
||||
end.
|
||||
183
Variations/varWedge.pas
Normal file
183
Variations/varWedge.pas
Normal file
@ -0,0 +1,183 @@
|
||||
{
|
||||
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
||||
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
||||
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
|
||||
|
||||
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
|
||||
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
You should have received a copy of the GNU General Public License
|
||||
GNU General Public License for more details.
|
||||
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
}
|
||||
|
||||
unit varWedge;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
BaseVariation, XFormMan;
|
||||
|
||||
type
|
||||
TVariationWedge = class(TBaseVariation)
|
||||
private
|
||||
wedge_angle, wedge_hole, wedge_swirl: double;
|
||||
wedge_count : integer;
|
||||
C1_2PI, comp_fac: double;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
class function GetName: string; override;
|
||||
class function GetInstance: TBaseVariation; override;
|
||||
|
||||
function GetNrVariables: integer; override;
|
||||
function GetVariableNameAt(const Index: integer): string; override;
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TVariationWedge.Prepare;
|
||||
begin
|
||||
C1_2PI := 0.15915494309189533576888376337251;
|
||||
comp_fac := 1.0 - wedge_angle * wedge_count * C1_2PI;
|
||||
end;
|
||||
procedure TVariationWedge.CalcFunction;
|
||||
var
|
||||
r, a, cosa, sina: double;
|
||||
c: integer;
|
||||
begin
|
||||
|
||||
r := sqrt(sqr(FTx^) + sqr(FTy^));
|
||||
a := ArcTan2(FTy^, FTx^) + wedge_swirl * r;
|
||||
c := floor((wedge_count * a + PI) * C1_2PI);
|
||||
a := a * comp_fac + c * wedge_angle;
|
||||
SinCos(a, sina, cosa);
|
||||
|
||||
r := vvar * (r + wedge_hole);
|
||||
FPx^ := FPx^ + r * cosa;
|
||||
FPy^ := FPy^ + r * sina;
|
||||
FPz^ := FPz^ + VVAR * FTz^;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
constructor TVariationWedge.Create;
|
||||
begin
|
||||
wedge_angle := PI / 2.0;
|
||||
wedge_hole := 0;
|
||||
wedge_count := 2;
|
||||
wedge_swirl := 0;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationWedge.GetInstance: TBaseVariation;
|
||||
begin
|
||||
Result := TVariationWedge.Create;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationWedge.GetName: string;
|
||||
begin
|
||||
Result := 'wedge';
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationWedge.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
case Index Of
|
||||
0: Result := 'wedge_angle';
|
||||
1: Result := 'wedge_hole';
|
||||
2: Result := 'wedge_count';
|
||||
3: Result := 'wedge_swirl';
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationWedge.SetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'wedge_angle' then begin
|
||||
wedge_angle := Value;
|
||||
Result := True;
|
||||
end else if Name = 'wedge_hole' then begin
|
||||
wedge_hole := Value;
|
||||
Result := True;
|
||||
end else if Name = 'wedge_count' then begin
|
||||
if (Value < 1) then Value := 1;
|
||||
Value := Round(value);
|
||||
wedge_count := Round(Value);
|
||||
Result := True;
|
||||
end else if Name = 'wedge_swirl' then begin
|
||||
wedge_swirl := Value;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
function TVariationWedge.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'wedge_angle' then begin
|
||||
wedge_angle := PI / 2;
|
||||
Result := True;
|
||||
end else if Name = 'wedge_hole' then begin
|
||||
wedge_hole := 0;
|
||||
Result := True;
|
||||
end else if Name = 'wedge_count' then begin
|
||||
wedge_count := 2;
|
||||
Result := True;
|
||||
end else if Name = 'wedge_swirl' then begin
|
||||
wedge_swirl := 0;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationWedge.GetNrVariables: integer;
|
||||
begin
|
||||
Result := 4
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function TVariationWedge.GetVariable(const Name: string; var value: double): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = 'wedge_angle' then begin
|
||||
Value := wedge_angle;
|
||||
Result := True;
|
||||
end else if Name = 'wedge_hole' then begin
|
||||
Value := wedge_hole;
|
||||
Result := True;
|
||||
end else if Name = 'wedge_count' then begin
|
||||
Value := wedge_count;
|
||||
Result := True;
|
||||
end else if Name = 'wedge_swirl' then begin
|
||||
Value := wedge_swirl;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
initialization
|
||||
RegisterVariation(TVariationClassLoader.Create(TVariationWedge), true, false);
|
||||
end.
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user