0

I'm trying to find value for a point within a triangle or square. By "value" I do not mean coordinates. Suppose there is a value (number) assigned to each node of the square/triangle. The square/triangle is on a plane. How can I interpolate values to find out the value of the point inside.

I don't want to try the bilinear interpolation since that requires for me to know exactly which plane we are in. This plane is not in x-y or y-z or x-z. This plane can be a sloped plane in 3D. (not warped)

Thank you in advance for the help.

Neg K
  • 17
  • 7
  • And this point is on the same plane? You can convert all the 3D points to 2D points in plane coordinates (whatever you choose this to be), then use barycentric coordinates to interpolate in the triangle – August Oct 03 '22 at 02:46
  • yes I guess I am looking for something similar to barycentric that can be generalized to a square as well. – Neg K Oct 03 '22 at 17:06

1 Answers1

1

Any rectandle or triangle might be interpolated using one vertex (here A) and two vectors of adjacent sides (here AB = B - A, AC = C - A)

P(u, v) =  A + AB * u + AC * v

Parameters u,v lie in range 0..1, also for triangle their sum should not exceed 1

This representation is suitable for any plane orientation.

For reference:

 AB.x = B.x - A.x etc

 fourth vertex of rectangle is:
 D = A + AB * 1 + AC * 1
 middle of rectangle: 
 M =  A + AB * 0.5 + AC * 0.5

 middle of BC side in triangle:
 mBC = A + AB * 0.5 + AC * 0.5
 median intersection point in triangle:
 cT = A + AB * 0.5 * 2/3 + AC * 0.5 * 2/3
MBo
  • 77,366
  • 5
  • 53
  • 86