@@ -63,6 +63,8 @@ abstract class Point implements Stringable
6363 CoordinateOperationMethods::EPSG_VERTICAL_OFFSET_BY_GRID_INTERPOLATION_PL_TXT => CoordinateOperationMethods::EPSG_VERTICAL_OFFSET_BY_GRID_INTERPOLATION_PL_TXT ,
6464 CoordinateOperationMethods::EPSG_VERTICAL_OFFSET_BY_GRID_INTERPOLATION_BEV_AT => CoordinateOperationMethods::EPSG_VERTICAL_OFFSET_BY_GRID_INTERPOLATION_BEV_AT ,
6565 CoordinateOperationMethods::EPSG_VERTICAL_CHANGE_BY_GEOID_GRID_DIFFERENCE_NRCAN => CoordinateOperationMethods::EPSG_VERTICAL_CHANGE_BY_GEOID_GRID_DIFFERENCE_NRCAN ,
66+ CoordinateOperationMethods::EPSG_GENERAL_POLYNOMIAL_OF_DEGREE_2 => CoordinateOperationMethods::EPSG_GENERAL_POLYNOMIAL_OF_DEGREE_2 ,
67+ CoordinateOperationMethods::EPSG_GENERAL_POLYNOMIAL_OF_DEGREE_6 => CoordinateOperationMethods::EPSG_GENERAL_POLYNOMIAL_OF_DEGREE_6 ,
6668 ];
6769
6870 /**
@@ -147,6 +149,51 @@ protected static function sign(float $number): int
147149 * @return array{xt: float, yt: float}
148150 */
149151 protected function generalPolynomialUnitless (
152+ float $ xs ,
153+ float $ ys ,
154+ UnitOfMeasure $ ordinate1OfEvaluationPointInSourceCRS ,
155+ UnitOfMeasure $ ordinate2OfEvaluationPointInSourceCRS ,
156+ UnitOfMeasure $ ordinate1OfEvaluationPointInTargetCRS ,
157+ UnitOfMeasure $ ordinate2OfEvaluationPointInTargetCRS ,
158+ Scale $ scalingFactorForSourceCRSCoordDifferences ,
159+ Scale $ scalingFactorForTargetCRSCoordDifferences ,
160+ Scale $ A0 ,
161+ Scale $ B0 ,
162+ array $ powerCoefficients ,
163+ bool $ inReverse
164+ ): array {
165+ if (!$ inReverse ) {
166+ return $ this ->generalPolynomialUnitlessForward (
167+ $ xs ,
168+ $ ys ,
169+ $ ordinate1OfEvaluationPointInSourceCRS ,
170+ $ ordinate2OfEvaluationPointInSourceCRS ,
171+ $ ordinate1OfEvaluationPointInTargetCRS ,
172+ $ ordinate2OfEvaluationPointInTargetCRS ,
173+ $ scalingFactorForSourceCRSCoordDifferences ,
174+ $ scalingFactorForTargetCRSCoordDifferences ,
175+ $ A0 ,
176+ $ B0 ,
177+ $ powerCoefficients ,
178+ );
179+ } else {
180+ return $ this ->generalPolynomialUnitlessReverse (
181+ $ xs ,
182+ $ ys ,
183+ $ ordinate1OfEvaluationPointInSourceCRS ,
184+ $ ordinate2OfEvaluationPointInSourceCRS ,
185+ $ ordinate1OfEvaluationPointInTargetCRS ,
186+ $ ordinate2OfEvaluationPointInTargetCRS ,
187+ $ scalingFactorForSourceCRSCoordDifferences ,
188+ $ scalingFactorForTargetCRSCoordDifferences ,
189+ $ A0 ,
190+ $ B0 ,
191+ $ powerCoefficients ,
192+ );
193+ }
194+ }
195+
196+ protected function generalPolynomialUnitlessForward (
150197 float $ xs ,
151198 float $ ys ,
152199 UnitOfMeasure $ ordinate1OfEvaluationPointInSourceCRS ,
@@ -189,6 +236,45 @@ protected function generalPolynomialUnitless(
189236 return ['xt ' => $ xt , 'yt ' => $ yt ];
190237 }
191238
239+ protected function generalPolynomialUnitlessReverse (
240+ float $ xs ,
241+ float $ ys ,
242+ UnitOfMeasure $ ordinate1OfEvaluationPointInSourceCRS ,
243+ UnitOfMeasure $ ordinate2OfEvaluationPointInSourceCRS ,
244+ UnitOfMeasure $ ordinate1OfEvaluationPointInTargetCRS ,
245+ UnitOfMeasure $ ordinate2OfEvaluationPointInTargetCRS ,
246+ Scale $ scalingFactorForSourceCRSCoordDifferences ,
247+ Scale $ scalingFactorForTargetCRSCoordDifferences ,
248+ Scale $ A0 ,
249+ Scale $ B0 ,
250+ array $ powerCoefficients
251+ ): array {
252+ $ result = ['xt ' => $ xs , 'yt ' => $ ys ];
253+ for ($ i = 0 ; $ i <= 15 ; ++$ i ) {
254+ $ forwardShiftedCoordinates = $ this ->generalPolynomialUnitlessForward (
255+ $ result ['xt ' ],
256+ $ result ['yt ' ],
257+ $ ordinate1OfEvaluationPointInSourceCRS ,
258+ $ ordinate2OfEvaluationPointInSourceCRS ,
259+ $ ordinate1OfEvaluationPointInTargetCRS ,
260+ $ ordinate2OfEvaluationPointInTargetCRS ,
261+ $ scalingFactorForSourceCRSCoordDifferences ,
262+ $ scalingFactorForTargetCRSCoordDifferences ,
263+ $ A0 ,
264+ $ B0 ,
265+ $ powerCoefficients
266+ );
267+ $ deltaError = [
268+ 'xt ' => $ forwardShiftedCoordinates ['xt ' ] - $ xs ,
269+ 'yt ' => $ forwardShiftedCoordinates ['yt ' ] - $ ys ,
270+ ];
271+ $ result ['xt ' ] -= $ deltaError ['xt ' ];
272+ $ result ['yt ' ] -= $ deltaError ['yt ' ];
273+ }
274+
275+ return $ result ;
276+ }
277+
192278 /**
193279 * Reversible polynomial.
194280 * @param array<string, Coefficient> $powerCoefficients
0 commit comments