def isSegmentCompletelyInAnIntersection(segment, xIntersections):
 for xIntersectionIndex in xrange(0, len(xIntersections), 2):
  surroundingXFirst = xIntersections[xIntersectionIndex]
  surroundingXSecond = xIntersections[(xIntersectionIndex + 1)]
  if euclidean.isSegmentCompletelyInX(segment, surroundingXFirst, surroundingXSecond):
   return True
 return False

def isSegmentCompletelyInAnIntersection ( segment , xIntersections ) : for xIntersectionIndex in xrange ( 0 , len ( xIntersections ) , 2 ) : surroundingXFirst = xIntersections [ xIntersectionIndex ] surroundingXSecond = xIntersections [ ( xIntersectionIndex + 1 ) ] if euclidean . isSegmentCompletelyInX ( segment , surroundingXFirst , surroundingXSecond ) : return True return False
add sparse endpoints from a segment .