1
$\begingroup$

I was tasked with finding a distance between a plane of the form $ax+by+cz +d=0$ and a point say $(a,b)$. Now I know a way to show a plane in Mathematica is with

InfinitePlane[{{a, b}, {c, d}, {f, g}}]

but I dont know how to relate this to distance or anything of the sort..

any hints?

$\endgroup$
2
  • 6
    $\begingroup$ If memory serves, the distance between a point $(x_0,y_0,z_0)$ and plane $ax+by+cz +d=0$ could be calculated via the following formula:$$d_0=\frac{\left|ax_0+by_0+cz_0+d\right|}{\sqrt{a^2+b^2+c^2}}$$ $\endgroup$
    – xyz
    Jun 12, 2016 at 9:35
  • $\begingroup$ @ShutaoTANG Upvote that server. :) $\endgroup$
    – yode
    Jun 12, 2016 at 10:09

1 Answer 1

13
$\begingroup$

You can use RegionDistance to find the distance from a point to a region.

{a, b, c, d} = {1, 2, 3, 4};

plane = ImplicitRegion[a x + b y + c z + d == 0, {x, y, z}];

RegionDistance[plane, {x0, y0, z0}] // Simplify

(* Sqrt[(4 + x0 + 2 y0 + 3 z0)^2]/Sqrt[14] *)

However it is probably a good idea to also read this to understand how to find the answer manually.

$\endgroup$
5
  • $\begingroup$ It's a good suggestion, which does not however yield correct results $\endgroup$
    – Bak1139
    Jun 12, 2016 at 11:40
  • $\begingroup$ That's a bit vague, @Bak. Why not include an example of this incorrect result you speak of in your question? $\endgroup$ Jun 12, 2016 at 13:42
  • $\begingroup$ @Bak1139, I've removed the PowerExpand - is that what you were referring to? $\endgroup$ Jun 12, 2016 at 13:49
  • $\begingroup$ PowerExpand is alright, whenever I run the code I get different results all the time, so I suspect my copy of Mathematica is to blame. $\endgroup$
    – Bak1139
    Jun 12, 2016 at 13:52
  • 4
    $\begingroup$ note you can use InfintePlane here as well, Simplify@RegionDistance[ InfinitePlane[{{0, 1, -2}, {1, -1, -1}, {0, -2, 0}}], {x0, y0, z0}] -> same result. $\endgroup$
    – george2079
    Jun 12, 2016 at 16:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.