original_docstring: 
  	Returns an NSPoint of the intersection AB with CD.
  	Or False if there is no intersection
  	
docstring: Returns an NSPoint of the intersection AB with CD.
  Or False if there is no intersection
docstring_tokens: Returns an NSPoint of the intersection AB with CD . Or False if there is no intersection
code: def intersectionWithNSPoints( pointA, pointB, pointC, pointD ):
  	"""
  	Returns an NSPoint of the intersection AB with CD.
  	Or False if there is no intersection
  	"""
  	try:
  		x1, y1 = pointA.x, pointA.y
  		x2, y2 = pointB.x, pointB.y
  		x3, y3 = pointC.x, pointC.y
  		x4, y4 = pointD.x, pointD.y
  	
  		try:
  			slope12 = ( float(y2) - float(y1) ) / ( float(x2) - float(x1) )
  		except:
  			# division by zero if vertical
  			slope12 = None
  		
  		try:
  			slope34 = ( float(y4) - float(y3) ) / ( float(x4) - float(x3) )
  		except:
  			# division by zero if vertical
  			slope34 = None
  	
  		if slope12 == slope34:
  			# parallel, no intersection
  			return None
  		elif slope12 is None:
  			# first line is vertical
  			x = x1
  			y = slope34 * ( x - x3 ) + y3
  		elif slope34 is None:
  			# second line is vertical
  			x = x3
  			y = slope12 * ( x - x1 ) + y1
  		else:
  			# both lines have an angle
  			x = ( slope12 * x1 - y1 - slope34 * x3 + y3 ) / ( slope12 - slope34 )
  			y = slope12 * ( x - x1 ) + y1
  		
  		intersectionPoint = NSPoint( x, y )
  		if bothPointsAreOnSameSideOfOrigin( intersectionPoint, pointB, pointA ) and bothPointsAreOnSameSideOfOrigin( intersectionPoint, pointC, pointD ):
  			if pointIsBetweenOtherPoints( intersectionPoint, pointB, pointA ) or pointIsBetweenOtherPoints( intersectionPoint, pointC, pointD ):
  				return None
  			return intersectionPoint
  		else:
  			return None
  	
  	except Exception as e:
  		print(e)
  		import traceback
  		print(traceback.format_exc())
  		return None
code_tokens: def intersectionWithNSPoints ( pointA , pointB , pointC , pointD ) : try : x1 , y1 = pointA . x , pointA . y x2 , y2 = pointB . x , pointB . y x3 , y3 = pointC . x , pointC . y x4 , y4 = pointD . x , pointD . y try : slope12 = ( float ( y2 ) - float ( y1 ) ) / ( float ( x2 ) - float ( x1 ) ) except : slope12 = None try : slope34 = ( float ( y4 ) - float ( y3 ) ) / ( float ( x4 ) - float ( x3 ) ) except : slope34 = None if slope12 == slope34 : return None elif slope12 is None : x = x1 y = slope34 * ( x - x3 ) + y3 elif slope34 is None : x = x3 y = slope12 * ( x - x1 ) + y1 else : x = ( slope12 * x1 - y1 - slope34 * x3 + y3 ) / ( slope12 - slope34 ) y = slope12 * ( x - x1 ) + y1 intersectionPoint = NSPoint ( x , y ) if bothPointsAreOnSameSideOfOrigin ( intersectionPoint , pointB , pointA ) and bothPointsAreOnSameSideOfOrigin ( intersectionPoint , pointC , pointD ) : if pointIsBetweenOtherPoints ( intersectionPoint , pointB , pointA ) or pointIsBetweenOtherPoints ( intersectionPoint , pointC , pointD ) : return None return intersectionPoint else : return None except Exception as e : print ( e ) import traceback print ( traceback . format_exc ( ) ) return None
short_docstring: Returns an NSPoint of the intersection AB with CD.
short_docstring_tokens: Returns an NSPoint of the intersection AB with CD .
comment: """
  	Returns an NSPoint of the intersection AB with CD.
  	Or False if there is no intersection
  	"""$SEP$# division by zero if vertical$SEP$# division by zero if vertical$SEP$# parallel, no intersection$SEP$# first line is vertical$SEP$# second line is vertical$SEP$# both lines have an angle