Sampling points on a plane defined by three points

567 Views Asked by At

I have a plane in 3 dimensions defined by 3 point-vectors $\mathbf{p_1}$, $\mathbf{p_2}$, and $\mathbf{p_3}$ which equate to "top left", "top right", and "bottom left" respectively (relative to the center of the plane). I want to sample some $wh$ points from the plane, where $h$ represents the number of rows I want to sample, and $w$ represents the number of points sampled per row. For example, here's a rough sketch of sampling $w = 3$ and $h = 3$. The samples would be the intersection of the red and blue lines. (Pretend the lines are evenly spaced).

enter image description here

Here's how I tried approaching this problem.

  1. First compute $\mathbf{h}(t) = \mathbf{p_1} + t(\mathbf{p_3} - \mathbf{p_1})$ which is the line across the vertical axis of this plane.

  2. Next compute $\mathbf{w}(t) = \mathbf{p_1} + t(\mathbf{p_2} - \mathbf{p_1})$ which is the line across the horizontal axis of this plane.

  3. Compute a line parallel to $\textbf{w}(t)$ which passes through one of the $h$ evenly distributed points along the vertical axis, let's call this point $\textbf{x}$. Therefore, $\textbf{w}'(t) = \mathbf{x} + t\mathbf{w}(t)$

  4. Compute $w$ evenly spaced points along $\mathbf{w}(t)$ until you hit some horizontal end point

  5. Go to 1. until you hit some vertical end point

The thing I'm stuck on is how to compute the $t$ values to pass into my "vertical" and "horizontal" functions such that I sample points in between $\mathbf{p_1}$ and $\mathbf{p_3}$ and $\mathbf{p_1}$ and $\mathbf{p_2}$.

Also, I feel like I'm overthinking this. Is there a much simpler solution out there?