Thingiverse
cosinus
di Jujumo
0
Download
1
Likes
0
Makes
Iso surface of
```
cos(x) + cos(y) + cos(z)
```
python code to generqte :
```
import numpy as np
from skimage import measure
from stl import mesh
bound = np.pi * 4
samples = 50
padding = 2
r = np.linspace(start=-bound, stop=bound, num=samples)
xx, yy, zz = np.meshgrid(r, r, r)
voxel_grid = np.cos(xx) + np.cos(yy) + np.cos(zz)
voxel_grid = np.pad(voxel_grid, padding, 'constant', constant_values=0)
# Use marching cubes to obtain the surface mesh
vertices, faces, normals, values = measure.marching_cubes(voxel_grid, level=0.0)
maillage = mesh.Mesh(np.zeros(faces.shape[0], dtype=mesh.Mesh.dtype))
for i, f in enumerate(faces):
for j in range(3):
maillage.vectors[i][j] = vertices[f[j], :]
maillage.save('cos 4x4x4.stl')
```
```
cos(x) + cos(y) + cos(z)
```
python code to generqte :
```
import numpy as np
from skimage import measure
from stl import mesh
bound = np.pi * 4
samples = 50
padding = 2
r = np.linspace(start=-bound, stop=bound, num=samples)
xx, yy, zz = np.meshgrid(r, r, r)
voxel_grid = np.cos(xx) + np.cos(yy) + np.cos(zz)
voxel_grid = np.pad(voxel_grid, padding, 'constant', constant_values=0)
# Use marching cubes to obtain the surface mesh
vertices, faces, normals, values = measure.marching_cubes(voxel_grid, level=0.0)
maillage = mesh.Mesh(np.zeros(faces.shape[0], dtype=mesh.Mesh.dtype))
for i, f in enumerate(faces):
for j in range(3):
maillage.vectors[i][j] = vertices[f[j], :]
maillage.save('cos 4x4x4.stl')
```
Hai stampato questo modello? Accedi e condividi il tuo make!
Accedi per lasciare un commento
AccediAncora nessun commento – sii il primo!