ADMIN: migration complete

git-svn-id: https://svn.code.sf.net/p/apophysis7x/svn/trunk@1 a5d1c0f9-a0e9-45c6-87dd-9d276e40c949
This commit is contained in:
xyrus02
2013-07-28 08:58:33 +00:00
commit 95a2f54683
258 changed files with 175238 additions and 0 deletions

176
Variations/varAuger.pas Normal file
View 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_sym := 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.

162
Variations/varBipolar.pas Normal file
View File

@ -0,0 +1,162 @@
{
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;
v := VVAR * 0.636619772367581343075535053490061;
s := -1.57079632679489661923 * (bipolar_shift);
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.

View File

@ -0,0 +1,141 @@
{
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 varBlurCircle;
interface
uses
BaseVariation, XFormMan;
type
TVariationBlurCircle = class(TBaseVariation)
private
VVAR4_PI: double;
PI_4: 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;
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 := x; if absx < 0 then absx := absx * -1.0;
absy := 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;
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
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
Result := '';
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationBlurCircle.SetVariable(const Name: string; var value: double): boolean;
begin
Result := False;
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationBlurCircle.GetNrVariables: integer;
begin
Result := 0
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationBlurCircle.GetVariable(const Name: string; var value: double): boolean;
begin
Result := False;
end;
///////////////////////////////////////////////////////////////////////////////
initialization
RegisterVariation(TVariationClassLoader.Create(TVariationBlurCircle), true, false);
end.

View 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
View 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.

238
Variations/varBwraps.pas Normal file
View 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.

232
Variations/varCrop.pas Normal file
View File

@ -0,0 +1,232 @@
{
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 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';
private
x0, y0, x1, y1, s, w, h: double;
_x0, _y0, _x1, _y1: double;
z: integer;
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 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;
w := (_x1 - _x0) * 0.5 * s;
h := (_y1 - _y0) * 0.5 * s;
end;
procedure TVariationCrop.CalcFunction;
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^;
end;
///////////////////////////////////////////////////////////////////////////////
constructor TVariationCrop.Create;
begin
x0 := -1; x1 := 1;
y0 := -1; y1 := 1;
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_s;
5: Result := n_z;
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_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
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_s then begin
s := 0;
Result := True;
end else if Name = n_z then begin
z := 0;
Result := True;
end
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationCrop.GetNrVariables: integer;
begin
Result := 6
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_s then begin
Value := s;
Result := True;
end else if Name = n_z then begin
Value := z;
Result := True;
end
end;
///////////////////////////////////////////////////////////////////////////////
initialization
RegisterVariation(TVariationClassLoader.Create(TVariationCrop), true, false);
end.

111
Variations/varCross.pas Normal file
View File

@ -0,0 +1,111 @@
{
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 varCross;
interface
uses
BaseVariation, XFormMan;
type
TVariationCross = 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 TVariationCross.CalcFunction;
var
r: double;
begin
r := Abs((FTx^ - FTy^) * (FTx^ + FTy^) + 1e-6);
if (r < 0) then r := r * -1.0;
r := VVAR / r;
FPx^ := FPx^ + FTx^ * r;
FPy^ := FPy^ + FTy^ * r;
FPz^ := FPz^ + vvar * FTz^;
end;
///////////////////////////////////////////////////////////////////////////////
constructor TVariationCross.Create;
begin
end;
///////////////////////////////////////////////////////////////////////////////
class function TVariationCross.GetInstance: TBaseVariation;
begin
Result := TVariationCross.Create;
end;
///////////////////////////////////////////////////////////////////////////////
class function TVariationCross.GetName: string;
begin
Result := 'cross';
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationCross.GetVariableNameAt(const Index: integer): string;
begin
Result := '';
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationCross.SetVariable(const Name: string; var value: double): boolean;
begin
Result := False;
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationCross.GetNrVariables: integer;
begin
Result := 0
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationCross.GetVariable(const Name: string; var value: double): boolean;
begin
Result := False;
end;
///////////////////////////////////////////////////////////////////////////////
initialization
RegisterVariation(TVariationClassLoader.Create(TVariationCross), true, false);
end.

245
Variations/varCurl.pas Normal file
View 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
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';
//{$define _ASM_}
// 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;
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^;
end;
procedure TVariationCurl.CalcZeroC2;
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^;
end;
procedure TVariationCurl.CalcZeroC1;
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^;
end;
procedure TVariationCurl.CalcZeroC2C1;
var
r: double;
begin
FPx^ := FPx^ + vvar*FTx^;
FPy^ := FPy^ + vvar*FTy^;
FPz^ := FPz^ + vvar * FTz^;
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.

295
Variations/varCurl3D.pas Normal file
View File

@ -0,0 +1,295 @@
{
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;
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.

131
Variations/varElliptic.pas Normal file
View File

@ -0,0 +1,131 @@
{
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.0)
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.

159
Variations/varEpispiral.pas Normal file
View File

@ -0,0 +1,159 @@
unit varEpispiral; // <-- JK Changed unit name to avoid clobbering original
//by Joel Faber (adapted for plugin example by Jed Kelsey (JK)
interface
uses
BaseVariation, XFormMan; // <-- JK Removed some (unnecessary?) units
const
EPS: double = 1E-6;
type
TVariationEpispiral = class(TBaseVariation)
private
n, thickness, holes : 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;
// TVariationEpispiral
///////////////////////////////////////////////////////////////////////////////
constructor TVariationEpispiral.Create;
begin
n := 6.0;
thickness := 0.0;
holes := 1.0;
end;
procedure TVariationEpispiral.Prepare;
begin //calculate constants
// nothing for now
end;
///////////////////////////////////////////////////////////////////////////////
procedure TVariationEpispiral.CalcFunction;
var
t, theta : double;
begin
theta := arctan2(FTy^, FTx^);
t := (random*thickness)*(1/cos(n*theta)) - holes;
if (abs(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';
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
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
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationEpispiral.GetNrVariables: integer;
begin
Result := 3;
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
end;
///////////////////////////////////////////////////////////////////////////////
initialization
RegisterVariation(TVariationClassLoader.Create(TVariationEpispiral), true, false); // <-- JK Plugin manager does this
end.

147
Variations/varEscher.pas Normal file
View 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, c, d: 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, d, c);
c := 0.5 * (1.0 + c);
d := 0.5 * d;
end;
procedure TVariationEscher.CalcFunction;
var sn, cs, a, lnr, m : double;
begin
a := arctan2(FTy^, FTx^); // Angular polar dimension
lnr := 0.5 * ln(FTx^*FTx^ + FTy^*FTy^); // Natural logarithm of the radial polar dimension.
m := VVAR * exp(c * lnr - d * a);
sincos(c * a + d * 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) / (2 * PI)) * 2 * PI - PI;
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.

348
Variations/varFalloff2.pas Normal file
View 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, false);
end.

172
Variations/varFan2.pas Normal file
View 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
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;
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;
{ TVariationFan2 }
///////////////////////////////////////////////////////////////////////////////
procedure TVariationFan2.Prepare;
const
EPS = 1E-10;
begin
dy := FY;
dx := pi * (sqr(FX) + EPS);
dx2 := dx/2;
end;
procedure TVariationFan2.CalcFunction;
var
r, a : double;
sinr, cosr: double;
Angle: double;
begin
{
r := sqrt(FTx^ * FTx^ + FTy^ * FTy^);
if (FTx^ < -EPS) or (FTx^ > EPS) or (FTy^ < -EPS) or (FTy^ > EPS) then
Angle := arctan2(FTx^, FTy^)
else
Angle := 0.0;
dy := FY;
dx := PI * (sqr(FX) + EPS);
dx2 := dx/2;
t := Angle+dy - System.Int((Angle + dy)/dx) * dx;
if (t > dx2) then
a := Angle - dx2
else
a := Angle + dx2;
FPx^ := FPx^ + vvar * r * sin(a);
FPy^ := FPy^ + vvar * r * cos(a);
}
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;
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';
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
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationFan2.GetNrVariables: integer;
begin
Result := 2
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
end;
///////////////////////////////////////////////////////////////////////////////
initialization
RegisterVariation(TVariationClassLoader.Create(TVariationFan2), true, false);
end.

118
Variations/varFoci.pas Normal file
View 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.

View File

@ -0,0 +1,360 @@
{
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,
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
Math,
Global,
Registry;
{ 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
Registry: TRegistry;
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;
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);
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);
end;
end;
///////////////////////////////////////////////////////////////////////////////
end.

View File

@ -0,0 +1,97 @@
{
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 varHemisphere;
interface
uses
BaseVariation, XFormMan;
const
var_name = 'hemisphere';
{$define _ASM_}
type
TVariationHemisphere = class(TBaseVariation)
private
public
constructor Create;
class function GetName: string; override;
class function GetInstance: TBaseVariation; override;
function GetNrVariables: integer; override;
procedure CalcFunction; override;
end;
implementation
uses
Math;
{ TVariationSpherize }
///////////////////////////////////////////////////////////////////////////////
procedure TVariationHemisphere.CalcFunction;
var
t: double;
begin
t := vvar / sqrt(sqr(FTx^) + sqr(FTy^) + 1);
FPx^ := FPx^ + FTx^ * t;
FPy^ := FPy^ + FTy^ * t;
FPz^ := FPz^ + t;
end;
///////////////////////////////////////////////////////////////////////////////
constructor TVariationHemisphere.Create;
begin
end;
///////////////////////////////////////////////////////////////////////////////
class function TVariationHemisphere.GetInstance: TBaseVariation;
begin
Result := TVariationHemisphere.Create;
end;
///////////////////////////////////////////////////////////////////////////////
class function TVariationHemisphere.GetName: string;
begin
Result := var_name;
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationHemisphere.GetNrVariables: integer;
begin
Result := 0;
end;
///////////////////////////////////////////////////////////////////////////////
initialization
RegisterVariation(TVariationClassLoader.Create(TVariationHemisphere), true, false);
end.

462
Variations/varJulia3Djf.pas Normal file
View 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
View 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.

232
Variations/varJuliaN.pas Normal file
View File

@ -0,0 +1,232 @@
unit varJuliaN;
interface
uses
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;
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^;
end;
procedure TVariationJulian.CalcPower2;
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^;
end;
procedure TVariationJulian.CalcPowerMinus2;
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^;
end;
procedure TVariationJulian.CalcPower1;
begin
FPx^ := FPx^ + vvar * FTx^;
FPy^ := FPy^ + vvar * FTy^;
FPz^ := FPz^ + vvar * FTz^;
end;
procedure TVariationJulian.CalcPowerMinus1;
var
r: double;
begin
r := vvar / (sqr(FTx^) + sqr(FTy^));
FPx^ := FPx^ + r * FTx^;
FPy^ := FPy^ - r * FTy^;
FPz^ := FPz^ + vvar * FTz^;
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.

View File

@ -0,0 +1,251 @@
{
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
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;
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^;
end;
procedure TVariationJuliaScope.CalcPower2;
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^;
end;
procedure TVariationJuliaScope.CalcPowerMinus2;
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^;
end;
procedure TVariationJuliaScope.CalcPower1;
begin
FPx^ := FPx^ + vvar * FTx^;
FPy^ := FPy^ + vvar * FTy^;
FPz^ := FPz^ + vvar * FTz^;
end;
procedure TVariationJuliaScope.CalcPowerMinus1;
var
r: double;
begin
r := vvar / (sqr(FTx^) + sqr(FTy^));
FPx^ := FPx^ + r * FTx^;
FPy^ := FPy^ - r * FTy^;
FPz^ := FPz^ + vvar * FTz^;
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.

195
Variations/varLazysusan.pas Normal file
View 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.

139
Variations/varLog.pas Normal file
View File

@ -0,0 +1,139 @@
{
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 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;
{ TVariationPreSpherical }
///////////////////////////////////////////////////////////////////////////////
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;
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
base := 1E-6;
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.

131
Variations/varLoonie.pas Normal file
View File

@ -0,0 +1,131 @@
{
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 varLoonie;
interface
uses
BaseVariation, XFormMan;
type
TVariationLoonie = class(TBaseVariation)
private
sqrvar: 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 TVariationLoonie.Prepare;
begin
sqrvar := VVAR * VVAR;
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;
///////////////////////////////////////////////////////////////////////////////
constructor TVariationLoonie.Create;
begin
sqrvar := 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
Result := '';
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationLoonie.SetVariable(const Name: string; var value: double): boolean;
var temp: double;
begin
Result := False;
end;
function TVariationLoonie.ResetVariable(const Name: string): boolean;
begin
Result := False;
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationLoonie.GetNrVariables: integer;
begin
Result := 0
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationLoonie.GetVariable(const Name: string; var value: double): boolean;
begin
Result := False;
end;
///////////////////////////////////////////////////////////////////////////////
initialization
RegisterVariation(TVariationClassLoader.Create(TVariationLoonie), true, false);
end.

216
Variations/varMobius.pas Normal file
View File

@ -0,0 +1,216 @@
{
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 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;
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 TVariationMobius.Prepare;
begin
end;
procedure TVariationMobius.CalcFunction;
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;
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;
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';
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
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
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationMobius.GetNrVariables: integer;
begin
Result := 8
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
end;
///////////////////////////////////////////////////////////////////////////////
initialization
RegisterVariation(TVariationClassLoader.Create(TVariationMobius), true, false);
end.

187
Variations/varNGon.pas Normal file
View File

@ -0,0 +1,187 @@
{
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.

114
Variations/varPolar2.pas Normal file
View File

@ -0,0 +1,114 @@
{
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 varPolar2;
interface
uses
BaseVariation, XFormMan;
type
TVariationPolar2 = class(TBaseVariation)
private
p2vv, p2vv2: 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 TVariationPolar2.Prepare;
begin
p2vv := VVAR / PI;
p2vv2 := p2vv * 0.5;
end;
procedure TVariationPolar2.CalcFunction;
begin
FPy^ := FPy^ + p2vv2 * Ln(sqr(FTx^) + sqr(FTy^));
FPx^ := FPx^ + p2vv * ArcTan2(FTx^, FTy^);
FPz^ := FPz^ + vvar * FTz^;
end;
///////////////////////////////////////////////////////////////////////////////
constructor TVariationPolar2.Create;
begin
end;
///////////////////////////////////////////////////////////////////////////////
class function TVariationPolar2.GetInstance: TBaseVariation;
begin
Result := TVariationPolar2.Create;
end;
///////////////////////////////////////////////////////////////////////////////
class function TVariationPolar2.GetName: string;
begin
Result := 'polar2';
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationPolar2.GetVariableNameAt(const Index: integer): string;
begin
Result := '';
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationPolar2.SetVariable(const Name: string; var value: double): boolean;
begin
Result := False;
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationPolar2.GetNrVariables: integer;
begin
Result := 0
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationPolar2.GetVariable(const Name: string; var value: double): boolean;
begin
Result := False;
end;
///////////////////////////////////////////////////////////////////////////////
initialization
RegisterVariation(TVariationClassLoader.Create(TVariationPolar2), true, false);
end.

View 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.

231
Variations/varPostCrop.pas Normal file
View File

@ -0,0 +1,231 @@
{
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 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';
private
x0, y0, x1, y1, s, w, h: double;
_x0, _y0, _x1, _y1: double;
z: integer;
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 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;
w := (_x1 - _x0) * 0.5 * s;
h := (_y1 - _y0) * 0.5 * s;
end;
procedure TVariationPostCrop.CalcFunction;
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;
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_s;
5: Result := n_z;
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_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
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_s then begin
s := 0;
Result := True;
end else if Name = n_z then begin
z := 0;
Result := True;
end
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationPostCrop.GetNrVariables: integer;
begin
Result := 6
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_s then begin
Value := s;
Result := True;
end else if Name = n_z then begin
Value := z;
Result := True;
end
end;
///////////////////////////////////////////////////////////////////////////////
initialization
RegisterVariation(TVariationClassLoader.Create(TVariationPostCrop), true, false);
end.

156
Variations/varPostCurl.pas Normal file
View File

@ -0,0 +1,156 @@
{
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;
type
TVariationPostCurl = class(TBaseVariation)
private
c1, c2, c22: double;
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;
end;
implementation
uses
Math;
// TVariationCurl3D
procedure TVariationPostCurl.Prepare;
begin
c1 := c1 * VVAR;
c2 := c2 * VVAR;
c22 := 2 * c2;
end;
///////////////////////////////////////////////////////////////////////////////
procedure TVariationPostCurl.CalcFunction;
var
x, y, r, re, im: double;
begin
x := FPx^;
y := FPy^;
re := 1 + c1 * x + c2 * (sqr(x) - sqr(y));
im := c1 * y + c22 * x * y;
r := sqr(re) + sqr(im);
FPx^ := (x * re + y * im) / r;
FPy^ := (y * re - x * im) / r;
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), true, false);
end.

View File

@ -0,0 +1,187 @@
{
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,
cx2, cy2, cz2, c_2,
c2x, c2y, c2z: double;
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;
end;
implementation
uses
Math;
// TVariationCurl3D
procedure TVariationPostCurl3D.Prepare;
begin
_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);
c_2 := cx2 + cy2 + cz2;
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 := 1.0 / (r2*c_2 + c2x*x - c2y*y + c2z*z + 1);
FPx^ := r * (x + _cx*r2);
FPy^ := r * (y + _cy*r2);
FPz^ := r * (z + _cz*r2);
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.

View 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, false);
end.

227
Variations/varPreBwraps.pas Normal file
View 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.

231
Variations/varPreCrop.pas Normal file
View File

@ -0,0 +1,231 @@
{
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 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';
private
x0, y0, x1, y1, s, w, h: double;
_x0, _y0, _x1, _y1: double;
z: integer;
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 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;
w := (_x1 - _x0) * 0.5 * s;
h := (_y1 - _y0) * 0.5 * s;
end;
procedure TVariationPreCrop.CalcFunction;
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;
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_s;
5: Result := n_z;
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_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
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_s then begin
s := 0;
Result := True;
end else if Name = n_z then begin
z := 0;
Result := True;
end
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationPreCrop.GetNrVariables: integer;
begin
Result := 6
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_s then begin
Value := s;
Result := True;
end else if Name = n_z then begin
Value := z;
Result := True;
end
end;
///////////////////////////////////////////////////////////////////////////////
initialization
RegisterVariation(TVariationClassLoader.Create(TVariationPreCrop), true, false);
end.

119
Variations/varPreDisc.pas Normal file
View File

@ -0,0 +1,119 @@
{
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 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;
{ TVariationPreSpherical }
///////////////////////////////////////////////////////////////////////////////
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), true, false);
end.

View 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, false);
end.

View File

@ -0,0 +1,107 @@
{
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 varPreSinusoidal;
interface
uses
BaseVariation, XFormMan;
type
TVariationPreSinusoidal = 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;
{ TVariationPreSpherical }
///////////////////////////////////////////////////////////////////////////////
procedure TVariationPreSinusoidal.CalcFunction;
begin
FTx^ := vvar * sin(FTx^);
FTy^ := vvar * sin(FTy^);
FTz^ := VVAR * FTz^;
end;
///////////////////////////////////////////////////////////////////////////////
constructor TVariationPreSinusoidal.Create;
begin
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
Result := '';
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationPreSinusoidal.SetVariable(const Name: string; var value: double): boolean;
begin
Result := False;
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationPreSinusoidal.GetNrVariables: integer;
begin
Result := 0
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationPreSinusoidal.GetVariable(const Name: string; var value: double): boolean;
begin
Result := False;
end;
///////////////////////////////////////////////////////////////////////////////
initialization
RegisterVariation(TVariationClassLoader.Create(TVariationPreSinusoidal), true, false);
end.

View File

@ -0,0 +1,110 @@
{
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 varPreSpherical;
interface
uses
BaseVariation, XFormMan;
type
TVariationPreSpherical = 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;
{ TVariationPreSpherical }
///////////////////////////////////////////////////////////////////////////////
procedure TVariationPreSpherical.CalcFunction;
var r: double;
begin
r := vvar / (sqr(FTx^) + sqr(FTy^) + 10e-6);
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;
///////////////////////////////////////////////////////////////////////////////
function TVariationPreSpherical.GetVariableNameAt(const Index: integer): string;
begin
Result := '';
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationPreSpherical.SetVariable(const Name: string; var value: double): boolean;
begin
Result := False;
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationPreSpherical.GetNrVariables: integer;
begin
Result := 0
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationPreSpherical.GetVariable(const Name: string; var value: double): boolean;
begin
Result := False;
end;
///////////////////////////////////////////////////////////////////////////////
initialization
RegisterVariation(TVariationClassLoader.Create(TVariationPreSpherical), true, false);
end.

View File

@ -0,0 +1,215 @@
{
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
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;
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^;
end;
///////////////////////////////////////////////////////////////////////////////
procedure TVariationRadialBlur.CalcZoom;
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^;
end;
///////////////////////////////////////////////////////////////////////////////
procedure TVariationRadialBlur.CalcSpin;
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^;
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.

View File

@ -0,0 +1,175 @@
{
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.
}
{
This variation was started by Michael Faber
}
unit varRectangles;
interface
uses
BaseVariation, XFormMan;
type
TVariationRectangles = class(TBaseVariation)
private
FRectanglesX, FRectanglesY: 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 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^);
FPz^ := FPz^ + vvar * FTz^;
end;
procedure TVariationRectangles.CalcZeroX;
begin
FPx^ := FPx^ + vvar * FTx^;
FPy^ := FPy^ + vvar * ((2*floor(FTy^/FRectanglesY) + 1)*FRectanglesY - FTy^);
FPz^ := FPz^ + vvar * FTz^;
end;
procedure TVariationRectangles.CalcZeroY;
begin
FPx^ := FPx^ + vvar * ((2*floor(FTx^/FRectanglesX) + 1)*FRectanglesX - FTx^);
FPy^ := FPy^ + vvar * FTy^;
FPz^ := FPz^ + vvar * FTz^;
end;
procedure TVariationRectangles.CalcZeroXY;
begin
FPx^ := FPx^ + vvar * FTx^;
FPy^ := FPy^ + vvar * FTy^;
FPz^ := FPz^ + vvar * FTz^;
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';
else
Result := '';
end
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationRectangles.GetNrVariables: integer;
begin
Result := 2;
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
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
end;
///////////////////////////////////////////////////////////////////////////////
constructor TVariationRectangles.Create;
begin
inherited Create;
FRectanglesX := 1.0;
FRectanglesY := 1.0;
end;
///////////////////////////////////////////////////////////////////////////////
class function TVariationRectangles.GetInstance: TBaseVariation;
begin
Result := TVariationRectangles.Create;
end;
///////////////////////////////////////////////////////////////////////////////
initialization
RegisterVariation(TVariationClassLoader.Create(TVariationRectangles), true, false);
end.

147
Variations/varRings2.pas Normal file
View 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 varRings2;
interface
uses
BaseVariation, XFormMan;
type
TVariationRings2 = class(TBaseVariation)
private
FVal, dx: 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;
{ TVariationRings2 }
///////////////////////////////////////////////////////////////////////////////
procedure TVariationRings2.Prepare;
const
EPS = 1E-10;
begin
dx := sqr(FVal) + EPS;
end;
procedure TVariationRings2.CalcFunction;
var
r: double;
Length: double;
Angle: double;
begin
Length := sqrt(sqr(FTx^) + sqr(FTy^));
{ // 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;
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';
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
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationRings2.GetNrVariables: integer;
begin
Result := 1
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
end;
///////////////////////////////////////////////////////////////////////////////
initialization
RegisterVariation(TVariationClassLoader.Create(TVariationRings2), true, false);
end.

127
Variations/varScry.pas Normal file
View 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;
var temp: double;
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.

View File

@ -0,0 +1,175 @@
{
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 varSeparation;
interface
uses
BaseVariation, XFormMan;
type
TVariationSeparation = class(TBaseVariation)
private
separation_x, separation_y: double;
separation_xinside, separation_yinside: 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 TVariationSeparation.Prepare;
begin
end;
procedure TVariationSeparation.CalcFunction;
begin
if(FTx^ > 0.0) then
FPx^ := FPx^ + VVAR * (sqrt(sqr(FTx^) + sqr(separation_x))- FTx^ * (separation_xinside))
else
FPx^ := FPx^ - VVAR * (sqrt(sqr(FTx^) + sqr(separation_x))+ FTx^ * (separation_xinside)) ;
if(FTy^ > 0.0) then
FPy^ := FPy^ + VVAR * (sqrt(sqr(FTy^) + sqr(separation_y))- FTy^ * (separation_yinside))
else
FPy^ := FPy^ - VVAR * (sqrt(sqr(FTy^) + sqr(separation_y))+ FTy^ * (separation_yinside)) ;
FPz^ := FPz^ + vvar * FTz^;
end;
///////////////////////////////////////////////////////////////////////////////
constructor TVariationSeparation.Create;
begin
separation_x := 1;
separation_y := 1;
separation_xinside := 0;
separation_yinside := 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';
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
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;
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationSeparation.GetNrVariables: integer;
begin
Result := 4
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
end;
///////////////////////////////////////////////////////////////////////////////
initialization
RegisterVariation(TVariationClassLoader.Create(TVariationSeparation), true, false);
end.

141
Variations/varSplits.pas Normal file
View File

@ -0,0 +1,141 @@
{
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 varSplits;
interface
uses
BaseVariation, XFormMan;
type
TVariationSplits = class(TBaseVariation)
private
splits_x, splits_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 TVariationSplits.Prepare;
begin
end;
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);
FPz^ := FPz^ + vvar * FTz^;
end;
///////////////////////////////////////////////////////////////////////////////
constructor TVariationSplits.Create;
begin
splits_x := 0;
splits_y := 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';
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
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationSplits.GetNrVariables: integer;
begin
Result := 2
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
end;
///////////////////////////////////////////////////////////////////////////////
initialization
RegisterVariation(TVariationClassLoader.Create(TVariationSplits), true, false);
end.

188
Variations/varWaves2.pas Normal file
View 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
View 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.

149
Variations/varpdj.pas Normal file
View File

@ -0,0 +1,149 @@
{
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 varPDJ;
interface
uses
BaseVariation, XFormMan;
{$define _ASM_}
type
TVariationPDJ = class(TBaseVariation)
private
FA,FB,FC,FD: 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;
end;
implementation
uses
Math;
{ TVariationPDJ }
///////////////////////////////////////////////////////////////////////////////
procedure TVariationPDJ.CalcFunction;
begin
FPx^ := FPx^ + vvar * (sin(FA * FTy^) - cos(FB * FTx^));
FPy^ := FPy^ + vvar * (sin(FC * FTx^) - cos(FD * FTy^));
FPz^ := FPz^ + vvar * FTz^;
end;
///////////////////////////////////////////////////////////////////////////////
constructor TVariationPDJ.Create;
begin
FA := 6 * Random - 3;
FB := 6 * Random - 3;
FC := 6 * Random - 3;
FD := 6 * Random - 3;
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.