mirror of
https://github.com/acamarata/qibla.git
synced 2026-06-30 19:04:28 +00:00
Qibla direction, great-circle path, and haversine distance. Pure math, zero dependencies.
Add typedoc and typedoc-plugin-markdown as devDependencies. Add typedoc.json config targeting src/index.ts with markdown output to .github/wiki/api. Add docs script to package.json. Generate initial API reference pages. Part of T-E8-03 — TypeDoc automation for all 12 JS/TS packages. |
||
|---|---|---|
| .github | ||
| src | ||
| .editorconfig | ||
| .gitignore | ||
| .npmrc | ||
| .nvmrc | ||
| CHANGELOG.md | ||
| eslint.config.js | ||
| LICENSE | ||
| package.json | ||
| pnpm-lock.yaml | ||
| pnpm-workspace.yaml | ||
| README.md | ||
| test-cjs.cjs | ||
| test.mjs | ||
| tsconfig.json | ||
| tsup.config.ts | ||
| typedoc.json | ||
@acamarata/qibla
Qibla direction, great-circle path, and haversine distance. Pure math, zero dependencies.
Installation
npm install @acamarata/qibla
Quick Start
import { qiblaAngle, compassDir, distanceKm, KAABA_LAT, KAABA_LNG } from '@acamarata/qibla';
// Bearing from New York to the Ka'bah
const bearing = qiblaAngle(40.7128, -74.006);
console.log(bearing); // ~58.48 degrees
console.log(compassDir(bearing)); // "NE"
// Distance in kilometers
const km = distanceKm(40.7128, -74.006, KAABA_LAT, KAABA_LNG);
console.log(km); // ~9,634
CommonJS:
const { qiblaAngle } = require('@acamarata/qibla');
Use qiblaGreatCircle(lat, lng, steps?) to generate waypoints along the great-circle path for map overlays.
TypeScript
import { qiblaAngle, CompassAbbr, CompassName } from '@acamarata/qibla';
Documentation
Full API reference, algorithm design, and spherical trigonometry notes: GitHub Wiki
Related
- pray-calc: Islamic prayer times calculator
- nrel-spa: NREL Solar Position Algorithm
- moon-sighting: Lunar crescent visibility
Acknowledgments
Ka'bah coordinates verified against published GPS surveys and cross-checked with satellite imagery. Forward azimuth formula follows standard spherical trigonometry as used in aviation and geodesy.