MATLAB: Set boundaries to a plane equation

boundariesplane equation

I have a surface with four edges, namely (x1, y1, z1), (x2, y2, z2), (x3, y3, z3), (x4, y4, z4). Those four points are always coplanar and they form a rectangle. I can find a plane equation with any of 3 coordinates above, however, that equation can be applied infinitely along x, y and z. How to limit the equation so that it is valid within the surface only? In other words, how to set boundaries to a plane equation in matlab coding
i tried searching but to no avail. Thank you.

Best Answer

In THREE dimensions, FOUR points do NOT define a plane. (Well, you might get lucky, and all 4 points lie in the same plane. Luck never seems to happen for me.)
As you state, you can pick any three of those points and define a plane from them. Think of it as if 4 points define a tetrahedron. In general, they do. There are 4 planes that define a tetrahedron, the 4 facets of the tetrahedron. As well, there are 4 ways to choose 3 points from the set of 4. That is not a coincidence.
So you might decide to bound a volume as the intersection of 4 half-spaces, thus the set of points that lie entirely on one side of a plane. That would create a tetrahedron if the resulting volume was closed and bounded.
But I also sincerely don't think that is what you are asking. You talk about 4 edges, defined by 4 points, so essentially a quadrilateral region.
I think you are looking for some way to define a surface by 4 points in three dimensions. Most of the time, that surface will not be a planar one, unless as I said before, you got lucky. Good luck on that ever happening. In fact though, there are infinitely many ways to define a general surface through 4 points in 3-dimensions. This is a general problem of interpolation, one that has plagued users of MATLAB (and mathematics) forever and will do so forever, because as I said, there is no unique, simple solution.
You will typically need to choose an interpolation method, then accept what and where it brings you. But maybe what you really want is that tetrahedron. In that case, it is just 4 planes, and you already know how to do that.