diff --git a/Chapter 12 2D Shape Rendering by Distance Fields/makedist/edtaa3func.c b/Chapter 12 2D Shape Rendering by Distance Fields/makedist/edtaa3func.c index e6ca41f..9e217d5 100644 --- a/Chapter 12 2D Shape Rendering by Distance Fields/makedist/edtaa3func.c +++ b/Chapter 12 2D Shape Rendering by Distance Fields/makedist/edtaa3func.c @@ -74,7 +74,7 @@ void computegradient(double *img, int w, int h, double *gx, double *gy) k = i*w + j; if((img[k]>0.0) && (img[k]<1.0)) { // Compute gradient for edge pixels only gx[k] = -img[k-w-1] - SQRT2*img[k-1] - img[k+w-1] + img[k-w+1] + SQRT2*img[k+1] + img[k+w+1]; - gy[k] = -img[k-w-1] - SQRT2*img[k-w] - img[k+w-1] + img[k-w+1] + SQRT2*img[k+w] + img[k+w+1]; + gy[k] = -img[k-w-1] - SQRT2*img[k-w] - img[k-w-1] + img[k+w+1] + SQRT2*img[k+w] + img[k+w+1]; glength = gx[k]*gx[k] + gy[k]*gy[k]; if(glength > 0.0) { // Avoid division by zero glength = sqrt(glength);