Horus Doc || C++ Reference || Class Overview   Pixels   Images   Detector   Geometry   Registry || Doxygen's quick Index  

Arithmetic data types

The set of arithmetic data types is defined to handle all arithmetic manipulation of (pixel) values. The set of arithmetic data types is smaller than the set of pixel representations to avoid an explosion of instantiations in the template code. The arithmetic data types do not reduce computational performance in that most current processors are not able to do arithmetic operations on the original pixel values anyway, e.g. they can not add or multiply bytes, shorts, and floats. And, even if the processor could do it, the compiler would probably not support it.

The current set of arithmetic data types includes seven elements:

HxScalarInt, HxScalarDouble, HxComplex, HxVec2Int, HxVec2Double, HxVec3Int, and HxVec3Double.

Each element can be constructed in one of the following ways: (i) without parameters (value is undefined), (ii) from another value of the same type, or (iii) from a specific number of corresponding native data types (HxScalarInt: 1 int, HxScalarDouble: 1 double, HxComplex: 2 double's, HxVec2Int: 2 int's, HxVec2Double: 2 double's, HxVec3Int: 3 int's, HxVec3Double: 3 double's). A data type can also be casted to each of the other six data types as shown in the table. No other construction/conversion paths will be defined to avoid ambiguities in expressions.

ImArith.gif

The table shows conversions between arithmetic data types. An element in the table shows the result of casting the value in the leftmost column (on the same row) to the value on the top row (in the same column). d(i) is the normal promotion of int to double as defined in C++. i(d) is the normal conversion of double to int.


Go to the next section or go to pixels or return to the index.


Generated on Mon Jan 27 15:49:12 2003 for C++Reference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001