2005-09-15 11:36:08 -04:00
|
|
|
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
|
2005-09-15 12:43:23 -04:00
|
|
|
r: double;
|
2005-09-15 11:36:08 -04:00
|
|
|
begin
|
2005-09-15 12:43:23 -04:00
|
|
|
r := 2 / (sqrt(FTx^ * FTx^ + FTy^ * FTy^) + 1);
|
|
|
|
FPx^ := FPx^ + vvar * r * FTx^;
|
|
|
|
FPy^ := FPy^ + vvar * r * FTy^;
|
2005-09-15 11:36:08 -04:00
|
|
|
end;
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
class function TVariationEyefish.GetInstance: TBaseVariation;
|
|
|
|
begin
|
|
|
|
Result := TVariationEyefish.Create;
|
|
|
|
end;
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
class function TVariationEyefish.GetName: string;
|
|
|
|
begin
|
|
|
|
Result := 'eyefish';
|
|
|
|
end;
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
initialization
|
|
|
|
RegisterVariation(TVariationEyefish);
|
|
|
|
end.
|