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;
|
|
|
|
|
2005-10-19 14:51:05 -04:00
|
|
|
// TVariationEyefish, the correct "fish-eye" variation
|
2005-09-15 11:36:08 -04:00
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
procedure TVariationEyefish.CalcFunction;
|
2005-09-22 12:08:29 -04:00
|
|
|
{$if false}
|
2005-09-15 11:36:08 -04:00
|
|
|
var
|
2005-09-15 12:43:23 -04:00
|
|
|
r: double;
|
2005-09-15 11:36:08 -04:00
|
|
|
begin
|
2005-11-06 05:47:13 -05:00
|
|
|
r := 2 * vvar / (sqrt(sqr(FTx^) + sqr(FTy^)) + 1);
|
2005-09-22 12:08:29 -04:00
|
|
|
FPx^ := FPx^ + r * FTx^;
|
|
|
|
FPy^ := FPy^ + r * FTy^;
|
|
|
|
{$else}
|
|
|
|
asm
|
|
|
|
fld qword ptr [eax+vvar]
|
|
|
|
fadd st, st
|
|
|
|
|
|
|
|
mov ecx, [eax+FTy]
|
|
|
|
fld qword ptr [ecx]
|
|
|
|
mov ecx, [eax+FTx]
|
|
|
|
fld qword ptr [ecx]
|
|
|
|
|
|
|
|
fld st(1)
|
|
|
|
fmul st, st
|
|
|
|
fld st(1)
|
|
|
|
fmul st, st
|
|
|
|
fadd
|
|
|
|
fsqrt
|
|
|
|
|
|
|
|
fld1
|
|
|
|
fadd
|
|
|
|
fdivp st(3), st
|
|
|
|
|
|
|
|
fmul st, st(2)
|
|
|
|
mov ecx, [eax+FPx]
|
|
|
|
fadd qword ptr [ecx]
|
|
|
|
fstp qword ptr [ecx]
|
|
|
|
|
|
|
|
fmulp
|
|
|
|
mov ecx, [eax+FPy]
|
|
|
|
fadd qword ptr [ecx]
|
|
|
|
fstp qword ptr [ecx]
|
|
|
|
|
2005-10-19 14:51:05 -04:00
|
|
|
fwait
|
2005-09-22 12:08:29 -04:00
|
|
|
{$ifend}
|
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.
|