First, I’m impressed with how far you’ve gotten with this given your self-professed limitations earlier in the thread. Extracting a separate mesh is precisely how I’d have done this.
And so, with that, I will give you what I think the next steps should be in the general sense as maybe you will be able to figure it out from there.
When projecting a texture like this onto the knee, you will have some ‘surface normal’ in mind, ie: the direction that the quad would face if this were a quad. (Imagine if someone stuck a playing card to the knee.)
What you want to do then is project the 3D coordinates onto this ‘theoretical quad’ to get 2D texture coordinates and then normalize them.
You could obtain the surface normal from the center of the patch/new mesh or you could average all of the normals. (A weighted average might be the most correct… there is technically no perfect answer here.)
Once you have that, you can obtain an X and Y vector as:
Vector3f normal = ....
// Find a vector 90 degrees from both the normal and the world up vector
Vector3f left = normal.cross(Vector3f.UNIT_Y);
// Find a vector 90 degrees from both the normal and the left vector
Vector3f up = normal.cross(left);
In 3D space, left and up describe the orientation of the edges of your ‘theoretical quad’… from this we can project 3D coordinates into 2D coordinates.
// For every point in the mesh
float u = left.dot(point);
float v = up.dot(point);
Collect all of the u,v coordinates for each point, keep track of the minimum and maximum values for u and v… then go back and ‘normalize them’ so that they fall between 0 and 1. Something like:
u = (u - uMin)/(uMax - uMin);
v = (v - vMin)/(vMax - vMin);
Set this to the texture coordinate for that vertex.