mirror of
https://github.com/pgpointcloud/pointcloud.git
synced 2025-12-08 20:36:04 +00:00
Make scale = 1 the default and handle in scaling routines
This commit is contained in:
parent
9a5d48c222
commit
0b1e2eeb48
@ -88,7 +88,7 @@ pc_point_get_double(const PCPOINT *pt, const PCDIMENSION *dim, double *d)
|
||||
val = pc_double_from_ptr(ptr, dim->interpretation);
|
||||
|
||||
/* Scale value */
|
||||
if ( dim->scale )
|
||||
if ( dim->scale != 1 )
|
||||
val *= dim->scale;
|
||||
|
||||
/* Offset value */
|
||||
@ -127,7 +127,7 @@ pc_point_set_double(PCPOINT *pt, const PCDIMENSION *d, double val)
|
||||
val -= d->offset;
|
||||
|
||||
/* Scale value */
|
||||
if ( d->scale )
|
||||
if ( d->scale != 1 )
|
||||
val /= d->scale;
|
||||
|
||||
/* Get pointer into byte buffer */
|
||||
@ -352,4 +352,4 @@ pc_point_to_geometry_wkb(const PCPOINT *pt, size_t *wkbsize)
|
||||
|
||||
if ( wkbsize ) *wkbsize = size;
|
||||
return wkb;
|
||||
}
|
||||
}
|
||||
|
||||
@ -113,6 +113,8 @@ static PCDIMENSION*
|
||||
pc_dimension_new()
|
||||
{
|
||||
PCDIMENSION *pcd = pcalloc(sizeof(PCDIMENSION));
|
||||
/* Default scaling value is 1! */
|
||||
pcd->scale = 1.0;
|
||||
return pcd;
|
||||
}
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
double pc_value_scale_offset(double val, const PCDIMENSION *dim)
|
||||
{
|
||||
/* Scale value */
|
||||
if ( dim->scale )
|
||||
if ( dim->scale != 1 )
|
||||
val *= dim->scale;
|
||||
|
||||
/* Offset value */
|
||||
@ -30,7 +30,7 @@ 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);
|
||||
return pc_value_scale_offset(val, dim);
|
||||
}
|
||||
|
||||
double
|
||||
@ -179,4 +179,4 @@ pc_double_to_ptr(uint8_t *ptr, uint32_t interpretation, double val)
|
||||
}
|
||||
}
|
||||
return PC_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user