<commit_before>#MenuTitle: Tunnify
# -*- coding: utf-8 -*-
__doc__="""
Averages out the handles of selected path segments. Doing this is a good idea for zero handles, and as preparation for interpolation. If you just want to fix zero handles, then check out the FixZeroHandles plugin from my GitHub.
"""

from Foundation import *
import GlyphsApp
Font = Glyphs.font
selectedLayer = Font.selectedLayers[0]
selectedGlyph = selectedLayer.parent
try:
	# until v2.1:
	selection = selectedLayer.selection()
except:
	# since v2.2:
	selection = selectedLayer.selection

tunnifiedZeroLo = 0.43
tunnifiedZeroHi = 0.73

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) )<commit_msg>removed unnecessary import<commit_after>#MenuTitle: Tunnify
# -*- coding: utf-8 -*-
__doc__="""
Averages out the handles of selected path segments. Doing this is a good idea for zero handles, and as preparation for interpolation. If you just want to fix zero handles, then check out the FixZeroHandles plugin from my GitHub.
"""

from Foundation import *

Font = Glyphs.font
selectedLayer = Font.selectedLayers[0]
selectedGlyph = selectedLayer.parent
try:
	# until v2.1:
	selection = selectedLayer.selection()
except:
	# since v2.2:
	selection = selectedLayer.selection

tunnifiedZeroLo = 0.43
tunnifiedZeroHi = 0.73

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) )
{'fraction_non_alphanumeric': 0.10553018772196854, 'fraction_numerical': 0.026382546930492135, 'mean_word_length': 3.93, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7509343', 'n_tokens_mistral': 726, 'n_tokens_neox': 686, 'n_words': 228}