1
$\begingroup$

Is there a command (or a combination of commands) that takes three points of a plane and outputs the normal vector of that plane? I'm told there is a ready way of automating this, but have been unable to find it.

$\endgroup$
3
  • $\begingroup$ Hyperplane maybe work. $\endgroup$
    – cvgmt
    Commented Dec 22, 2021 at 9:21
  • 1
    $\begingroup$ Welcome to the Mathematica Stack Exchange. Please include Mathematica code that you have tried out so far. Code can be copied from the cell in your notebook and pasted in the Edit window; use the { } button in the edit window for formatting code. If you are starting out with Mathematica, then the introductory book written by the inventor is a great online resource. $\endgroup$
    – Syed
    Commented Dec 22, 2021 at 9:22
  • $\begingroup$ Similar to this, this and perhaps this. $\endgroup$
    – Syed
    Commented Dec 22, 2021 at 9:45

1 Answer 1

4
$\begingroup$

In 3D, "Cross" can be used to get a vector perpendicular to 2 given vectors.

Call the given vectors p1,p2,p3, then Cross[p2-p1,p3-p1] is a vector perpendicular to the plane through p1,p2,p3.

Here is an example:

SeedRandom[3];
{p1, p2, p3} = RandomReal[{-1, 1}, {3, 3}];
p4 = Cross[p2 - p1, p3 - p1];
Graphics3D[{
  Arrow[{{0, 0, 0}, #}] & /@ {p1, p2, p3}, Red, Arrow[{{0, 0, 0}, p4}],
  Green, Opacity[0.5], InfinitePlane[{p1, p2, p3}]
  }]

enter image description here

$\endgroup$
1
  • $\begingroup$ I will usually recommend Daniel's method, but the method hinted in Roman's comment can be made to work: Normal[Last[CoefficientArrays[Det[PadRight[Prepend[{p1, p2, p3}, {x, y, z}], {4, 4}, 1]], {x, y, z}]]] $\endgroup$ Commented Dec 22, 2021 at 13:18

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