diff --git a/2.10/Source/VarEyefish.pas b/2.10/Source/VarEyefish.pas new file mode 100644 index 0000000..ceeecc9 --- /dev/null +++ b/2.10/Source/VarEyefish.pas @@ -0,0 +1,51 @@ +unit VarEyefish; + +interface + +uses + BaseVariation, XFormMan; + +type + TVariationEyefish = class(TBaseVariation) + public + class function GetName: string; override; + class function GetInstance: TBaseVariation; override; + + procedure CalcFunction; override; + end; + +implementation + +uses + math; + +// TVariationEyefish + +/////////////////////////////////////////////////////////////////////////////// +procedure TVariationEyefish.CalcFunction; +var + Flength, r: double; +begin + Flength := sqrt(FTx^ * FTx^ + FTy^ * FTy^); + + r := 2 * Flength / (Flength + 1); + FPx^ := FPx^ + vvar * r * FTx^ / Flength; + FPy^ := FPy^ + vvar * r * FTy^ / Flength; +end; + +/////////////////////////////////////////////////////////////////////////////// +class function TVariationEyefish.GetInstance: TBaseVariation; +begin + Result := TVariationEyefish.Create; +end; + +/////////////////////////////////////////////////////////////////////////////// +class function TVariationEyefish.GetName: string; +begin + Result := 'eyefish'; +end; + +/////////////////////////////////////////////////////////////////////////////// +initialization + RegisterVariation(TVariationEyefish); +end.