Skip to content

Instantly share code, notes, and snippets.

@sysint64
Created December 29, 2015 19:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sysint64/45424d4c7d64c330a023 to your computer and use it in GitHub Desktop.
Save sysint64/45424d4c7d64c330a023 to your computer and use it in GitHub Desktop.
function NormalizeGradient (Gradient : TGradient; Norm : Integer) : TGradient;
var
i, j : Integer;
Step : Integer;
begin
Result := TGradient.Create (Norm);
Step := Gradient.Size/Norm;
i := 0;
j := 0;
while (1) do
begin
Result.Data[i] := Gradient.Data[j];
Inc (i); j := j+Step;
end;
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment