Skip to content
DeepForgeby svx
All problems
HardComputer Visioncv-259

Plane Fit Residual

Problem

Fit the plane z = a*x + b*y + c by least squares and report the RMS residual.

Solve the 3x3 normal equations, compute the RMS of z - (a*x + b*y + c) over the points and round to 4 decimal places.

Test cases

case 1
in: [[[0,0,1],[1,0,3],[0,1,4],[1,1,6]]]
expected: 0
case 2
in: [[[0,0,0],[1,0,2.1],[0,1,3.2],[1,1,5]]]
expected: 0.075
case 3
in: [[[0,0,2],[1,0,2],[2,0,2],[0,1,2],[1,1,2],[2,1,2]]]
expected: 0
Starter codePython
def plane_fit_residual(points):
    # Your code here
    pass

3 test cases · run your code against them in the editor