Linearizing the Paraboloid Depth Approximation

Kenny Hoff
6/17/97



Given the following equation for evaluating the depth at a pixel location (x,y):
  f(x,y) = z = c + ( (r2 - (x-a)2 - (y-b)2) / r )
We can rewrite to fit the previous form used to linearize the scan-conversion of the circle:
  f(x,y) = z = Ax + By + C - Q

  z = c + ( (r2 - (x-a)2 - (y-b)2) / r )
    = c + r - ((x-a)2)/r - ((y-b)2)/r
    = c + r - (x2 - 2ax + a2)/r - (y2 - 2by + b2)/r
    = c + r - x2/r + 2ax/r - a2/r - y2/r + 2by/r - b2/r
    = (2a/r)x + (2b/r)y + (c + r - a2/r - b2/r) + (-x2/r - y2/r)
 
  A = 2a/r
  B = 2b/r
  C = c + (r2 - a2 - b2) / r
  Q = (x2 + y2) / r
This form is quite convenient since we need not even use the linear expression evaluator since most of these calculations have already been performed for the scan-conversion process. In the circle scan-conversion we calculated the following:
  Aprev = 2a
  Bprev = 2b
  Cprev = r2 - a2 - b2
  Qbuffer(x,y) = x2 + y2
So if we rewrite our new A,B,C,Q values in terms of the previously calculated values:
  A = Aprev/r
  B = Bprev/r
  C = c + Cprev/r
  Q = Qbuffer(x,y)/r
Now are z-value can be calculated as follows:
  f(x,y) = z = (Aprev/r)x + (Bprev/r)y + c + Cprev/r - Qbuffer(x,y)/r
If we multiply through by r we obtain a simplified expression that evaluates zr.
  f(x,y) = zr = Aprev*x + Bprev*y + Cprev + cr - Qbuffer(x,y)
This form is even better because now we have a form from which we can use the entire linear expression result used for the in-out test in circle scan-conversion.
  f(x,y)*r = zr = (Aprev*x + Bprev*y + Cprev) + cr - Qbuffer(x,y)
(Aprev*x + Bprev*y + Cprev) was already calculated. So our resulting formula for calculating z is as follows:
  f(x,y) = z = ( PrevLinearExpressionEval + cr - Qbuffer(x,y) ) / r

Here we show the difference between spherical and parabolic depth evaluation with gray-values indicating depth.

Spherical
Parabolic