/**
 * This function takes a list of points and a line as input and returns a list of tuples containing the coordinates
 * where the line intersects with the points.
 *
 * @param pointList a list of tuples representing the coordinates of the points
 * @param line a tuple representing the equation of the line in the form (slope, intercept)
 * @return a list of tuples containing the coordinates of the points where the line intersects
 */
fun findIntersections(pointList: List<Pair<Double, Double>>, line: Pair<Double, Double>): List<Pair<Double, Double>> {

    val intersections = mutableListOf<Pair<Double, Double>>()

    for (point in pointList) {
        val (x, y) = point

        // Check if the point lies on the line
        if (y == line.first * x + line.second) {
            intersections.add(Pair(x, y))
        }
    }

    return intersections
}
/**
 * This function takes a list of points and a line as input and returns a list of tuples containing the coordinates
 * where the line intersects with the points.
 *
 * @param pointList a list of tuples representing the coordinates of the points
 * @param line a tuple representing the equation of the line in the form (slope, intercept)
 * @return a list of tuples containing the coordinates of the points where the line intersects
 */
fun findIntersections(pointList: List<Pair<Double, Double>>, line: Pair<Double, Double>): List<Pair<Double, Double>> {
/**
 * This function takes a list of points and a line as input and returns a list of tuples containing the coordinates
 * where the line intersects with the points.
 *
 * @param pointList a list of tuples representing the coordinates of the points
 * @param line a tuple representing the equation of the line in the form (slope, intercept)
 * @return a list of tuples containing the coordinates of the points where the line intersects
 */
fun findIntersections(pointList: List<Pair<Double, Double>>, line: Pair<Double, Double>): List<Pair<Double, Double>> {

    val intersections = mutableListOf<Pair<Double, Double>>()

    for (point in pointList) {
        val (x, y) = point

        // Check if the point lies on the line
        if (y == line.first * x + line.second) {
            intersections.add(Pair(x, y))
        }
    }

    return intersections
}