Qibla Vector 🕋

calculating....


  1. javascript

In navigational systems, the challenge of determining orientation on a sphere requires the Haversine logic. This module calculates the precise initial bearing from any global coordinate to the Kaaba.

📡
Real-time Tracking: This system utilizes the Geolocation API to fetch coordinates and map the directional vector in a 360-degree space.
NORTH
Bearing Angle
0.00°
GPS Source
Waiting for signal...

The Core Logic

The mathematical foundation relies on calculating the arc tangent of the destination's coordinates relative to the user's position:

const dL = lon2 - lon1;
const y = Math.sin(dL) * Math.cos(lat2);
const x = Math.cos(lat1) * Math.sin(lat2) -
            Math.sin(lat1) * Math.cos(lat2) * Math.cos(dL);
const azimuth = (Math.atan2(y, x) * 180 / Math.PI + 360) % 360;

If you liked this post, please LIKE or COMMENT below! 💬✨


Comments (0)

Thank you!