Home > Software design >  How to find the height of a 2D coordinate inside a triangle made up of 3D points?
How to find the height of a 2D coordinate inside a triangle made up of 3D points?

Time:10-12

Lets say there is a right-angled triangle in 3D space, there is 3 x,y,z coordinates to make up this triangle.

And you have an x & z coordinate that you know is inside the bounds of the triangle in 2D space. How would you go about finding the y position of the coordinates?

CodePudding user response:

Let two perpenicular edges of triangle are base vectors A and B, right angle in vertex C. Any inner point might be represented as

P = C   a * A    b * B

Make two equations for x and z coordinates in the plane, solve linear equation system for unknown coefficients a and b, then apply these coefficients to 3D case to get y-component

P.y = C.y   a * A.y   b * B.y
  • Related