示例#1
0
int
pc_point_get_double(const PCPOINT *pt, const PCDIMENSION *dim, double *d)
{
	uint8_t *ptr;
	double val;

	/* Read raw value from byte buffer */
	ptr = pt->data + dim->byteoffset;
	val = pc_double_from_ptr(ptr, dim->interpretation);
	val = pc_value_scale_offset(val, dim);

	*d = val;
	return PC_SUCCESS;
}
示例#2
0
int
pc_point_get_double(const PCPOINT *pt, const PCDIMENSION *dim, double *val)
{
	uint8_t *ptr;
	double d;

	if ( ! dim ) return PC_FAILURE;

	/* Read raw value from byte buffer */
	ptr = pt->data + dim->byteoffset;
	d = pc_double_from_ptr(ptr, dim->interpretation);
	d = pc_value_scale_offset(d, dim);

	*val = d;
	return PC_SUCCESS;
}
示例#3
0
static int
pc_point_get_double(const PCPOINT *pt, const PCDIMENSION *dim, double *d)
{
	uint8_t *ptr;
	double val;
	
	/* Read raw value from byte buffer */
	ptr = pt->data + dim->byteoffset;
	val = pc_double_from_ptr(ptr, dim->interpretation);

	/* Scale value */
	if ( dim->scale )
		val *= dim->scale;

	/* Offset value */
	if ( dim->offset )
		val += dim->offset;
	
	*d = val;
	return PC_SUCCESS;
}
示例#4
0
double
pc_value_from_ptr(const uint8_t *ptr, const PCDIMENSION *dim)
{
	double val = pc_double_from_ptr(ptr, dim->interpretation);
	return pc_value_scale_offset(val, dim);
}