Given a point in 3D space, and a plane parameterized by its coefficients (C = [a b c] where z = a*x + b*y + c), dist2plane will calculate the distance from the point to the plane along the normal.
I'm used to define a plane as "ax+by+cz+d=0", by the normal and one point or by three points. Can your formula define the XY-, YZ- and XZ-planes?
See http://en.wikipedia.org/wiki/Plane_%28geometry%29
I do not get how to define the plane:
"C: 3x1 plane coeficient vector i.e., zplane = C(1)*x+C(2)+C(3)". Which value of C defines the e.g. Z-plane?
In "sqrt(sum((po-pp)'.^2))" the transposing is inefficient. Better: "sqrt(sum((po-pp).^2, 2))"