63 lines
1.2 KiB
ObjectPascal
63 lines
1.2 KiB
ObjectPascal
{ Apophysis AV "Phoenix Edition" Copyright (C) 2021 Alice V. Koryagina }
|
|
|
|
unit varTangent;
|
|
|
|
interface
|
|
uses
|
|
BaseVariation, XFormMan;
|
|
|
|
type
|
|
TVariationTangent = class(TBaseVariation)
|
|
private
|
|
|
|
public
|
|
constructor Create;
|
|
|
|
class function GetName: string; override;
|
|
class function GetInstance: TBaseVariation; override;
|
|
|
|
procedure CalcFunction; override;
|
|
end;
|
|
|
|
implementation
|
|
|
|
uses
|
|
Math;
|
|
|
|
////////////////////////
|
|
|
|
procedure TVariationTangent.CalcFunction;
|
|
var
|
|
sx, cx, sy, cy: double;
|
|
begin
|
|
SinCos(FTx^, sx, cx);
|
|
SinCos(FTy^, sy, cy);
|
|
if cx = 0 then cx := 1e-20;
|
|
if cy = 0 then cy := 1e-20;
|
|
FPx^ := FPx^ + vvar * sx / cy;
|
|
FPy^ := FPy^ + vvar * sy / cy;
|
|
// AV: added real 3D support
|
|
FPz^ := FPz^ + vvar * sx / cx;
|
|
end;
|
|
|
|
constructor TVariationTangent.Create;
|
|
begin
|
|
inherited Create;
|
|
end;
|
|
|
|
class function TVariationTangent.GetInstance: TBaseVariation;
|
|
begin
|
|
Result := TVariationTangent.Create;
|
|
end;
|
|
|
|
class function TVariationTangent.GetName: string;
|
|
begin
|
|
Result := 'tangent';
|
|
end;
|
|
|
|
//////////////////////////////
|
|
initialization
|
|
RegisterVariation(TVariationClassLoader.Create(TVariationTangent), true, false);
|
|
|
|
end.
|