1. 程式人生 > 其它 >讀取obj檔案中的點法向生成numpy陣列

讀取obj檔案中的點法向生成numpy陣列

技術標籤:瑣碎知識點

objFilePath = '/home/workstation/deep/1/xxx.obj'
with open(objFilePath) as file:
     points = []
     while 1:
         line = file.readline()
         if not line:
             break
         strs = line.split(" ")
         if strs[0] == "vn":#修改這裡可改為點,點法向
             points.
append((float(strs[1]), float(strs[2]), float(strs[3]))) points_n = np.array(points)