OSGEarth的测量分析

2300人阅读 评论(2)

pPlaceNode = new osgEarth::Annotation::PlaceNode(
MapNode, osgEarth::GeoPoint::GeoPoint(), "", textStyle);
pPlaceNode->setDynamic(true);
pPlaceNode->setText("测量结果");
pPlaceNode->setPosition(osgEarth::GeoPoint::GeoPoint(SRS, pos("经纬度")));
• 长度的计算方式使用OSGEarth提供的方式osgEarth::GeoMath::distance()
• 高度的测量直接两个点的高度差即可；
• 面积的测量，比较麻烦，考虑到需要计算球面的面积，因而需要实现计算方式。附上一个从网上找到的计算方式，由于忘记了原网站，请见谅！

网上内容，非原创算法
for (int i = 0; i < iCount; i++)
{
if (i == 0)
{
//换算成弧度;
}
else if (i == iCount - 1)
{
}
else
{
}
AM = cos(dMiddleY) * cos(dMiddleX);
BM = cos(dMiddleY) * sin(dMiddleX);
CM = sin(dMiddleY);
AL = cos(dLowY) * cos(dLowX);
BL = cos(dLowY) * sin(dLowX);
CL = sin(dLowY);
AH = cos(dHighY) * cos(dHighX);
BH = cos(dHighY) * sin(dHighX);
CH = sin(dHighY);

dCoefficientL = (AM*AM + BM*BM + CM*CM) / (AM*AL + BM*BL + CM*CL);
dCoefficientH = (AM*AM + BM*BM + CM*CM) / (AM*AH + BM*BH + CM*CH);

dALtangent = dCoefficientL * AL - AM;
dBLtangent = dCoefficientL * BL - BM;
dCLtangent = dCoefficientL * CL - CM;
dAHtangent = dCoefficientH * AH - AM;
dBHtangent = dCoefficientH * BH - BM;
dCHtangent = dCoefficientH * CH - CM;

dAngleCos = (dAHtangent * dALtangent + dBHtangent * dBLtangent + dCHtangent * dCLtangent) /
(sqrt(dAHtangent * dAHtangent + dBHtangent * dBHtangent + dCHtangent * dCHtangent) *
sqrt(dALtangent * dALtangent + dBLtangent * dBLtangent + dCLtangent * dCLtangent));

dAngleCos = acos(dAngleCos);

dANormalLine = dBHtangent * dCLtangent - dCHtangent * dBLtangent;
dBNormalLine = 0 - (dAHtangent * dCLtangent - dCHtangent * dALtangent);
dCNormalLine = dAHtangent * dBLtangent - dBHtangent * dALtangent;

if (AM != 0)
{
dOrientationValue = dANormalLine / AM;
}
else if (BM != 0)
{
dOrientationValue = dBNormalLine / BM;
}
else
{
dOrientationValue = dCNormalLine / CM;
}
if (dOrientationValue > 0)
{
dSum1 += dAngleCos;
iCount1++;
}
else
{
dSum2 += dAngleCos;
iCount2++;
}
}
if (dSum1 > dSum2)
{
dSum = dSum1 + (2 * osg::PI*iCount2 - dSum2);
}
else
{
dSum = (2 * osg::PI*iCount1 - dSum1) + dSum2;
}

dTotalArea = (dSum - (iCount - 2)*osg::PI)* osg::WGS_84_RADIUS_EQUATOR *
}
0
0

* 以上用户言论只代表其个人观点，不代表CSDN网站的观点或立场
个人资料
• 访问：116720次
• 积分：1525
• 等级：
• 排名：千里之外
• 原创：44篇
• 转载：0篇
• 译文：0篇
• 评论：101条
文章分类
评论排行
最新评论