Open SilenKZYoung opened 4 years ago
In the paper, the chamfer distance between surface is used to evaluate the network's effectiveness, but i didn't find this part in code, could you release the evaluation code?
We random sample 5000 points from scanning the shape mesh, and sample 5000 points on the cube surface according to the cube size, then compute the L2 chamfer distance between them.
import math
import os
import random
import struct
import miniball
import numpy as np
from open3d import *
import quaternion
sample_points = np.array([[-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00],
[-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-0.87,-0.87,-0.73,-0.73,-0.60,-0.60,-0.47,-0.47,-0.33,-0.33,-0.20,-0.20,-0.07,-0.07,0.07,0.07,0.20,0.20,0.33,0.33,0.47,0.47,0.60,0.60,0.73,0.73,0.87,0.87,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-0.87,-0.87,-0.73,-0.73,-0.60,-0.60,-0.47,-0.47,-0.33,-0.33,-0.20,-0.20,-0.07,-0.07,0.07,0.07,0.20,0.20,0.33,0.33,0.47,0.47,0.60,0.60,0.73,0.73,0.87,0.87,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-0.87,-0.87,-0.73,-0.73,-0.60,-0.60,-0.47,-0.47,-0.33,-0.33,-0.20,-0.20,-0.07,-0.07,0.07,0.07,0.20,0.20,0.33,0.33,0.47,0.47,0.60,0.60,0.73,0.73,0.87,0.87,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-0.87,-0.87,-0.73,-0.73,-0.60,-0.60,-0.47,-0.47,-0.33,-0.33,-0.20,-0.20,-0.07,-0.07,0.07,0.07,0.20,0.20,0.33,0.33,0.47,0.47,0.60,0.60,0.73,0.73,0.87,0.87,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-0.87,-0.87,-0.73,-0.73,-0.60,-0.60,-0.47,-0.47,-0.33,-0.33,-0.20,-0.20,-0.07,-0.07,0.07,0.07,0.20,0.20,0.33,0.33,0.47,0.47,0.60,0.60,0.73,0.73,0.87,0.87,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-0.87,-0.87,-0.73,-0.73,-0.60,-0.60,-0.47,-0.47,-0.33,-0.33,-0.20,-0.20,-0.07,-0.07,0.07,0.07,0.20,0.20,0.33,0.33,0.47,0.47,0.60,0.60,0.73,0.73,0.87,0.87,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-0.87,-0.87,-0.73,-0.73,-0.60,-0.60,-0.47,-0.47,-0.33,-0.33,-0.20,-0.20,-0.07,-0.07,0.07,0.07,0.20,0.20,0.33,0.33,0.47,0.47,0.60,0.60,0.73,0.73,0.87,0.87,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-0.87,-0.87,-0.73,-0.73,-0.60,-0.60,-0.47,-0.47,-0.33,-0.33,-0.20,-0.20,-0.07,-0.07,0.07,0.07,0.20,0.20,0.33,0.33,0.47,0.47,0.60,0.60,0.73,0.73,0.87,0.87,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-0.87,-0.87,-0.73,-0.73,-0.60,-0.60,-0.47,-0.47,-0.33,-0.33,-0.20,-0.20,-0.07,-0.07,0.07,0.07,0.20,0.20,0.33,0.33,0.47,0.47,0.60,0.60,0.73,0.73,0.87,0.87,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-0.87,-0.87,-0.73,-0.73,-0.60,-0.60,-0.47,-0.47,-0.33,-0.33,-0.20,-0.20,-0.07,-0.07,0.07,0.07,0.20,0.20,0.33,0.33,0.47,0.47,0.60,0.60,0.73,0.73,0.87,0.87,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-0.87,-0.87,-0.73,-0.73,-0.60,-0.60,-0.47,-0.47,-0.33,-0.33,-0.20,-0.20,-0.07,-0.07,0.07,0.07,0.20,0.20,0.33,0.33,0.47,0.47,0.60,0.60,0.73,0.73,0.87,0.87,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-0.87,-0.87,-0.73,-0.73,-0.60,-0.60,-0.47,-0.47,-0.33,-0.33,-0.20,-0.20,-0.07,-0.07,0.07,0.07,0.20,0.20,0.33,0.33,0.47,0.47,0.60,0.60,0.73,0.73,0.87,0.87,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-0.87,-0.87,-0.73,-0.73,-0.60,-0.60,-0.47,-0.47,-0.33,-0.33,-0.20,-0.20,-0.07,-0.07,0.07,0.07,0.20,0.20,0.33,0.33,0.47,0.47,0.60,0.60,0.73,0.73,0.87,0.87,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-0.87,-0.87,-0.73,-0.73,-0.60,-0.60,-0.47,-0.47,-0.33,-0.33,-0.20,-0.20,-0.07,-0.07,0.07,0.07,0.20,0.20,0.33,0.33,0.47,0.47,0.60,0.60,0.73,0.73,0.87,0.87,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.87,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.73,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.60,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.47,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.33,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.20,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.33,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.47,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.60,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.73,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,0.87,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00],
[-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00,-1.00,-0.87,-0.73,-0.60,-0.47,-0.33,-0.20,-0.07,0.07,0.20,0.33,0.47,0.60,0.73,0.87,1.00]
], dtype=np.float32) # [3, n]
n_sample_points = sample_points.shape[1]
sample_points = np.transpose(sample_points) # [n, 3]
surface_index = np.array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
], dtype=np.int32)
def generate_surface_points(resolution=16):
'''
generate points on cube surface, and rescale to [-1, 1]
n_points = resolution**3 - (resolution-2)**3
'''
r = resolution
n_points = r**3 - (r-2)**3
sample_points = np.ndarray([n_points, 3], dtype=np.float32)
surface_index = np.ndarray([n_points], dtype=np.int32)
index = 0
for i in range(r):
for j in range(r):
for k in range(r):
if (i == 0 or i == r-1) or (j == 0 or j == r-1) or (k == 0 or k == r-1):
sample_points[index] = np.array([i, j, k], dtype=np.float32)
if i == 0 or i == r-1:
surface_index[index] = 0
elif j == 0 or j == r-1:
surface_index[index] = 1
else:
surface_index[index] = 2
index += 1
print(index, n_points)
assert(index == n_points)
sample_points -= (r-1) / 2
sample_points /= (r-1) / 2 # rescale to [-1, 1]
return sample_points, surface_index
def load_points_file(filename, offset=None, normalize=False):
'''
load point cloud from .points file
'''
assert(filename.endswith('.points'))
with open(filename, "rb") as f:
n = struct.unpack("i", f.read(4))[0]
points_raw = f.read(4*n*3)
points = np.asarray(struct.unpack("f"*n*3, points_raw)).reshape(n, 3)
if offset is not None:
points -= offset
if normalize:
mb = miniball.Miniball(points)
# print('Center', mb.center())
# print('Radius', math.sqrt(mb.squared_radius()))
points -= mb.center()
points /= math.sqrt(mb.squared_radius())*2
return points
def get_points_weights(cube_param, cube_count):
'''
get points weights w.r.t. surface area
'''
weights = np.ndarray([cube_count, n_sample_points], dtype=np.float32)
for i in range(cube_count):
x, y, z = cube_param['z'][i]
weights[i][surface_index == 0] = y * z
weights[i][surface_index == 1] = x * z
weights[i][surface_index == 2] = x * y
return np.reshape(weights, [-1])
def load_obj_file(filename, offset=None):
'''
load cube parameters from .obj file, sample points on cube surface
'''
cube_count = 0
cube_param = {'z':[], 'q':[], 't':[]}
with open(filename) as f:
for line in f:
if line[0] == '#':
param = [float(line.split()[1:][p]) for p in range(10)]
cube_param['z'].append(param[0:3])
cube_param['q'].append(param[3:7])
cube_param['t'].append(param[7:])
cube_count += 1
cube_param['z'] = np.array(cube_param['z'])
cube_param['q'] = np.array(cube_param['q'])
cube_param['t'] = np.array(cube_param['t'])
points = np.ndarray([cube_count*n_sample_points, 3], dtype=np.float32)
weights = get_points_weights(cube_param, cube_count)
for i in range(cube_count):
z, q, t = [cube_param[v][i] for v in ['z', 'q', 't']]
p = sample_points * z
rot = np.quaternion(q[0], q[1], q[2], q[3])
rot = quaternion.as_rotation_matrix(rot)
p = np.transpose(np.matmul(rot, np.transpose(p)))
p += t
points[i*n_sample_points:(i+1)*n_sample_points] = p
if offset is not None:
points -= offset
return points, weights
def pick_points(points, n_max=5000):
'''
random pick n_max points from input point cloud
'''
random.seed( 10 )
n = points.shape[0]
assert(points.shape[0] >= n_max)
points = points[np.random.randint(0, n, n_max), :]
return points
def pick_points_with_weights(points, weights, n_max=5000):
'''
random pick n_max points from input point cloud according to their weights
'''
# assert(points.shape[0] >= n_max)
if points.shape[0] < n_max:
print("Warning: points number is less than n_max, maybe the input shape is unfrequent.")
index = np.arange(points.shape[0])
index = random.choices(index, weights=weights, k=n_max)
points = points[index, :]
return points
def inter_points_distance(src_points, des_points, draw_points=False):
'''
compute the chamfer distance from src_points to des_points
'''
des_pcd = PointCloud()
des_pcd.points = Vector3dVector(des_points)
des_pcd.paint_uniform_color([0.3, 0.3, 0.7])
des_points_tree = KDTreeFlann(des_pcd)
src_pcd = PointCloud()
src_pcd.points = Vector3dVector(src_points)
src_pcd.paint_uniform_color([0.7, 0.7, 0.7])
distance = 0
for i in range(src_points.shape[0]):
point = src_pcd.points[i]
[k, idx, _] = des_points_tree.search_knn_vector_3d(point, 1)
d = np.linalg.norm(point - des_pcd.points[idx[0]])
distance += d
if draw_points: draw_geometries([des_pcd, src_pcd])
return distance / src_points.shape[0]
def compute_chamfer_distance_kernel(points_1, points_2, draw_points=False):
'''
chamfer distance is the mean distance of A2B and B2A
'''
# print(np.min(points_1, axis=0), np.max(points_1, axis=0))
# print(np.min(points_2, axis=0), np.max(points_2, axis=0))
distance_1 = inter_points_distance(points_1, points_2, draw_points=draw_points)
distance_2 = inter_points_distance(points_2, points_1)
# print(distance_1, distance_2)
return (distance_1 + distance_2)/2
def compute_chamfer_distance(points_file_1, points_file_2,
points_file_1_offset=None, points_file_2_offset=None, verbose=False):
'''
compute chamfer distance of the two input points file
'''
assert(os.path.isfile(points_file_1) and points_file_1.endswith('.points'))
assert(os.path.isfile(points_file_2) and points_file_2.endswith('.points'))
points_1 = load_points_file(points_file_1, offset=points_file_1_offset if points_file_1_offset is not None else None)
points_2 = load_points_file(points_file_2, offset=points_file_2_offset if points_file_2_offset is not None else None)
points_1 = pick_points(points_1)
points_2 = pick_points(points_2)
if verbose:
print(points_1.shape)
print(points_2.shape)
cd = compute_chamfer_distance_kernel(points_1, points_2)
return cd
def compute_chamfer_distance_pointsfile_objfile(points_file, obj_file,
points_file_offset=None, obj_file_offset=None, verbose=False, draw_points=False):
'''
compute chamfer distance between two file:
.points: contain point cloud coordinates
.obj: contain cube params [z, q, t]
'''
assert(os.path.isfile(points_file) and points_file.endswith('.points'))
assert(os.path.isfile(obj_file) and obj_file.endswith('.obj'))
points_1 = load_points_file(points_file,
offset=points_file_offset if points_file_offset is not None else None,
normalize=False)
points_2, weights = load_obj_file(obj_file,
offset=obj_file_offset if obj_file_offset is not None else None)
points_1 = pick_points(points_1)
# points_2 = pick_points(points_2)
if points_2.size == 0:
return 0.05
points_2 = pick_points_with_weights(points_2, weights)
if verbose:
print(points_1.shape)
print(points_2.shape)
cd = compute_chamfer_distance_kernel(points_1, points_2, draw_points=draw_points)
return cd
def run_batch(cube_folder, phase):
shape_count = {'train': 2832, 'test': 808}
n_shape = shape_count[phase]
level_error = []
for cube_level in ['cube_1', 'cube_2', 'cube_3', 'predict_correction_assembly_cube']:
mean_diatance = 0
for i in range(n_shape):
cube_filename = os.path.join(cube_folder, phase, '{}_{:04d}.obj'.format(cube_level, i))
if i < 2: print('cube_file:', cube_filename)
assert(os.path.isfile(cube_filename))
points_folder = 'points/{}'.format(phase)
points_filename = os.path.join(points_folder, '{:06d}.points'.format(i))
if i < 2: print('points_file:', points_filename)
assert(os.path.isfile(points_filename))
distance = compute_chamfer_distance_pointsfile_objfile(points_filename,
cube_filename, points_file_offset=None, obj_file_offset=None, verbose=False, draw_points=False)
print('{} {:.04f}'.format(i, distance))
mean_diatance += distance
sys.stdout.flush()
mean_diatance /= n_shape
level_error.append(mean_diatance*1000)
print('\n{}, mean_diatance*1000: {:.04f}'.format(cube_level, mean_diatance*1000), end='\n\n\n\n')
print(level_error)
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--cube_folder',
type=str,
help='cube_folder',
required=True)
parser.add_argument('--phase',
type=str,
help='train or test',
required=True)
args = parser.parse_args()
run_batch(args.cube_folder, args.phase)
pass
if __name__ == '__main__':
main()
thank you!
In the paper, the chamfer distance between surface is used to evaluate the network's effectiveness, but i didn't find this part in code, could you release the evaluation code?