<jupyter_start><jupyter_text>读取mesh<jupyter_code>import numpy as np
# 根据obj文件获得mesh的顶点数据
# 数据点的数据结构选择list而不是数组,方便后续拓展
def read_mesh_points(obj_file_path):
    points = []
    # try:
    with open(obj_file_path) as file:
        lines = file.readlines()
        i = 0
        for i in range(0, len(lines)):
            if not lines[i]:
                break
            strs = lines[i].split(" ")
            if i <= 5 and strs[0] != "v":  # 避免开头可能出现的信息
                continue
            if strs[0] == 'v':
                cur = [float(strs[1]), float(strs[2]), float(strs[3])]
                points.append(cur)
            else:
                break
    # except Exception as e:
    #     print("错误:", e)
    #     sys.exit(1)
    points = np.array(points)
    return points, i  # 这里返回的i方便后续直接定位面所在的数据，避免重复遍历

read_mesh_points('/home/zf/vscode/3d/DR_3DFM/data/cylinder_template_mesh/0001_2_01.obj')
obj_file_path = '/home/zf/vscode/3d/DR_3DFM/data/cylinder_template_mesh/0001_2_01.obj'
with open(obj_file_path) as file:
    lines = file.readlines()
lines[1]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12637362637362637, 'fraction_numerical': 0.02564102564102564, 'mean_word_length': 2.352760736196319, 'pattern_counts': {'":': 1, '<': 6, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '346596', 'license': 'MIT', 'n_tokens_mistral': 462, 'n_tokens_neox': 464, 'n_words': 70, 'path': 'notebook/data.ipynb', 'repo_name': 'zxpzhong/DR_3DFM', 'size': '1092'}