Polynomial Coefficients calculation

How can I calculate polynomial coefficients for Tone Curve points:

//    •    Red channel: (0, 0), (60, 39), (128, 128), (255, 255)
//    •    Green channel: (0, 0), (63, 50), (128, 128), (255, 255)
//    •    Blue channel: (0, 0), (60, 47), (119, 119), (255, 255)

CIFilter:

func colorCrossPolynomial(inputImage: CIImage) -> CIImage? {


        let colorCrossPolynomial = CIFilter.colorCrossPolynomial()
        let redfloatArr: [CGFloat] = [1, 1, 1, 1, 0, 0, 0, 0, 0, 0]
        let greenfloatArr: [CGFloat] = [0, 1, 1, 0, 0, 0, 0, 0, 0, 1]
        let bluefloatArr: [CGFloat] = [0, 0, 1, 0, 0, 0, 0, 1, 1, 0]


        colorCrossPolynomial.inputImage = inputImage
        colorCrossPolynomial.blueCoefficients = CIVector(values: bluefloatArr, count: bluefloatArr.count)
        colorCrossPolynomial.redCoefficients = CIVector(values: redfloatArr, count: redfloatArr.count)
        colorCrossPolynomial.greenCoefficients = CIVector(values: greenfloatArr, count: greenfloatArr.count)
        return colorCrossPolynomial.outputImage
    }

Did you download the sample project here: https://developer.apple.com/documentation/accelerate/applying_tone_curve_adjustments_to_images

Does it provide the answer ?

Polynomial Coefficients calculation
 
 
Q