0
$\begingroup$

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?

$\endgroup$
  • $\begingroup$ It depends on how you want to sample. But a coordinate transform would help you to not have to think too much when you do it. For example transform (0,0) to $\bf p_1$ and (1,0)to $\bf p_2 - p_1$ and (0,1)to $\bf p_3 - p_1$ $\endgroup$ – mathreadler Mar 15 '18 at 9:03
  • $\begingroup$ Interesting. So if I understand you correctly - you are suggesting to project the 3D plane onto a 2D plane, grid sample the 2D plane, and project those points back into 3D? Isn’t this transformation nonlinear due to the loss of dimensionality? $\endgroup$ – Carpetfizz Mar 15 '18 at 9:14
  • $\begingroup$ Yes something like that. I don't know what you mean by nonlinear. $\endgroup$ – mathreadler Mar 15 '18 at 9:25
  • 1
    $\begingroup$ Assuming that your 3 points form a right angle, another approach would be to pick the points $$\mathbf p_1+\frac i{h+1}(\mathbf p_3-\mathbf p_1)+\frac j{w+1}(\mathbf p_2-\mathbf p_1)$$ with $1\le i\le h$ and $1\le j\le w$. $\endgroup$ – N.Bach Mar 15 '18 at 12:19
  • 1
    $\begingroup$ There are too many ways to derive this expression, not too sure which one you'll like the most... If you're comfortable with coordinate systems, then this expression is just that: using $\mathbf p_1$ as the origin, move $\frac i{h+1}$-th of the way in direction $\mathbf p_3-\mathbf p_1$, and $\frac j{w+1}$-th of the way in direction $\mathbf p_2-\mathbf p_1$. And that is enough to get what you want, because you will move parallel to the lines joining $\mathbf p_1,\mathbf p_3$ and $\mathbf p_1,\mathbf p_2$. $\endgroup$ – N.Bach Mar 16 '18 at 11:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.