PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ rt_raster_calc_phys_params()

void rt_raster_calc_phys_params ( double  xscale,
double  xskew,
double  yskew,
double  yscale,
double *  i_mag,
double *  j_mag,
double *  theta_i,
double *  theta_ij 
)

Calculates the physically significant descriptors embodied in an arbitrary geotransform.

Always succeeds unless one or more of the output pointers is set to NULL.

Parameters
xscalegeotransform coefficient o_11
xskewgeotransform coefficient o_12
yskewgeotransform coefficient o_21
yscalegeotransform coefficient o_22
i_magsize of a pixel along the transformed i axis
j_magsize of a pixel along the transformed j axis
theta_iangle by which the raster is rotated (radians positive clockwise)
theta_ijangle from transformed i axis to transformed j axis (radians positive counterclockwise)

Definition at line 254 of file rt_raster.c.

257 {
258  double theta_test ;
259 
260  if ( (i_mag==NULL) || (j_mag==NULL) || (theta_i==NULL) || (theta_ij==NULL))
261  return ;
262 
263  /* pixel size in the i direction */
264  *i_mag = sqrt(xscale*xscale + yskew*yskew) ;
265 
266  /* pixel size in the j direction */
267  *j_mag = sqrt(xskew*xskew + yscale*yscale) ;
268 
269  /* Rotation
270  * ========
271  * Two steps:
272  * 1] calculate the magnitude of the angle between the x axis and
273  * the i basis vector.
274  * 2] Calculate the sign of theta_i based on the angle between the y axis
275  * and the i basis vector.
276  */
277  *theta_i = acos(xscale/(*i_mag)) ; /* magnitude */
278  theta_test = acos(yskew/(*i_mag)) ; /* sign */
279  if (theta_test < M_PI_2){
280  *theta_i = -(*theta_i) ;
281  }
282 
283 
284  /* Angular separation of basis vectors
285  * ===================================
286  * Two steps:
287  * 1] calculate the magnitude of the angle between the j basis vector and
288  * the i basis vector.
289  * 2] Calculate the sign of theta_ij based on the angle between the
290  * perpendicular of the i basis vector and the j basis vector.
291  */
292  *theta_ij = acos(((xscale*xskew) + (yskew*yscale))/((*i_mag)*(*j_mag))) ;
293  theta_test = acos( ((-yskew*xskew)+(xscale*yscale)) /
294  ((*i_mag)*(*j_mag)));
295  if (theta_test > M_PI_2) {
296  *theta_ij = -(*theta_ij) ;
297  }
298 }
return(psObject)

References return().

Referenced by RASTER_getGeotransform(), and rt_raster_get_phys_params().

Here is the call graph for this function:
Here is the caller graph for this function: