Functions | |
void | Convert_Precision (HC_KEY key, const char *options) |
bool Convert_Precision | ( | HC_KEY | key, |
const char * | options | ||
) |
key | - the key that will be converted to either single or double-precision |
options | - the options string, only used if 'key' is a segment key (see details, below) |
This function is used to convert an entity to either single or double-precision. Use the options string to specify what data type you want. If key is a segment key, you must also specify which attribute you are interested in.
To convert to single-precision, the options string should be "single". For double-precision, it should be "double". If you are converting double data to single-precision data, this can be a lossy procedure as some data will necessarily be discarded. To ensure the function produces an acceptable result, you may also choose from two suboptions, "precision", and "range". To ensure the exponent part of a double-precision value will fit into a single-precision value, use the suboption "range". To ensure no significant bits are discarded from the mantissa during the conversion, use the suboption "precision". For example,
// converts to single-precision only if the mantissa is not truncated HC_Convert_Precision(myGeometryKey, "single=(precision)"); // converts to single-precision only if the exponent fits in a single-precision value HC_Convert_Precision(myGeometryKey, "single=(range)"); // converts to single-precision only if both the mantissa and exponent remain intact HC_Convert_Precision(myGeometryKey, "single=(precision, range)"); // converts to single-precision, but does not do any safety checking. data may be discarded. HC_Convert_Precision(myGeometryKey, "single");
If key is a segment key, prepend the attribute to the options string. Valid options are "camera", "modelling matrix", "clip region", and "bounding". For example, to convert the camera to a double-precision camera:
HC_Convert_Precision(mySegmentKey, "camera, double");