当前位置: 首页>>代码示例>>C++>>正文


C++ WeatherData::size方法代码示例

本文整理汇总了C++中WeatherData::size方法的典型用法代码示例。如果您正苦于以下问题:C++ WeatherData::size方法的具体用法?C++ WeatherData::size怎么用?C++ WeatherData::size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WeatherData的用法示例。


在下文中一共展示了WeatherData::size方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: collidesWithWeatherDataSet

/**
   \brief test if the radius r ball centered at current node conflict with the weatherdata

   This only does 2d testing if their z coordinates collide with each other

   This routine has been updated from treating weather data as the lower left corners
   of cellWidth*cellWidth squares.  Now they are circles of radius cellWidth.

   This returns true if any weather with a deviationProbability >= thresh is closer
   than r to any points in the weather ensemble wData.

   \param r Radius of node i.e. how far node must be from edge of weather.
   \param WeatherData A single weather ensemble.
   \param thresh Minimum deviationProbability for a weather cell to be dangerous
                        

*/
bool Node::collidesWithWeatherDataSet(double r, const WeatherData &wData, double thres)
{
    if(wData.size() == 0)
    {
        return false;                                   // if the weather data does not exist, then just return false
    }
    double x1;
    double y1;
    double z1;
    double cellWidth;
    double cellHeight;
    double deviationProbability;
    for(unsigned int i=0; i<wData.size() ; i++)
    {
        // if successfully read out all the cell data, the bottomleft corner of the cell is (x1, y1, z1)
        if(wData.getCellData(i, &x1, &y1, &z1, &deviationProbability, &cellWidth, &cellHeight)) 
        {
            if(deviationProbability <= thres)           // if the cell is not severe enough, simply skip
            {
                continue;                                               // test the next one                                                    
            }
            if(z < z1 || z > z1+cellHeight)             // if the ranges in z direction have no overlap, then skip
            {
                continue;
            }
            else
            {
                double distanceInPixels = sqrt( (x-x1)*(x-x1) + (y-y1)*(y-y1) );
                double distanceInNM = distanceInPixels*NMILESPERPIXEL;
                // If it intersects with the current cell
                if(distanceInNM < cellWidth+r ) 
                {
                    return true;        
                }
            }
        }
    }
    return false;                                                                                                       // all the cells are tested and free of intersection
}
开发者ID:herrGagen,项目名称:robustTreePlanner,代码行数:56,代码来源:NodeAndEdge.cpp


注:本文中的WeatherData::size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。