@@ -186,52 +186,6 @@ public static double bearing(Point point1, Point point2) {
186
186
return (radiansToDegrees (Math .atan2 (y , x )) + 360 ) % 360 ;
187
187
}
188
188
189
- /**
190
- * Get the geodesic midpoint in degrees between two points in degrees
191
- *
192
- * @param point1
193
- * point 1
194
- * @param point2
195
- * point 2
196
- * @return geodesic midpoint in degrees
197
- * @since 2.2.2
198
- */
199
- public static Point geodesicMidpoint (Point point1 , Point point2 ) {
200
- Point point1Radians = degreesToRadians (point1 );
201
- Point point2Radians = degreesToRadians (point2 );
202
- Point midpointRadians = geodesicMidpointRadians (point1Radians ,
203
- point2Radians );
204
- return radiansToDegrees (midpointRadians );
205
- }
206
-
207
- /**
208
- * Get the geodesic midpoint in radians between two points in radians
209
- *
210
- * @param point1
211
- * point 1
212
- * @param point2
213
- * point 2
214
- * @return geodesic midpoint in radians
215
- * @since 2.2.2
216
- */
217
- public static Point geodesicMidpointRadians (Point point1 , Point point2 ) {
218
-
219
- double xDiff = point2 .getX () - point1 .getX ();
220
- double y1 = point1 .getY ();
221
- double y2 = point2 .getY ();
222
- double x1 = point1 .getX ();
223
-
224
- double bx = Math .cos (y2 ) * Math .cos (xDiff );
225
- double by = Math .cos (y2 ) * Math .sin (xDiff );
226
-
227
- double y = Math .atan2 (Math .sin (y1 ) + Math .sin (y2 ),
228
- Math .sqrt ((Math .cos (y1 ) + bx ) * (Math .cos (y1 ) + bx ) + by * by ));
229
- double x = x1 + Math .atan2 (by , Math .cos (y1 ) + bx );
230
- Point midpoint = new Point (x , y );
231
-
232
- return midpoint ;
233
- }
234
-
235
189
/**
236
190
* Get the bearing heading in degrees between line end points in degrees
237
191
*
@@ -299,6 +253,52 @@ public static boolean isWestBearing(double bearing) {
299
253
return (bearing % 360.0 ) > GeometryConstants .BEARING_SOUTH ;
300
254
}
301
255
256
+ /**
257
+ * Get the geodesic midpoint in degrees between two points in degrees
258
+ *
259
+ * @param point1
260
+ * point 1
261
+ * @param point2
262
+ * point 2
263
+ * @return geodesic midpoint in degrees
264
+ * @since 2.2.2
265
+ */
266
+ public static Point geodesicMidpoint (Point point1 , Point point2 ) {
267
+ Point point1Radians = degreesToRadians (point1 );
268
+ Point point2Radians = degreesToRadians (point2 );
269
+ Point midpointRadians = geodesicMidpointRadians (point1Radians ,
270
+ point2Radians );
271
+ return radiansToDegrees (midpointRadians );
272
+ }
273
+
274
+ /**
275
+ * Get the geodesic midpoint in radians between two points in radians
276
+ *
277
+ * @param point1
278
+ * point 1
279
+ * @param point2
280
+ * point 2
281
+ * @return geodesic midpoint in radians
282
+ * @since 2.2.2
283
+ */
284
+ public static Point geodesicMidpointRadians (Point point1 , Point point2 ) {
285
+
286
+ double xDiff = point2 .getX () - point1 .getX ();
287
+ double y1 = point1 .getY ();
288
+ double y2 = point2 .getY ();
289
+ double x1 = point1 .getX ();
290
+
291
+ double bx = Math .cos (y2 ) * Math .cos (xDiff );
292
+ double by = Math .cos (y2 ) * Math .sin (xDiff );
293
+
294
+ double y = Math .atan2 (Math .sin (y1 ) + Math .sin (y2 ),
295
+ Math .sqrt ((Math .cos (y1 ) + bx ) * (Math .cos (y1 ) + bx ) + by * by ));
296
+ double x = x1 + Math .atan2 (by , Math .cos (y1 ) + bx );
297
+ Point midpoint = new Point (x , y );
298
+
299
+ return midpoint ;
300
+ }
301
+
302
302
/**
303
303
* Convert degrees to radians
304
304
*
0 commit comments