def computeData(scene):
    isophote_mesh = scene.isophoteMesh()
    isophote_curves = isophote_mesh.isophoteCurves()

    data_list = []

    for isophote_curve in isophote_curves:
        isophote_segments = isophote_curve.toCurveSegments()

        for isophote_segment in isophote_segments:
            isophote_segment = isophote_segment.divide(
                int(0.2 * isophote_segment.numPoints()), int(0.5 * isophote_segment.numPoints())
            )

            if isophote_segment.numPoints() < 3:
                continue

            I = isophote_segment.isoValue()
            I = 2.0 * I - 1.0

            curvatures = isophote_segment.curvatures()
            curvatures = smoothing(curvatures, smooth=15.0)
            curvatures = curvatures / np.max(np.abs(curvatures))

            normals_gt = isophote_segment.normals()
            parameters = isophote_segment.arcLengthParameters()

            normals_al = NormalConeInterpolation(
                normals_gt[0], normals_gt[-1], isophote_segment.lightDir(), I
            ).interpolate(parameters)

            normals_al_error = angleErros(normals_gt, normals_al)

            cone_angle_changes = isophote_segment.coneAngleChanges()
            cone_angle_changes = smoothing(cone_angle_changes, smooth=0.05)
            cone_angle_changes = cone_angle_changes / np.max(np.abs(cone_angle_changes))

            misclassification = curvatures * cone_angle_changes

            ps = isophote_segment.points()

            misclassification_segments = clipSegments(ps, misclassification < 0)
            num_misclassification = len(np.where(misclassification < 0)[0])

            misclassification_rate = float(num_misclassification) / float(len(misclassification))

            data_list.append(
                {
                    "ps": ps,
                    "curvatures": curvatures,
                    "cone_angle_changes": cone_angle_changes,
                    "misclassification_segments": misclassification_segments,
                    "misclassification_rate": misclassification_rate,
                    "normals_gt": normals_gt,
                    "normals_al": normals_al,
                    "normals_al_error": normals_al_error,
                }
            )
    return data_list
def smoothingTangentZ(tangents_3D, parameters):
    tangents_3D[:, 2] = smoothing(tangents_3D[:, 2], parameters, smooth=1.0)
    return tangents_3D
def smoothing3DVectors(vectors_3D, parameters):
    vectors_3D = smoothing(vectors_3D, parameters, smooth=0.01)
    vectors_3D = normalizeVectors(vectors_3D)
    return vectors_3D