Calculating UV for a coplanar 3D vertices

Hi,

I have a polygon in 3D space. All the vertices of this polygon are in same plane. (It is a 2D polygon but rotated in 3D space). Obviously, the normal of all these vertices are same. I need to calculate UV coordinates for these vertices.

I could think of an approach.
Approach:

  1. Rotate this these vertices in such a way that it becomes XY plane.
  2. Calculate UV for each vertex.
  3. Rotate back.

Is there any better approach?
If not, I need a code snippet to rotate it to make it XY plane.

Thanks in advance.

UVs are not affected by rotation. This may help you Create Custom Meshes - Babylon.js Documentation

Hi @JohnK,

UVs are not affected by rotation but I dont have the UVs in first place. Once I rotate it to XY plane, I can compute them

Where did the polygon come from? It is possible that the vertices are already in XY plane and rendered using a rotation matrix. You could check out positions of vertices see Update Vertices - Babylon.js Documentation

Vertices are not in XY plane. I want code snippet to convert them to XY plane.

  1. Is this a theoretical question?
  2. What information do you have about the polygon?
  3. How do you obtain this information?
  4. Can you produce a playground?