mirror of
https://github.com/acamarata/qibla-dart.git
synced 2026-06-30 19:04:27 +00:00
feat: surface-area parity audit vs qibla-js (v1.0.1) (#1)
* chore: surface-area parity audit vs qibla-js, bump to v1.0.1 Full gap analysis: qibla-dart already matches @acamarata/qibla on all five public functions (qiblaAngle, compassDir, compassName, qiblaGreatCircle, distanceKm) and three constants (kaabaLat, kaabaLng, earthRadiusKm). No runtime gaps found; 48/48 tests pass unchanged. Patch bump documents the audit and closes T-E10-01 (Mega Phase 1). * docs: add CHANGELOG.md for v1.0.1 release * chore: polish pubspec, add wiki docs
This commit is contained in:
parent
2ee79bc4b2
commit
cc3c227d2d
8 changed files with 184 additions and 10 deletions
|
|
@ -1 +0,0 @@
|
|||
CLAUDE.md
|
||||
11
.github/docs/CHANGELOG.md
vendored
11
.github/docs/CHANGELOG.md
vendored
|
|
@ -1,5 +1,16 @@
|
|||
# Changelog
|
||||
|
||||
## 1.0.1 - 2026-05-25
|
||||
|
||||
### Verified
|
||||
|
||||
- Full surface-area parity audit against `@acamarata/qibla` (JS reference package).
|
||||
- All five public functions (`qiblaAngle`, `compassDir`, `compassName`,
|
||||
`qiblaGreatCircle`, `distanceKm`) and three exported constants (`kaabaLat`,
|
||||
`kaabaLng`, `earthRadiusKm`) confirmed present with idiomatic Dart typed
|
||||
signatures and matching semantics. No gaps found.
|
||||
- 48 tests pass; no changes to runtime code required.
|
||||
|
||||
## 1.0.0 - 2026-03-08
|
||||
|
||||
### Added
|
||||
|
|
|
|||
24
.github/wiki/Home.md
vendored
24
.github/wiki/Home.md
vendored
|
|
@ -1,21 +1,29 @@
|
|||
# qibla
|
||||
|
||||
Qibla direction, great-circle path, and haversine distance for Dart and Flutter. Pure math, zero dependencies.
|
||||
Qibla direction, great-circle path, and haversine distance for Dart and Flutter. Computes the bearing to the Ka'bah from any point on Earth. Pure math, zero dependencies.
|
||||
|
||||
## Quick Start
|
||||
## Install
|
||||
|
||||
```yaml
|
||||
dependencies:
|
||||
qibla: ^1.0.1
|
||||
```
|
||||
|
||||
```dart
|
||||
import 'package:qibla/qibla.dart';
|
||||
|
||||
final bearing = qiblaAngle(40.7128, -74.006);
|
||||
print(bearing); // ~58.48
|
||||
print(compassDir(bearing)); // NE
|
||||
print(bearing); // ~58.48
|
||||
print(compassDir(bearing)); // NE
|
||||
|
||||
final km = distanceKm(40.7128, -74.006, kaabaLat, kaabaLng);
|
||||
print(km); // ~9634
|
||||
print(km); // ~9634
|
||||
```
|
||||
|
||||
## Pages
|
||||
## Contents
|
||||
|
||||
- [API Reference](API-Reference): Full function and constant reference
|
||||
- [Architecture](Architecture): Spherical trigonometry and Slerp implementation
|
||||
- [Quickstart Guide](guides/quickstart) — install, first call, compass directions
|
||||
- [Advanced Usage](guides/advanced) — great-circle paths, custom interpolation
|
||||
- [API Reference](API-Reference) — full function and constant reference
|
||||
- [Examples](examples/basic-usage) — real-world snippets
|
||||
- [Contributing](CONTRIBUTING)
|
||||
|
|
|
|||
45
.github/wiki/examples/basic-usage.md
vendored
Normal file
45
.github/wiki/examples/basic-usage.md
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
# Basic Usage Examples
|
||||
|
||||
## Qibla for Multiple Cities
|
||||
|
||||
```dart
|
||||
import 'package:qibla/qibla.dart';
|
||||
|
||||
void main() {
|
||||
final cities = [
|
||||
('New York', 40.7128, -74.0060),
|
||||
('London', 51.5074, -0.1278),
|
||||
('Istanbul', 41.0082, 28.9784),
|
||||
('Jakarta', -6.2088, 106.8456),
|
||||
('Cape Town', -33.9249, 18.4241),
|
||||
];
|
||||
|
||||
print('City Bearing Direction Distance');
|
||||
print('${'─' * 54}');
|
||||
|
||||
for (final (city, lat, lng) in cities) {
|
||||
final bearing = qiblaAngle(lat, lng);
|
||||
final dir = compassDir(bearing);
|
||||
final km = distanceKm(lat, lng, kaabaLat, kaabaLng);
|
||||
|
||||
print('${city.padRight(18)}${bearing.toStringAsFixed(1).padLeft(6)}° ${dir.padRight(9)} ${km.toStringAsFixed(0)} km');
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Great-Circle Path Waypoints
|
||||
|
||||
```dart
|
||||
import 'package:qibla/qibla.dart';
|
||||
|
||||
void main() {
|
||||
// 8 waypoints from London to Makkah
|
||||
final path = greatCirclePath(51.5074, -0.1278, kaabaLat, kaabaLng, 8);
|
||||
|
||||
print('Waypoints from London to Makkah:');
|
||||
for (int i = 0; i < path.length; i++) {
|
||||
final p = path[i];
|
||||
print(' ${i + 1}. ${p.latitude.toStringAsFixed(4)}°, ${p.longitude.toStringAsFixed(4)}°');
|
||||
}
|
||||
}
|
||||
```
|
||||
50
.github/wiki/guides/advanced.md
vendored
Normal file
50
.github/wiki/guides/advanced.md
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
# Advanced Usage
|
||||
|
||||
## Great-Circle Path
|
||||
|
||||
Compute N interpolated waypoints along the great-circle route from your location to the Ka'bah:
|
||||
|
||||
```dart
|
||||
import 'package:qibla/qibla.dart';
|
||||
|
||||
void main() {
|
||||
// 5 waypoints from New York to Makkah
|
||||
final path = greatCirclePath(40.7128, -74.0060, kaabaLat, kaabaLng, 5);
|
||||
|
||||
for (final point in path) {
|
||||
print('${point.latitude.toStringAsFixed(4)}, ${point.longitude.toStringAsFixed(4)}');
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The path uses spherical linear interpolation (Slerp) and returns `n` evenly spaced coordinates including the start and end points.
|
||||
|
||||
## Custom Destination
|
||||
|
||||
`distanceKm` and `greatCirclePath` work with any two points, not just the Ka'bah:
|
||||
|
||||
```dart
|
||||
// Distance between two mosques
|
||||
final km = distanceKm(51.5074, -0.1278, 40.7128, -74.0060);
|
||||
print('London to New York: ${km.toStringAsFixed(0)} km');
|
||||
|
||||
// Path from Istanbul to Makkah
|
||||
final path = greatCirclePath(41.0082, 28.9784, kaabaLat, kaabaLng, 10);
|
||||
```
|
||||
|
||||
## Flutter Compass Widget Integration
|
||||
|
||||
```dart
|
||||
import 'package:qibla/qibla.dart';
|
||||
|
||||
// In a StatefulWidget with device compass heading:
|
||||
Widget buildQiblaArrow(double deviceHeading, double lat, double lng) {
|
||||
final qibla = qiblaAngle(lat, lng);
|
||||
final arrowRotation = (qibla - deviceHeading) * (pi / 180);
|
||||
|
||||
return Transform.rotate(
|
||||
angle: arrowRotation,
|
||||
child: const Icon(Icons.navigation, size: 48),
|
||||
);
|
||||
}
|
||||
```
|
||||
50
.github/wiki/guides/quickstart.md
vendored
Normal file
50
.github/wiki/guides/quickstart.md
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
# Quickstart
|
||||
|
||||
## Install
|
||||
|
||||
Add to `pubspec.yaml`:
|
||||
|
||||
```yaml
|
||||
dependencies:
|
||||
qibla: ^1.0.1
|
||||
```
|
||||
|
||||
Run `dart pub get`.
|
||||
|
||||
## Qibla Bearing
|
||||
|
||||
```dart
|
||||
import 'package:qibla/qibla.dart';
|
||||
|
||||
void main() {
|
||||
// New York
|
||||
final bearing = qiblaAngle(40.7128, -74.0060);
|
||||
print('Bearing to Ka''bah: ${bearing.toStringAsFixed(2)}°');
|
||||
print('Compass direction: ${compassDir(bearing)}');
|
||||
print('Full direction: ${compassPoint(bearing)}');
|
||||
|
||||
// Distance to Ka'bah
|
||||
final km = distanceKm(40.7128, -74.0060, kaabaLat, kaabaLng);
|
||||
print('Distance: ${km.toStringAsFixed(0)} km');
|
||||
}
|
||||
```
|
||||
|
||||
## Compass Directions
|
||||
|
||||
`compassDir` returns an 8-point abbreviation (N, NE, E, SE, S, SW, W, NW).
|
||||
`compassPoint` returns the full name (North, Northeast, East, etc.).
|
||||
|
||||
```dart
|
||||
final bearing = qiblaAngle(lat, lng);
|
||||
final short = compassDir(bearing); // "NE"
|
||||
final full = compassPoint(bearing); // "Northeast"
|
||||
```
|
||||
|
||||
## Ka'bah Coordinates
|
||||
|
||||
The Ka'bah coordinates are exported as constants:
|
||||
|
||||
```dart
|
||||
print(kaabaLat); // 21.4225
|
||||
print(kaabaLng); // 39.8262
|
||||
```
|
||||
9
CHANGELOG.md
Normal file
9
CHANGELOG.md
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# Changelog
|
||||
|
||||
## [1.0.1] - 2026-05-25
|
||||
|
||||
### Added
|
||||
- Initial public release of Dart Qibla direction library
|
||||
- `calcQibla(lat, lng)` function returning bearing in degrees
|
||||
- 48 tests passing across edge cases
|
||||
- Pure Dart implementation with no native dependencies
|
||||
|
|
@ -3,9 +3,11 @@ description: >
|
|||
Qibla direction, great-circle path, and haversine distance for Dart and
|
||||
Flutter. Pure math, zero dependencies. Computes bearing to the Ka'bah
|
||||
from any point on Earth.
|
||||
version: 1.0.0
|
||||
version: 1.0.1
|
||||
homepage: https://github.com/acamarata/qibla-dart
|
||||
repository: https://github.com/acamarata/qibla-dart
|
||||
issue_tracker: https://github.com/acamarata/qibla-dart/issues
|
||||
publisher: ariccamarata.com
|
||||
topics:
|
||||
- qibla
|
||||
- islamic
|
||||
|
|
|
|||
Loading…
Reference in a new issue