本文整理汇总了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
}