Marble
6#include "RoutingPoint.h"
15RoutingPoint::RoutingPoint( qreal lon, qreal lat ) :
16 m_lon( lon), m_lonRad( lon * M_PI / 180.0 ),
17 m_lat( lat ), m_latRad( lat * M_PI / 180.0 )
22qreal RoutingPoint::lon()
const
27qreal RoutingPoint::lat()
const
35 qreal deltaLon = other.m_lonRad - m_lonRad;
36 qreal y = sin( deltaLon ) * cos( other.m_latRad );
37 qreal x = cos( m_latRad ) * sin( other.m_latRad ) -
38 sin( m_latRad ) * cos( other.m_latRad ) * cos( deltaLon );
45 qreal h1 = sin( 0.5 * ( other.m_latRad - m_latRad ) );
46 qreal h2 = sin( 0.5 * ( other.m_lonRad - m_lonRad ) );
47 qreal d = h1 * h1 + cos( m_latRad ) * cos( other.m_latRad ) * h2 * h2;
49 return 6378137.0 * 2.0 * atan2( sqrt( d ), sqrt( 1.0 - d ) );
54 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 Fri Jun 14 2024 11:54:17 by
doxygen 1.10.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.