0

I have a triangle in a 3D space. I know the points X an Y coordinate but I dont know the Z. How can the Z be calculated by knowing the points of the triangle and the X an Y coordinate of the point that misses Z.

Example:

Triangle points
(0, 0, 0)
(0, 10, 10)
(10, 20, 10)

Point in triagle
(5, 7, x)

So what is x?

  • Your question is not completely clear, and you might consider editing it. When you’re trying to solve your question, what do you know beforehand? How are your triangle’s points described? – Lubin Jun 30 '14 at 15:23
  • Insufficient data for meaningful answer. Since changing the z-coordinate of a point of a triangle produces a triangle, there is no definite answer to the problem as described so far. – Eric Towers Jun 30 '14 at 15:24
  • Is this http://math.stackexchange.com/questions/851742/calculate-coordinate-of-any-point-on-triangle-in-3d-plane/851752#851752 helpful? – mfl Jun 30 '14 at 15:31
  • Yes it is. Thank you. Exactly what I wanted – Hullu2000 Jun 30 '14 at 15:52

1 Answers1

2

Your numbers don’t work out, since the point turns out to be not in your triangle. I’m guessing that you just chose the points more or less at random, so I’m going to change one of your numbers to make everything work out.

If the triangle points are $P=(0,0,0)$, $Q=(0,10,10)$, and $R=(10,4,10)$ and your point $T$ is $(5,7,x)$, then the general principle is that $T$ is in the triangle $PQR$ if and only if $T=aP+bQ+cR$, with “scalars” $a,b,c$ multiplying the “vectors” $P,Q,R$, and furthermore $a+b+c=1$, and all three scalars being (weakly) between $0$ and $1$.

In this situation, because $P$ is the origin, all the products with $a$ drop out, so you get the three equations \begin{align} 10c&=5\\ 10b+4c&=7\\ 10b+10c&=x\,. \end{align} You easily solve these: $c=1/2$, then from $10b+2=7$ you get $b=1/2$ as well, and consequently $x=10$, your desired result.

Lubin
  • 62,818