[opengtl-commits] [638] add sign, lenght and pi |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/opengtl-commits Archives
]
Revision: 638
Author: cyrille
Date: 2009-03-16 17:22:02 +0100 (Mon, 16 Mar 2009)
Log Message:
-----------
add sign, lenght and pi
Modified Paths:
--------------
trunk/OpenGTL/OpenShiva/OpenShiva/shivastdlib.shiva
Modified: trunk/OpenGTL/OpenShiva/OpenShiva/shivastdlib.shiva
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/shivastdlib.shiva 2009-03-16 16:21:45 UTC (rev 637)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/shivastdlib.shiva 2009-03-16 16:22:02 UTC (rev 638)
@@ -19,9 +19,21 @@
library stdlib
{
+ const float pi = 3.14159265358979323846;
float fabs( float v )
{
if( v < 0) return -v;
return v;
}
+ float sign( float v )
+ {
+ if( v < 0 ) return -1;
+ if( v > 0 ) return 1;
+ return v;
+ }
+ float length( float2 v)
+ {
+ v *= v;
+ return sqrt( v[0] + v[1] );
+ }
}