class_docstr: Constrained delaunay triangulation
  
  Implementation based on [1]_.
  
  Parameters
  ----------
  pts : array
      Nx2 array of points.
  edges : array
      Nx2 array of edges (dtype=int).
  
  Notes
  -----
  * Delaunay legalization is not yet implemented. This produces a proper
    triangulation, but adding legalisation would produce fewer thin
    triangles.
  * The pts and edges arrays may be modified.
  
  References
  ----------
  .. [1] Domiter, V. and Žalik, B. Sweep‐line algorithm for constrained
     Delaunay triangulation
class_docstr_tok: ["Constrained","delaunay","triangulation","Implementation","based","on","[","1","]","_.","Parameters","--","--","--","--","--","pts",":","array","Nx2","array","of","points",".","edges",":","array","Nx2","array","of","edges","(","dtype=int",")",".","Notes","--","--","-","*","Delaunay","legalization","is","not","yet","implemented",".","This","produces","a","proper","triangulation",",","but","adding","legalisation","would","produce","fewer","thin","triangles",".","*","The","pts","and","edges","arrays","may","be","modified",".","References","--","--","--","--","--","..","[","1","]","Domiter",",","V.","and","\u017dalik",",","B.","Sweep\u2010line","algorithm","for","constrained","Delaunay","triangulation"]
docstr: Given a triangle formed by edge and i, return the triangle that shares
  edge. *i* may be either a point or the entire triangle.
docstr_tok: ["Given","a","triangle","formed","by","edge","and","i",",","return","the","triangle","that","shares","edge",".","*","i","*","may","be","either","a","point","or","the","entire","triangle","."]
code: def _adjacent_tri(self, edge, i):
      """Given a triangle formed by edge and i, return the triangle that shares
      edge. *i* may be either a point or the entire triangle.
      """
      if not np.isscalar(i):
          i = [x for x in i if x not in edge][0]
  
      try:
          pt1 = self._edges_lookup[edge]
          pt2 = self._edges_lookup[(edge[1], edge[0])]
      except KeyError:
          return None
  
      if pt1 == i:
          return (edge[1], edge[0], pt2)
      elif pt2 == i:
          return (edge[1], edge[0], pt1)
      else:
          raise RuntimeError(
              "Edge %s and point %d do not form a triangle "
              "in this mesh." % (edge, i)
          )
  
imports: from __future__ import division, print_function
  from itertools import permutations
  import numpy
  from collections import OrderedDict
label_desc: Use image node_id 10 for calling the Triangulation obj's underlying member method code with example usage: obj._adjacent_tri(edge, i) and returns: edge,  edge,  pt2, None, edge,  edge,  pt1