IM: im_math_op.h File Reference

IM - An Imaging Tool

im_math_op.h File Reference


Detailed Description

See Copyright Notice in im_lib.h

Go to the source code of this file.

Functions

template<class T>
crop_byte (const T &v)
template<class T1, class T2>
T1 add_op (const T1 &v1, const T2 &v2)
template<class T1, class T2>
T1 sub_op (const T1 &v1, const T2 &v2)
template<class T1, class T2>
T1 mul_op (const T1 &v1, const T2 &v2)
template<class T1, class T2>
T1 div_op (const T1 &v1, const T2 &v2)
template<class T>
inv_op (const T &v)
template<class T1, class T2>
T1 diff_op (const T1 &v1, const T2 &v2)
template<class T1, class T2>
T1 min_op (const T1 &v1, const T2 &v2)
template<class T1, class T2>
T1 max_op (const T1 &v1, const T2 &v2)
imbyte pow_op (const imbyte &v1, const imbyte &v2)
imushort pow_op (const imushort &v1, const imushort &v2)
int pow_op (const int &v1, const int &v2)
template<class T1, class T2>
T1 pow_op (const T1 &v1, const T2 &v2)
template<class T>
abs_op (const T &v)
template<class T>
less_op (const T &v)
template<class T>
sqr_op (const T &v)
int sqrt (const int &C)
template<class T>
sqrt_op (const T &v)
int exp (const int &v)
template<class T>
exp_op (const T &v)
int log (const int &v)
template<class T>
log_op (const T &v)
imcfloat sin (const imcfloat &v)
int sin (const int &v)
template<class T>
sin_op (const T &v)
int cos (const int &v)
imcfloat cos (const imcfloat &v)
template<class T>
cos_op (const T &v)
void imDataBitSet (imbyte *data, int index, int bit)
int imDataBitGet (imbyte *data, int index)

Function Documentation

template<class T>
T crop_byte const T &  v  )  [inline]
 

Crop value to Byte limit.

00018 {
00019   return v <= 0? 0: v <= 255? v: 255;
00020 }

template<class T1, class T2>
T1 add_op const T1 &  v1,
const T2 &  v2
[inline]
 

Generic Addition with 2 template types.

00025 {
00026   return v2 + v1;
00027 }

template<class T1, class T2>
T1 sub_op const T1 &  v1,
const T2 &  v2
[inline]
 

Generic Subtraction with 2 template types.

00032 {
00033   return v2 - v1;
00034 }

template<class T1, class T2>
T1 mul_op const T1 &  v1,
const T2 &  v2
[inline]
 

Generic Multiplication with 2 template types.

00039 {
00040   return v2 * v1;
00041 }

template<class T1, class T2>
T1 div_op const T1 &  v1,
const T2 &  v2
[inline]
 

Generic Division with 2 template types.

00046 {
00047 //  if (v2 == 0) return (T1)IM_NEARINF;
00048   return v1 / v2;
00049 }

template<class T>
T inv_op const T &  v  )  [inline]
 

Generic Invert.

00054 {
00055 //  if (v == 0) return (T)IM_NEARINF;
00056   return 1/v;
00057 }

template<class T1, class T2>
T1 diff_op const T1 &  v1,
const T2 &  v2
[inline]
 

Generic Difference with 2 template types.

00062 {
00063   if (v1 <= v2)
00064     return v2 - v1;
00065   return v1 - v2;
00066 }

template<class T1, class T2>
T1 min_op const T1 &  v1,
const T2 &  v2
[inline]
 

Generic Minimum with 2 template types.

00071 {
00072   if (v1 <= v2)
00073     return v1;
00074   return v2;
00075 }

template<class T1, class T2>
T1 max_op const T1 &  v1,
const T2 &  v2
[inline]
 

Generic Maximum with 2 template types.

00080 {
00081   if (v1 <= v2)
00082     return v2;
00083   return v1;
00084 }

template<class T1, class T2>
T1 pow_op const T1 &  v1,
const T2 &  v2
[inline]
 

Generic Power with 2 template types.

00104 {
00105   return (T1)pow(v1, v2);
00106 }

template<class T>
T abs_op const T &  v  )  [inline]
 

Generic Abssolute.

00111 {
00112   if (v <= 0)
00113     return -1*v;
00114   return v;
00115 }

template<class T>
T less_op const T &  v  )  [inline]
 

Generic Less.

00120 {
00121   return -1*v;
00122 }

template<class T>
T sqr_op const T &  v  )  [inline]
 

Generic Square.

00127 {
00128   return v*v;
00129 }

template<class T>
T sqrt_op const T &  v  )  [inline]
 

Generic Square Root.

00139 {
00140   return (T)sqrt(v);
00141 }

template<class T>
T exp_op const T &  v  )  [inline]
 

Generic Exponential.

00151 {
00152   return (T)exp(v);
00153 }

template<class T>
T log_op const T &  v  )  [inline]
 

Generic Logarithm.

00163 {
00164 //  if (v <= 0) return (T)IM_NEARINF;
00165   return (T)log(v);
00166 }

template<class T>
T sin_op const T &  v  )  [inline]
 

Generic Sine.

00182 {
00183   return (T)sin(v);
00184 }

template<class T>
T cos_op const T &  v  )  [inline]
 

Generic Cosine.

00200 {
00201   return (T)cos(v);
00202 }

void imDataBitSet imbyte *  data,
int  index,
int  bit
[inline]
 

Sets a bit in an array.

00206 {
00207   if (bit)
00208     data[index / 8] |=  (0x01 << (7 - (index % 8)));
00209   else
00210     data[index / 8] &= ~(0x01 << (7 - (index % 8)));
00211 }

int imDataBitGet imbyte *  data,
int  index
[inline]
 

Gets a bit from an array.

00215 {
00216   return (data[index / 8] >> (7 - (index % 8))) & 0x01;
00217 }