62 lines
1.2 KiB
ObjectPascal
62 lines
1.2 KiB
ObjectPascal
|
{ Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina }
|
||
|
|
||
|
unit varBlade;
|
||
|
|
||
|
interface
|
||
|
uses
|
||
|
BaseVariation, XFormMan;
|
||
|
|
||
|
type
|
||
|
TVariationBlade = class(TBaseVariation)
|
||
|
private
|
||
|
|
||
|
public
|
||
|
constructor Create;
|
||
|
|
||
|
class function GetName: string; override;
|
||
|
class function GetInstance: TBaseVariation; override;
|
||
|
|
||
|
procedure CalcFunction; override;
|
||
|
end;
|
||
|
|
||
|
implementation
|
||
|
|
||
|
uses
|
||
|
Math;
|
||
|
|
||
|
////////////////////////
|
||
|
|
||
|
procedure TVariationBlade.CalcFunction;
|
||
|
var
|
||
|
r, sinr, cosr: double;
|
||
|
begin
|
||
|
r := sqrt(sqr(FTx^) + sqr(FTy^)) * vvar;
|
||
|
SinCos(r * random, sinr, cosr);
|
||
|
r := vvar * FTx^;
|
||
|
FPx^ := FPx^ + r * (cosr + sinr);
|
||
|
FPy^ := FPy^ + r * (cosr - sinr);
|
||
|
// AV: added real 3D support
|
||
|
FPz^ := FPz^ + vvar * FTy^ * (sinr - cosr);
|
||
|
end;
|
||
|
|
||
|
constructor TVariationBlade.Create;
|
||
|
begin
|
||
|
inherited Create;
|
||
|
end;
|
||
|
|
||
|
class function TVariationBlade.GetInstance: TBaseVariation;
|
||
|
begin
|
||
|
Result := TVariationBlade.Create;
|
||
|
end;
|
||
|
|
||
|
class function TVariationBlade.GetName: string;
|
||
|
begin
|
||
|
Result := 'blade';
|
||
|
end;
|
||
|
|
||
|
//////////////////////////////
|
||
|
initialization
|
||
|
RegisterVariation(TVariationClassLoader.Create(TVariationBlade), true, false);
|
||
|
|
||
|
end.
|