从平面上的2D点转换为3D

Wil*_*ill 2 math graphics geometry

给定三角形表面上的2D点,三角形的每个角都是3D点,如何计算2D点的相应3D点?

com*_*orm 5

要获取三角形上特定2D点的3D位置,请使用重心坐标来插入3D顶点的位置:

2D coordinates:  u,v such that 0 <= u,v <= 1  and  u+v <= 1
  ->  barycentric coordinates:  add t such that  t+u+v = 1  ->  t = 1-(u+v)

3D vertices:  V1, V2, and V3
  ->  result = u*V1 + v*V2 + t*V3
Run Code Online (Sandbox Code Playgroud)