@pimms.value<EOL><INDENT>def intersected_faces(edge_data, closed):<DEDENT>
res = []<EOL>uv = np.transpose(edge_data[:<NUM_LIT:2>])<EOL>(u0,v0) = uv[-<NUM_LIT:1>] if closed else (np.nan,np.nan)<EOL>for (u,v) in uv:<EOL><INDENT>res.append([u0,v0,np.setdiff1d((u,v), (u0,v0))[<NUM_LIT:0>]])<EOL>(u0,v0) = (u,v)<EOL><DEDENT>res = np.array(res[<NUM_LIT:1>:] if not np.isfinite(res[<NUM_LIT:0>][<NUM_LIT:0>]) else res)<EOL>res.setflags(write=False)<EOL>return res<EOL>
path.intersected_faces is a matrix of faces in path.surface that intersect the given path.
  Faces are returned in a (3 x n) matrix of vertex labels. Note that faces that intersect
  the path at a single point are not included (i.e., the path must go through the face).

All faces in intersected_faces are listed such that path.intersected_edges is equal to the
first two rows of of intersected_faces, up to the last column; in other words, the faces
are given in order along/around the path, and each face is ordered in the same direction
(clockwise or counter-clockwise) as the path with respect to the path.surface outer normal,
starting with the two vertices whose edge is crossed.