int pc_patch_dimensional_compute_extent(PCPATCH_DIMENSIONAL *pdl) { int i; double xmin, xmax, ymin, ymax, xavg, yavg; int rv; PCBYTES *pcb; assert(pdl); assert(pdl->schema); /* Get x extremes */ pcb = &(pdl->bytes[pdl->schema->x_position]); rv = pc_bytes_minmax(pcb, &xmin, &xmax, &xavg); xmin = pc_value_scale_offset(xmin, pdl->schema->dims[pdl->schema->x_position]); xmax = pc_value_scale_offset(xmax, pdl->schema->dims[pdl->schema->x_position]); pdl->bounds.xmin = xmin; pdl->bounds.xmax = xmax; /* Get y extremes */ pcb = &(pdl->bytes[pdl->schema->y_position]); rv = pc_bytes_minmax(pcb, &ymin, &ymax, &yavg); ymin = pc_value_scale_offset(xmin, pdl->schema->dims[pdl->schema->y_position]); ymax = pc_value_scale_offset(xmax, pdl->schema->dims[pdl->schema->y_position]); pdl->bounds.ymin = ymin; pdl->bounds.ymax = ymax; return PC_SUCCESS; }
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; }
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; }
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); }