6#include "RoutingPoint.h"
15RoutingPoint::RoutingPoint(qreal lon, qreal lat)
17 , m_lonRad(lon * M_PI / 180.0)
19 , m_latRad(lat * M_PI / 180.0)
24qreal RoutingPoint::lon()
const
29qreal RoutingPoint::lat()
const
37 qreal deltaLon = other.m_lonRad - m_lonRad;
38 qreal y = sin(deltaLon) * cos(other.m_latRad);
39 qreal x = cos(m_latRad) * sin(other.m_latRad) - sin(m_latRad) * cos(other.m_latRad) * cos(deltaLon);
46 qreal h1 = sin(0.5 * (other.m_latRad - m_latRad));
47 qreal h2 = sin(0.5 * (other.m_lonRad - m_lonRad));
48 qreal d = h1 * h1 + cos(m_latRad) * cos(other.m_latRad) * h2 * h2;
50 return 6378137.0 * 2.0 * atan2(sqrt(d), sqrt(1.0 - d));
55 stream <<
"(" << p.
lon() <<
", " << p.
lat() <<
")";
There are many Point classes, but this is mine.
qreal lon() const
Longitude of the point.
qreal lat() const
Latitude of the point.
Binds a QML item to a specific geodetic location in screen coordinates.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:15:46 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.