本文整理汇总了C++中Vec3d::latitude方法的典型用法代码示例。如果您正苦于以下问题:C++ Vec3d::latitude方法的具体用法?C++ Vec3d::latitude怎么用?C++ Vec3d::latitude使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vec3d
的用法示例。
在下文中一共展示了Vec3d::latitude方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calculatePositionAngle
QString AngleMeasure::calculatePositionAngle(const Vec3d p1, const Vec3d p2) const
{
double y = cos(p2.latitude())*sin(p2.longitude()-p1.longitude());
double x = cos(p1.latitude())*sin(p2.latitude()) - sin(p1.latitude())*cos(p2.latitude())*cos(p2.longitude()-p1.longitude());
double r = std::atan2(y,x);
if (r<0)
r+= 2*M_PI;
unsigned int d, m;
double s;
bool sign;
if (withDecimalDegree)
{
StelUtils::radToDecDeg(r, sign, s);
if (flagUseDmsFormat)
return QString("%1d").arg(s, 0, 'f', 5);
else
return QString("%1%2").arg(s, 0, 'f', 5).arg(QChar(0x00B0));
}
else
{
StelUtils::radToDms(r, sign, d, m, s);
if (flagUseDmsFormat)
return QString("%1d %2m %3s").arg(d).arg(m).arg(s, 0, 'f', 2);
else
return QString("%1%2 %3' %4\"").arg(d).arg(QChar(0x00B0)).arg(m).arg(s, 0, 'f', 2);
}
}
示例2: calculatePositionAngle
QString AngleMeasure::calculatePositionAngle(const Vec3d p1, const Vec3d p2) const
{
double y = cos(p2.latitude())*sin(p2.longitude()-p1.longitude());
double x = cos(p1.latitude())*sin(p2.latitude()) - sin(p1.latitude())*cos(p2.latitude())*cos(p2.longitude()-p1.longitude());
double r = std::atan(y/x);
if (x<0)
r += M_PI;
if (y<0)
r += 2*M_PI;
if (r>(2*M_PI))
r -= 2*M_PI;
unsigned int d, m;
double s;
bool sign;
StelUtils::radToDms(r, sign, d, m, s);
if (flagUseDmsFormat)
return QString("%1d %2m %3s").arg(d).arg(m).arg(s, 0, 'f', 2);
else
return QString("%1%2 %3' %4\"").arg(d).arg(QChar(0x00B0)).arg(m).arg(s, 0, 'f', 2);
}