Projecting curve to 3D object


could some one please help me out with a snippet on how to project a closed curve on a 3D surface??
What I’m trying to do is to select and color a region on a mesh by a circle, elipse or a square. This all has to be done in perspective view.
I’m not sure whether this is a real beginner question but…



This sounds like something that using the stencil buffer will help to do, much like how they use it to create shadows. However, I know nothing about stencil buffers. Hopefully someone else can provide more.

Alternatively, you can figure it out using vectors. Essentially you create a prism from your shape by extending it along the -z axis. Then you check each vertex to see if it falls in that prism. Finally colour the ones that do.