def groupIntersections(intersections: list, key: int) -> dict:
	"""
	Function to group horizontal or vertical intersections

	Groups horizontal or vertical intersections
	as a list into a dict by the given key

	Parameters:
		intersections (list): List of tuples representing
							  intersection points
		key (int): Tuple index to group by
				   (0 for rows and 1 for columns)

	Returns:
		dict: Lists of intersections as values grouped by key
	"""
	groupedIntersections = {}

	for intersection in intersections:
		keyValue = intersection[key]
		if keyValue not in groupedIntersections.keys():
			groupedIntersections[keyValue] = []
		group = groupedIntersections[keyValue]
		group.append(intersection)
	
	return groupedIntersections