georust / geo

Geospatial primitives and algorithms for Rust
https://crates.io/crates/geo
Other
1.53k stars 198 forks source link

Affine flip `compose` args to be conventional #1196

Closed michaelkirk closed 3 months ago

michaelkirk commented 3 months ago

FIX: https://github.com/georust/geo/issues/1195

e.g. for "conventional" https://gdal.org/api/raster_c_api.html#_CPPv424GDALComposeGeoTransformsPKdPKdPd

/// The resulting geotransform is the equivalent to padfGT1 and then padfGT2 being applied to a point.
/// Parameters:
///     padfGT1 -- the first geotransform, six values.
///     padfGT2 -- the second geotransform, six values.
///     padfGTOut -- the output geotransform, six values, may safely be the same array as padfGT1 or padfGT2.
void GDALComposeGeoTransforms(const double *padfGeoTransform1, const double *padfGeoTransform2, double *padfGeoTransformOut)

Note:

padfGT1 and then padfGT2

... previously we were effectively doing padfGT2 and then padfGT1.

I also simplified some of the examples to have more understandable input/output. I'm not good enough at mental matrix math to know what to expect from a rotated skew.