Browse Source

* [ugluVectorEx] implemented 'abs' function

master
Bergmann89 8 years ago
parent
commit
f4a09e3657
1 changed files with 9 additions and 0 deletions
  1. +9
    -0
      ugluVectorEx.inc

+ 9
- 0
ugluVectorEx.inc View File

@@ -17,6 +17,7 @@
{$ENDIF}

function ToString(const aRound: Integer = -3): String; inline;

class function FromString(const s: String): __VEC; static; inline;
class function TryFromString(const s: String; out v: __VEC): Boolean; static; inline;
class function Zero: __VEC; static; inline;
@@ -424,6 +425,7 @@
type __HELPER_I = type helper(__HELPER) for __VEC
public
function Length: Double; inline;
function Abs: __VEC;
{$IF __SIZE <> 4}
function Add(const v: __VEC): __VEC; inline;
function Subtract(const v: __VEC): __VEC; inline;
@@ -915,6 +917,13 @@
result := __IMPL.Length(self);
end;

function __HELPER_I.Abs: __VEC;
var i: Integer;
begin
for i := Low(self) to High(self) do
result[i] := System.abs(self[i]);
end;

{$IF __SIZE <> 4}
function __HELPER_I.Add(const v: __VEC): __VEC;
begin


Loading…
Cancel
Save