I am a beginner at graphics. I am given a triangular mesh (assume a manifold mesh). I want to sample a square on a mesh that is independent of the triangulation.
I am following these steps
- Sample a triangle (based on the areas of the triangles)
- Sample a point uniformly on the triangle
- Sample a random direction
Now all corners of the square can be computed using that point as the origin (and the direction as the x-axis) on a 2D plane trivially. I want to get (Face, barycentric coordinates) of corners of the square on the mesh efficiently (preferably in C++/python) since I'll need to sample a random square again and again. I am looking at libraries such as Polyscope or pygeodesic that use the heat method to compute the geodesic distance between vertices of the mesh, but I am not sure how to get points at an arbitrary geodesic distance from another point.