IcyFeather
add examples
da1bf32
import trimesh
import numpy as np
def ply_to_obj(ply_path, obj_path):
mesh = trimesh.load(ply_path)
# 定义旋转矩阵
rotation_matrix = np.array([
[-1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, -1, 0],
[0, 0, 0, -1]
])
# 应用旋转矩阵
mesh.apply_transform(rotation_matrix)
mesh.export(obj_path)
ply_path = "examples/1110.ply"
obj_path = "examples/1110.obj"
ply_to_obj(ply_path, obj_path)
# import trimesh
# import numpy as np
# def rotate_obj_180_xy(obj_path, output_path):
# # 加载OBJ文件
# mesh = trimesh.load(obj_path)
# # 定义旋转矩阵
# rotation_matrix = np.array([
# [-1, 0, 0, 0],
# [0, 1, 0, 0],
# [0, 0, -1, 0],
# [0, 0, 0, -1]
# ])
# # 应用旋转矩阵
# mesh.apply_transform(rotation_matrix)
# # 导出旋转后的OBJ文件
# mesh.export(output_path)
# obj_path = "examples/1110.obj"
# output_path = "examples/processed_1110.obj"
# rotate_obj_180_xy(obj_path, output_path)