Question in HOGDescriptor::computeGradient soure code

I have a question when I read the source code in opencv/modules/objdetect/src/hog.cpp(opencv/hog.cpp at master · opencv/opencv · GitHub ).

In the menber function of

cv::HOGDescriptor Struct which is 
void HOGDescriptor::computeGradient(const Mat& img, Mat& grad, Mat& qangle,Size paddingTL, Size paddingBR) const

,after calculating the gradient Dx,Dy,we need to convert them to magnitude and angle,Just as the following codes in line 566-584 do.

In my opinion, dbuf[x+width*3]*angleScale is the position of the corresponding angle. Why does it subtract 0.5f?I think the position will change if it subtract 0.5f.


for( ; x < width; x++ )	
	{
	float mag = dbuf[x+width*2], angle = dbuf[x+width*3]*angleScale **- 0.5f**;
	int hidx = cvFloor(angle);
	angle -= hidx;
	gradPtr[x*2] = mag*(1.f - angle);
	gradPtr[x*2+1] = mag*angle;
	if( hidx < 0 )
	hidx += nbins;
	else if( hidx >= nbins )
	hidx -= nbins;
	CV_Assert( (unsigned)hidx < (unsigned)nbins );
	qanglePtr[x*2] = (uchar)hidx;
	hidx++;
	hidx &= hidx < nbins ? -1 : 0;
	qanglePtr[x*2+1] = (uchar)hidx;
	}

i dont know , i dont understand.see you latter