{ Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina }

unit varHeart;

interface
uses
  BaseVariation, XFormMan;

type
  TVariationHeart = class(TBaseVariation)
  private
    
  public
    constructor Create;

    class function GetName: string; override;
    class function GetInstance: TBaseVariation; override;

    procedure CalcFunction; override;
  end;


implementation

uses
  Math;
  
////////////////////////

procedure TVariationHeart.CalcFunction;
var
  FAngle, r, sinr, cosr: double;
begin
  FAngle := arctan2(FTx^, FTy^);
  r := sqrt(sqr(FTx^) + sqr(FTy^));
  Sincos(r * FAngle, sinr, cosr);
  r := r * vvar;
  FPx^ := FPx^ + r * sinr;
  FPy^ := FPy^ - r * cosr;
end;

constructor TVariationHeart.Create;
begin
  inherited Create;
end;

class function TVariationHeart.GetInstance: TBaseVariation;
begin
   Result := TVariationHeart.Create;
end;

class function TVariationHeart.GetName: string;
begin
   Result := 'heart';
end;

//////////////////////////////
initialization
  RegisterVariation(TVariationClassLoader.Create(TVariationHeart), false, false);

end.
