here is my 'correct' version of fisheye variation

This commit is contained in:
zueuk 2005-09-15 15:36:08 +00:00
parent a485b49738
commit 63991a1bd3

View File

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