@pimms.value<EOL><INDENT>def label(surface, edge_data, closed):<DEDENT>
<EOL>tess = surface.tess<EOL>n = tess.vertex_count<EOL>(u,v,wu,wv) = edge_data[:<NUM_LIT:4>]<EOL>(wu,wv) = (<NUM_LIT> + <NUM_LIT:0.5>*(np.asarray(wu) - <NUM_LIT:0.5>), <NUM_LIT> + <NUM_LIT:0.5>*(np.asarray(wv) - <NUM_LIT:0.5>))<EOL>(u,v) = (tess.index(u), tess.index(v))<EOL>same  = np.union1d(u,v)<EOL>(q,wq) = [np.concatenate([a,b]) for (a,b) in [(u,v),(wu,wv)]]<EOL>m = len(q)<EOL>mm  = sps.csr_matrix((np.ones(m), (q, np.arange(m))), shape=(n, m))<EOL>lbl = zdivide(mm.dot(wq), flattest(mm.sum(axis=<NUM_LIT:1>)))<EOL>nei  = np.asarray(tess.indexed_neighborhoods)<EOL>unk  = np.full(tess.vertex_count, True, dtype=np.bool)<EOL>unk[q] = False<EOL>q = np.unique(u[~np.isin(u, v)])<EOL>while len(q) > <NUM_LIT:0>:<EOL><INDENT>q = np.unique([k for neitup in nei[q] for k in neitup]).astype(np.int64) <EOL>q = q[unk[q]] <EOL>lbl[q] = <NUM_LIT:1.0> <EOL>unk[q] = False <EOL><DEDENT>return lbl<EOL>
path.label is either None if the given path is not a closed path or an array of values, one 
per vertex in path.surface (i.e., a surface property), between 0 and 1 that specifies which
vertices are inside the closed path and which are outside of it. The specific values will
always be 1 for any vertex inside the area, 0 for any vertex outside the area, and a number
between 0 and 1 for vertices that are adjacent to the boundary (i.e., the path intersects
the vertex or one of its adjacent edges). For a given edge (u,v) that intersects the path,
the label values of u and v (lu and lv) will be such that the exact position of the edge
intersection with the path, for vertex positions xu and xv, is given by:
(lu*xu + lv*xv) / (lu + lv)
As a simple course measure, the value of (path.label >= 0.5) is a boolean property that is
true for all the vertices inside the closed path.
The inside of a label is always determined by the side of the label closed with respect to
the left side of a counter-clockwise path.