CInt

The Clipper Library

CInt

Del.»
{$IFDEF use_int32}
 cInt = Int32;
{$ELSE}
  cInt = Int64;
{$ENDIF}

C++ »
#ifdef use_int32
  typedef int cInt;
#else
  typedef signed long long cInt;
#endif

C#  »
#if use_int32
  using cInt = Int32;
#else
  using cInt = Int64;
#endif

cInt is the integer type used by the Clipper Library to represent vertex coordinate values. (See also IntPoint.)

The library uses integers instead of floating point values to preserve numerical robustness. (Very early versions of the library used floating point coordinates, but it became apparent that floating point imprecision was always going to cause occasional errors.)

By default cInt represents a signed 64bit integer and polygon coordinates can have any value in the range ± 9.2e+18. This accommodates the scaling of floating point coordinate values to very large integers so that very high degrees of precision can be retained during clipping. However, if coordinate values can be kept within the range ± 3.0e+9, then by avoiding large integer math, a modest ~10% improvement in clipping performance is achieved.

If the preprocessor directive use_int32 is defined, cInt will represent a signed 32bit integer. This improves clipping performance by 20-30% but the trade-off is that coordinate values are restricted to the much narrower range of ± 46340.

See Also

Defines, IntPoint