I am using an old Runescape model format, also used by Thief and Quake. In this format, instead of specifying UV coordinates for each vertex ABC, we specify a second trio of vertices PMN. Those vertices are then used to project UV texture coordinates onto ABC. [Some previous Q&A explains this projection algorithm and how to reverse it][1]. I have a mesh with UVs that I want to save in this format. To do that, I want to find a trio of vertices PMN for each triangle ABC that reproduce the correct UVs. These PMN vertices are chosen from the collection of vertices already in my mesh. I could search every possible ordered triangle in my mesh, but that scales as \$O(n^3)\$ and would be impractical for meshes with high vertex counts. How can I more efficiently find a PMN triangle that produces my desired UV coordinates on each triangle ABC? [1]: https://gamedev.stackexchange.com/questions/185427/reversing-plane-projection-texture-mapping-algorithm