Skip to content

Commit

Permalink
Merge pull request #21 from wingkwong/develop
Browse files Browse the repository at this point in the history
0.4.1 Bug Fix
  • Loading branch information
wingkwong authored Jun 4, 2023
2 parents d9b1e55 + c5e9764 commit e400e67
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 13 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# CHANGELOG

## 0.4.1
- fixed isGeoPointInBoundingBox typos & logic

## 0.4.0
- added dart 3 compatible changes
- revised test cases
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions example/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions lib/src/geodesy.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
6 changes: 3 additions & 3 deletions test/geodesy_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit e400e67

Please sign in to comment.