diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e2f85b..b476eea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # CHANGELOG +## 0.4.1 +- fixed isGeoPointInBoundingBox typos & logic + ## 0.4.0 - added dart 3 compatible changes - revised test cases diff --git a/README.md b/README.md index 1e9f7fc..06d6080 100644 --- a/README.md +++ b/README.md @@ -90,12 +90,12 @@ Convert degrees to radians num degrees = radiansToDegrees(latRadians); ``` -### isGeoPointInBoudingBox(LatLng l, LatLng topLeft, LatLng bottomRight) +### isGeoPointInBoundingBox(LatLng l, LatLng topLeft, LatLng bottomRight) -Check if a given geo point is in the bouding box +Check if a given geo point is in the bounding box ```dart -bool inBoudingBox = geodesy.isGeoPointInBoudingBox(l1, l2, l3); +bool inBoundingBox = geodesy.isGeoPointInBoundingBox(l1, l2, l3); ``` ### intersectionByPaths(LatLng l1, LatLng l2, num b1, num b2) diff --git a/example/main.dart b/example/main.dart index c47c19b..3b55bd6 100644 --- a/example/main.dart +++ b/example/main.dart @@ -33,8 +33,8 @@ void main() async { print('[midPointBetweenTwoGeoPoints] Midpoint Lng: ' + midpoint.longitude.toString()); - var inBoudingBox = geodesy.isGeoPointInBoudingBox(l3, l5, l4); - print('[isGeoPointInBoudingBox]: ' + inBoudingBox.toString()); + var inBoundingBox = geodesy.isGeoPointInBoundingBox(l3, l5, l4); + print('[isGeoPointInBoundingBox]: ' + inBoundingBox.toString()); num b1 = 108.547; num b2 = 32.435; diff --git a/lib/src/geodesy.dart b/lib/src/geodesy.dart index 98ef77a..0d4a907 100644 --- a/lib/src/geodesy.dart +++ b/lib/src/geodesy.dart @@ -173,10 +173,10 @@ class Geodesy { return x * R; } - /// check if a given geo point is in the bouding box - bool isGeoPointInBoudingBox(LatLng l, LatLng topLeft, LatLng bottomRight) { - return topLeft.latitude <= l.latitude && - l.latitude <= bottomRight.latitude && + /// check if a given geo point is in the bounding box + bool isGeoPointInBoundingBox(LatLng l, LatLng topLeft, LatLng bottomRight) { + return bottomRight.latitude <= l.latitude && + l.latitude <= topLeft.latitude && topLeft.longitude <= l.longitude && l.longitude <= bottomRight.longitude ? true diff --git a/pubspec.yaml b/pubspec.yaml index 2f8f7e6..681c103 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: geodesy description: A Dart library for geodesic and trigonometric calculations working with points and paths -version: 0.4.0 +version: 0.4.1 homepage: https://github.com/wingkwong/geodesy environment: diff --git a/test/geodesy_test.dart b/test/geodesy_test.dart index c7b3402..fe33287 100644 --- a/test/geodesy_test.dart +++ b/test/geodesy_test.dart @@ -44,12 +44,12 @@ void main() { expect(midpoint.toString(), expectedMidpoint.toString()); }); - test('isGeoPointInBoudingBox', () async { + test('isGeoPointInBoundingBox', () async { final l3 = const LatLng(51.4778, -0.0015); final l4 = const LatLng(52.205, 0.119); final l5 = const LatLng(48.857, 2.351); - final inBoudingBox = geodesy.isGeoPointInBoudingBox(l3, l5, l4); - expect(inBoudingBox, false); + final inBoundingBox = geodesy.isGeoPointInBoundingBox(l3, l5, l4); + expect(inBoundingBox, false); }); test('intersectionByPaths', () async {