Will
Will

Reputation: 75635

convert from 2D point on a plane to 3D

Given a 2D point that is on the surface of a triangle, where each corner of the triangle is a 3D point, how can you compute the corresponding 3D point of the 2D point?

Upvotes: 3

Views: 707

Answers (1)

comingstorm
comingstorm

Reputation: 26107

To get the 3D location of a particular 2D point on a triangle, use barycentric coordinates to interpolate the locations of the 3D vertices:

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

Upvotes: 5

Related Questions