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
Id
im_math_op.h,v 1.2 2005/12/05 20:44:36 scuri Exp

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.

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

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

Generic Addition with 2 template types.

00026 {
00027   return v2 + v1;
00028 }

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

Generic Subtraction with 2 template types.

00033 {
00034   return v2 - v1;
00035 }

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

Generic Multiplication with 2 template types.

00040 {
00041   return v2 * v1;
00042 }

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

Generic Division with 2 template types.

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

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

Generic Invert.

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

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

Generic Difference with 2 template types.

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

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

Generic Minimum with 2 template types.

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

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

Generic Maximum with 2 template types.

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

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

Generic Power with 2 template types.

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

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

Generic Abssolute.

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

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

Generic Less.

00121 {
00122   return -1*v;
00123 }

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

Generic Square.

00128 {
00129   return v*v;
00130 }

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

Generic Square Root.

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

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

Generic Exponential.

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

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

Generic Logarithm.

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

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

Generic Sine.

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

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

Generic Cosine.

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

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

Sets a bit in an array.

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

int imDataBitGet imbyte *  data,
int  index
[inline]
 

Gets a bit from an array.

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