rspfDpt rspfLlxyProjection::forward(const rspfGpt &worldPoint) const
{
   rspfDpt result;

   worldToLineSample(worldPoint, result);

   return result;
}
示例#2
0
ossimDpt ossimH5GridModel::extrapolate( const ossimGpt& gpt ) const
{
   if (traceDebug())
   {
      ossimNotify(ossimNotifyLevel_DEBUG)
         <<  "DEBUG ossimH5GridModel::extrapolate: entering... " << std::endl;
   }

   theExtrapolateGroundFlag = true;
   double height = 0.0;

   //---
   // If ground point supplied has NaN components, return now with a NaN point.
   //---
   if ( (ossim::isnan(gpt.lat)) || (ossim::isnan(gpt.lon)) )
   {
      theExtrapolateGroundFlag = false;
      if (traceDebug())
      {
         ossimNotify(ossimNotifyLevel_DEBUG)
            << "DEBUG ossimH5GridModel::extrapolate: returning..." << std::endl;
      }
      return ossimDpt(ossim::nan(), ossim::nan());
   }
   
   if(ossim::isnan(gpt.hgt) == false)
   {
      height = gpt.hgt;
   }
   
   if(theSeedFunction.valid())
   {
      ossimDpt ipt;
      
      theSeedFunction->worldToLineSample(gpt, ipt);
      
      theExtrapolateGroundFlag = false;
      return ipt;
   }
   
   //---
   // Determine which edge is intersected by the radial, and establish
   // intersection:
   //---
   ossimDpt edgePt (gpt);
   ossimDpt image_center (theRefGndPt);
   if ( m_crossesDateline )
   {
      // Longitude points between 0 and 360.
      if (edgePt.lon < 0.0 ) edgePt.lon += 360.0;
      if ( image_center.lon < 0.0 ) image_center.lon += 360.0;
   }
   
   m_boundGndPolygon.clipLineSegment(image_center, edgePt);

   //---
   // Compute an epsilon perturbation in the direction away from edgePt for
   // later computing directional derivative:
   //---
   const double  DEG_PER_MTR =  8.983152841e-06; // Equator WGS-84...
   double epsilon = theMeanGSD*DEG_PER_MTR; //degrees (latitude) per pixel
   ossimDpt deltaPt (edgePt-image_center);
   ossimDpt epsilonPt (deltaPt*epsilon/deltaPt.length());
   edgePt -= epsilonPt;
   ossimDpt edgePt_prime (edgePt - epsilonPt);
       
   //---
   // Establish image point corresponding to edge point and edgePt+epsilon:
   //---
   ossimGpt edgeGP       (edgePt.lat,       edgePt.lon,       height);//gpt.hgt);
   ossimGpt edgeGP_prime (edgePt_prime.lat, edgePt_prime.lon, height);//gpt.hgt);
   if ( m_crossesDateline )
   {
      // Put longitude back between -180 and 180.
      edgeGP.limitLonTo180();
      edgeGP_prime.limitLonTo180();
   }

   worldToLineSample(edgeGP, edgePt);
   worldToLineSample(edgeGP_prime, edgePt_prime);

   //---
   // Compute approximate directional derivatives of line and sample along
   // radial at the edge:
   //---
   double dsamp_drad = (edgePt.samp - edgePt_prime.samp)/epsilon;
   double dline_drad = (edgePt.line - edgePt_prime.line)/epsilon;

   //---
   // Now extrapolate to point of interest:
   //---
   double delta = (ossimDpt(gpt) - ossimDpt(edgeGP)).length();

   
   ossimDpt extrapolated_ip (edgePt.samp + delta*dsamp_drad,
                             edgePt.line + delta*dline_drad);

   if (traceDebug())
   {
      ossimNotify(ossimNotifyLevel_DEBUG)
         << "DEBUG ossimH5GridModel::extrapolate: returning..." << std::endl;  
   }
   
   theExtrapolateGroundFlag = false;
   return extrapolated_ip;
   
} // ossimH5GridModel::extrapolate