Let's say I have two triangles in a 3D space
The triangles are, of course, made from 3 coordinates (each coordinate an X/Y/Z set)
First Triangle:
X1 = 0, Y1 = 0, Z1 = Dynamic
X2 = 1, Y2 = 0, Z2 = Dynamic
X3 = 1, Y3 = 1, Z3 = Dynamic
Second Triangle:
X1 = 0, Y1 = 0, Z1 = Dynamic
X2 = 1, Y2 = 1, Z2 = Dynamic
X3 = 1, Y3 = 0, Z3 = Dynamic
... So, basically, a square that's cut through the middle (and bends on that cut)
Each Z value for each is known, but varies from instance to instance. And they vary independently.
If I have a position (Say, X=0.13,Y=0.73)
How would I calculcate what the Z of the triangle will be at that position?
(I'm hoping for an equation or pseudocode that will calculate the value without using raytracing or any expensive functions like that)