本文整理汇总了C++中ossimGpt::metersPerDegree方法的典型用法代码示例。如果您正苦于以下问题:C++ ossimGpt::metersPerDegree方法的具体用法?C++ ossimGpt::metersPerDegree怎么用?C++ ossimGpt::metersPerDegree使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ossimGpt
的用法示例。
在下文中一共展示了ossimGpt::metersPerDegree方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getLocalTerrainNormal
//*****************************************************************************
// METHOD: ossimHgtRef::getLocalTerrainNormal()
//
// Get get local terrain normal unit vector.
//
//*****************************************************************************
ossimColumnVector3d ossimHgtRef::getLocalTerrainNormal(const ossimGpt& pg) const
{
ossimColumnVector3d tNorm;
const ossim_float64 delta = 100.0;
switch (theCurrentHeightRefType)
{
case AT_HGT:
// Use ellipsoid tangent plane mormal
tNorm = tNorm.zAligned();
break;
case AT_DEM:
{
// Use local 3X3 grid around point to get mean slope
NEWMAT::Matrix h(3,3);
ossimDpt mpd;
mpd = pg.metersPerDegree();
ossim_float64 dLon = delta/mpd.x;
ossim_float64 dLat = delta/mpd.y;
for (ossim_int32 lon=-1; lon<=1; ++lon)
{
ossim_float64 clon = pg.lond()+lon*dLon;
for (ossim_int32 lat=-1; lat<=1; ++lat)
{
ossim_float64 clat = pg.latd()+lat*dLat;
ossimGpt p(clat, clon, pg.height());
h(2-lat,lon+2) =
ossimElevManager::instance()->getHeightAboveEllipsoid(p);
}
}
if (traceDebug())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<<"DEBUG: getLocalTerrainNormal... 3X3 grid"<<endl;
for (ossim_int32 lat=-1; lat<=1; ++lat)
{
for (ossim_int32 lon=-1; lon<=1; ++lon)
ossimNotify(ossimNotifyLevel_DEBUG)<<" "<<h(lat+2,lon+2);
ossimNotify(ossimNotifyLevel_DEBUG)<<endl;
}
}
ossim_float64 dz_dlon =
((h(1,3)+2*h(2,3)+h(3,3))-(h(1,1)+2*h(2,1)+h(3,1)))/(8*delta);
ossim_float64 dz_dlat =
((h(1,1)+2*h(1,2)+h(1,3))-(h(3,1)+2*h(3,2)+h(3,3)))/(8*delta);
tNorm[0] = -dz_dlon;
tNorm[1] = -dz_dlat;
tNorm[2] = 1.0 - sqrt(dz_dlon*dz_dlon+dz_dlat*dz_dlat);
}
// If error condition, return z-aligned vector to allow continuation
if (ossim::isnan(tNorm[0]) ||
ossim::isnan(tNorm[1]) ||
ossim::isnan(tNorm[2]))
{
tNorm = tNorm.zAligned();
if(traceDebug())
{
ossimNotify(ossimNotifyLevel_WARN)
<< "WARNING: ossimHgtRef::getLocalTerrainNormal(): "
<< "\n error... terrain normal set to vertical..."
<< std::endl;
}
}
break;
default:
tNorm = tNorm.zAligned();
break;
}
return tNorm;
}