def computeGroundFrame(aff, referenceFrame):
    refAxis = np.array([0,-1,0])
    referenceFrame.TransformVector(refAxis, refAxis)
    axes = [np.array(aff.params[axis]) for axis in ['xaxis', 'yaxis', 'zaxis']]
    axisProjections = np.array([np.abs(np.dot(axis, refAxis)) for axis in axes])
    boardAxis = axes[axisProjections.argmax()]
    if np.dot(boardAxis, refAxis) < 0:
        boardAxis = -boardAxis
    xaxis = boardAxis
    zaxis = [0,0,1]
    yaxis = np.cross(zaxis, xaxis)
    xaxis = np.cross(yaxis, zaxis)
    closestCorner = computeClosestCorner(aff, referenceFrame)
    groundFrame = getTransformFromAxes(xaxis, yaxis, zaxis)
    groundFrame.PostMultiply()
    groundFrame.Translate(closestCorner[0], closestCorner[1], 0.0)
    return groundFrame
dataset/ETHPy150Open RobotLocomotion/director/src/python/director/debristask.py/computeGroundFrame/original