首页 > 其他 > 详细

书中一段代码的注释

时间:2014-12-11 13:45:03      阅读:187      评论:0      收藏:0      [点我收藏+]
取自《Focus On 3D Terrain Programming》中的一段:
//--------------------------------------------------------------
// Name:              CTERRAIN::FilterHeightBand - private
// Description:       Apply the erosion filter to an individual
//                          band of height values
// Arguments:       -fpBand: the band to be filtered
//                         -iStride: how far to advance per pass
//                         -iCount: Number of passes to make
//                         -fFilter: the filter strength
// Return Value:     None
//--------------------------------------------------------------
void CTERRAIN::FilterHeightBand(float* fpBand, int iStride, int iCount, float fFilter )
{
  float v= fpBand[0];
  int j  = iStride;
  int i;

  //go through(遍历) the height band and apply the erosion filter
  for( i=0; i<iCount-1; i++ )
  {
    fpBand[j]= fFilter*v + ( 1-fFilter )*fpBand[j];
   
    v = fpBand[j];
    j+= iStride;
  }
}
滤波的一段代码,其中iStride就是步长,fFilter就是系数,为此,可以把函数参数名改为以下名称似乎更能说明函数功能:
void FilterHeightBand(float* fpBand,int iStep,int iCount,float fFilterFactor)

书中一段代码的注释

原文:http://www.cnblogs.com/QQ122252656/p/4157367.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!