0
$\begingroup$

I have four points in a 3D space, example:

$$(0,0,1),\ (1,0,1),\ (1,0,2)\ \mbox{and}\ (0,0,2).$$

Then I have a 2D position on that square plane:

$$x = 0.5,\ y = 0.5.$$

I need to find out the 3D space point of that position in the plane. In this example it's easy: $(0.5,0,1.5)$ Because $y$ is zero. But imagine that $y$ was not zero (and not all the same), that the plane is leaning in some direction. How would I calculate the point in that case?

I imagine this should be a pretty easy thing to solve, but I can't figure it out. If at all possible, please answer in programming terms and not in straight math terms. I'm not very good at "reading math".

Also, from the few number of tags I can add to this question I'm starting to believe I'm asking in the wrong place... If so, sorry. Feel free to suggest a place where I should ask, if you can't help me here.

Update with image: The gray plane (made out of two triangles) are the real one actually existing. I create a non-existing plane on top of this, the ABCD corners are exactly the same, however it doesn't slope. What I need to do is project a pixel (blue one in example) from the non-existing plane to the existing plane. It will be in the exact same location, except that it has gained a Y value from the sloping plane.

https://i.stack.imgur.com/rIlG4.png

What I've been able to work out so far on my own is which one of the two triangles to use in the gray plane and the normal of triangle. I basically just need to figure out how I can project the pixel.

$\endgroup$
6
  • $\begingroup$ Get the equation of the plane through the points and the substitute. See mathworld.wolfram.com/Plane.html $\endgroup$
    – mfl
    Jul 3, 2014 at 22:16
  • $\begingroup$ Any chance of getting that in programmer terms? My mind can't grasp that terminology. $\endgroup$
    – Pointman
    Jul 3, 2014 at 22:37
  • $\begingroup$ I have written in the answer the explicit formula to get $z$ from $x,y.$ $\endgroup$
    – mfl
    Jul 3, 2014 at 22:50
  • $\begingroup$ I'm confused, how can the y be both 0 and 0.5 simultaneously? Do you mean that you want the centre of the square? $\endgroup$ Jul 3, 2014 at 23:25
  • $\begingroup$ Nevermind, my own fault for asking a programming question on a math board. Now someone has gone and formatted my post to look more math-ish too. That thing about y, it's because the first y is in 3D (four points creating a flat square surface facing upwards) and the second y is a representation of a coordinate on that square surface. $\endgroup$
    – Pointman
    Jul 4, 2014 at 1:19

1 Answer 1

0
$\begingroup$

Let $(A_x,A_y,A_z),(B_x,B_y,B_z)$ and $(C_x,C_y,C_z)$ three points that determines the plane.

The equation of the plane is given by

$$\left|\begin{matrix}x-A_x & y -A_y & z-A_ z \\ B_x-A_x & B_y -A_y & B_z-A_ z\\ C_x-A_x & C_y -A_y & C_z-A_ z\end{matrix}\right|=0.$$

Thus:

$$z=A_z+\frac{(B_x-A_x)(C_z-A_z)-(C_x-A_x)(B_z-A_z)}{(B_x-A_x)(C_y-A_y)-(C_x-A_x)(B_y-A_y)}(y-A_y)\\-\frac{(B_y-A_y)(C_z-A_z)-(C_y-A_y)(B_z-A_z)}{(B_x-A_x)(C_y-A_y)-(C_x-A_x)(B_y-A_y)}(x-A_x)$$

Note that in this formula everything is known, once you have the values of $x,y.$ So you can get the value of $z.$

$\endgroup$
1
  • $\begingroup$ I have no idea how to put that into usable code, anyone willing to translate it? I appreciate the answer though dude, just that I can't make much use of it. I'm guessing z is supposed to be the Y value that I'm after? Sorry, I don't have a clue over here, as I mentioned I can't "read math", only if it's presented in programming syntax (which I understand if you don't know since you're a mathematician). $\endgroup$
    – Pointman
    Jul 3, 2014 at 23:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .