PostGIS  2.1.10dev-r@@SVN_REVISION@@
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 5555 of file rt_api.c.

References return().

Referenced by RASTER_getGeotransform(), and rt_raster_get_phys_params().

5558 {
5559  double theta_test ;
5560 
5561  if ( (i_mag==NULL) || (j_mag==NULL) || (theta_i==NULL) || (theta_ij==NULL))
5562  return ;
5563 
5564  /* pixel size in the i direction */
5565  *i_mag = sqrt(xscale*xscale + yskew*yskew) ;
5566 
5567  /* pixel size in the j direction */
5568  *j_mag = sqrt(xskew*xskew + yscale*yscale) ;
5569 
5570  /* Rotation
5571  * ========
5572  * Two steps:
5573  * 1] calculate the magnitude of the angle between the x axis and
5574  * the i basis vector.
5575  * 2] Calculate the sign of theta_i based on the angle between the y axis
5576  * and the i basis vector.
5577  */
5578  *theta_i = acos(xscale/(*i_mag)) ; /* magnitude */
5579  theta_test = acos(yskew/(*i_mag)) ; /* sign */
5580  if (theta_test < M_PI_2){
5581  *theta_i = -(*theta_i) ;
5582  }
5583 
5584 
5585  /* Angular separation of basis vectors
5586  * ===================================
5587  * Two steps:
5588  * 1] calculate the magnitude of the angle between the j basis vector and
5589  * the i basis vector.
5590  * 2] Calculate the sign of theta_ij based on the angle between the
5591  * perpendicular of the i basis vector and the j basis vector.
5592  */
5593  *theta_ij = acos(((xscale*xskew) + (yskew*yscale))/((*i_mag)*(*j_mag))) ;
5594  theta_test = acos( ((-yskew*xskew)+(xscale*yscale)) /
5595  ((*i_mag)*(*j_mag)));
5596  if (theta_test > M_PI_2) {
5597  *theta_ij = -(*theta_ij) ;
5598  }
5599 }
return(const char *)
Definition: dbfopen.c:1610

Here is the call graph for this function:

Here is the caller graph for this function: