23 template<
class T>
inline T
sqr(T
x){
return x*
x;}
26 template<
class T>
inline T
cube(T
x){
return x*x*
x;}
29 template<
class T>
inline T
ipow(T
x,
unsigned int n)
32 if (n == 0)
return ret;
33 for(
unsigned int i = 1; i <=
n; ++i) ret *= x;
41 return sqrt(
sqr(x)+
sqr(y));
process_name opflash particleana ie ie ie z
process_name opflash particleana ie x
T cube(T x)
More efficient cube function than pow(x,3)
T sqr(T x)
More efficient square function than pow(x,2)
process_name opflash particleana ie ie y
T ipow(T x, unsigned int n)
More efficient exponentiation function than pow(x,n) for small n.
double pythag(double x, double y)
2D Euclidean distance