def joinXIntersectionsTables(fromTable, intoTable):
 joinedKeyTable = {}
 concatenatedTableKeys = (fromTable.keys() + intoTable.keys())
 for concatenatedTableKey in concatenatedTableKeys:
  joinedKeyTable[concatenatedTableKey] = None
 for joinedKey in joinedKeyTable.keys():
  xIntersectionIndexList = []
  if (joinedKey in intoTable):
   addXIntersectionIndexesFromXIntersections(0, xIntersectionIndexList, intoTable[joinedKey])
  if (joinedKey in fromTable):
   addXIntersectionIndexesFromXIntersections(1, xIntersectionIndexList, fromTable[joinedKey])
  xIntersections = getJoinOfXIntersectionIndexes(xIntersectionIndexList)
  if (len(xIntersections) > 0):
   intoTable[joinedKey] = xIntersections
  else:
   print 'This should never happen, there are no line segments in joinSegments in euclidean'

def joinXIntersectionsTables ( fromTable , intoTable ) : joinedKeyTable = { } concatenatedTableKeys = ( fromTable . keys ( ) + intoTable . keys ( ) ) for concatenatedTableKey in concatenatedTableKeys : joinedKeyTable [ concatenatedTableKey ] = None for joinedKey in joinedKeyTable . keys ( ) : xIntersectionIndexList = [ ] if ( joinedKey in intoTable ) : addXIntersectionIndexesFromXIntersections ( 0 , xIntersectionIndexList , intoTable [ joinedKey ] ) if ( joinedKey in fromTable ) : addXIntersectionIndexesFromXIntersections ( 1 , xIntersectionIndexList , fromTable [ joinedKey ] ) xIntersections = getJoinOfXIntersectionIndexes ( xIntersectionIndexList ) if ( len ( xIntersections ) > 0 ) : intoTable [ joinedKey ] = xIntersections else : print 'This should never happen, there are no line segments in joinSegments in euclidean'
join both xintersections tables and put the join into the intotable .