title: Intersection of a mesh with a parametric surface
body: <p>I'm wondering how a precise algorithm can be written to compute the frontier of the surface of intersection between a parametric surface <code>f : R^2 --&gt; R^3</code>  and a triangulated mesh.</p>
  
  <p>I've thought to a first approach:</p>
  
  <pre><code>nStepsU = 100
  nStepsV = 100
  tolerance=0.01 // pick some sensical value
  intersectionVertices={}
  for  u from minU to maxU in nStepsU:
      for v from minV to maxV in nStepsV:
          for v in verticesInMesh:
               if euclidean distance( f(u,v), v ) &lt; tolerance:
                   add vertex v in a set
  
  connect the vertices in intersectionVertices with a line strip
  draw the vertices in intersectionVertices
  </code></pre>
  
  <p>This algorithm, is very simple but slow (n^3) and does not keep in account that the topography of the mesh is based on triangles so the output points are points of the mesh and not points computed exploiting the intersection of surface with the triangles and is heavily dependent of the tolerance one has to set.</p>
  
  <p>Has someone some better idea or can one drive me to a suitable library for this purpose?</p>