View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from

2.0 | 1 rating Rate this file 3 Downloads (last 30 days) File Size: 1.79 KB File ID: #36363 Version: 1.0



Val Schmidt (view profile)


A function to calculate the distance from a point to a plane.

| Watch this File

File Information

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.

Required Products MATLAB
MATLAB release MATLAB 7.13 (R2011b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (4)
28 Apr 2015 Ronen Yudzinsky

26 Apr 2012 Jan Simon

Jan Simon (view profile)

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?

Comment only
25 Apr 2012 Val Schmidt

Val Schmidt (view profile)

Hi Jan,
The plane is defined by the equation:
z = C(1)x + C(2)y + C(3)

[xx yy ] = meshgrid(x,y)
C = [1 2 3];
zz = C(1)*xx+C(2)*yy+C(3)


PS. You are right about the transposing. Thanks.

Comment only
25 Apr 2012 Jan Simon

Jan Simon (view profile)

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))"

Comment only

Contact us