# 3D Theory - Garland-Heckbert Example

zero error:

error = vT [Q] v

error =

 p.x p.y p.z 1
 a*a a*b a*c a*d b*a b*b b*c b*d c*a c*b c*c c*d d*a d*b d*c d*d
 p.x p.y p.z 1
 p.x p.y p.z 1
 p.x *a*a + p.y * a*b + p.z * a*c + a*d p.x *b*a + p.y * b*b + p.z * b*c + b*d p.x *c*a + p.y * c*b + p.z * c*c + c*d p.x *d*a + p.y * d*b + p.z * d*c + d*d

error = p.x * a * (p.x *a + p.y * b + p.z * c + d) + p.y * b * (p.x *a + p.y * b + p.z * c + d) + p.z * c * (p.x *a + p.y * b + p.z * c + d) + d * (p.x *a + p.y * b + p.z * c + d)

error = (p.x *a + p.y * b + p.z * c + d) * (p.x *a + p.y * b + p.z * c + d)

substituting:

a = n.x
b = n.y
c = n.z
d = -(p dot n)

gives:

error = (p.x *n.x + p.y * n.y + p.z * n.z -(p dot n)) * (p.x *n.x + p.y * n.y + p.z * n.z -(p dot n))

error = (p.x *n.x + p.y * n.y + p.z * n.z - p.x *n.x - p.y * n.y - p.z * n.z) * (p.x *n.x + p.y * n.y + p.z * n.z - p.x *n.x - p.y * n.y - p.z * n.z)

cancelling out terms gives:

error = 0 * 0

error =0

so as required if no edges are collapsed the error is zero