반응형 넘파이2 [numpy-stl] stl 생성 원리 numpy-stl 에서 정사면체를 생성하는 예제는 아래와 같습니다. import numpy as np from stl import mesh # mesh points vertices = np.array([[0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1]]) # mesh faces faces = np.array([[0,1,2], # square [0,1,3], # triangle [0,2,3], [1,2,3]]) # triangle # Create the mesh cube = mesh.Mesh(np.zeros(faces.shape[0], dtype=mesh.Mesh.dtype)) for i, f in enumerate(faces): for j in range(3): cube.vec.. 2023. 5. 26. 파이썬 numpy stl 모듈에서 stl 병진,회전,변환(translate, rotate, transform) 넘파이와, stl 모듈을 불러옵니다. import numpy as np from stl import mesh mesh를 하나 불러와서 STL이라는 변수에 입력했다고 가정합시다 . STL=mesh.Mesh.from_file('ex.stl') 병진,회전,변환 메소드는 아래와 같이 사용합니다. STL.translate(np.array([x,y,z])) STL.rotate(axis, theta=0, point=None) STL.transform(matrix) ; 4x4 행렬 2021. 11. 8. 이전 1 다음 반응형