Jan-09-2019, 02:04 PM
I want to define two surfaces (S_1, S_2) out of 6 previous ones (S1, S2 ,S3, S4, S5, S6) "merging" them such as:
S_1=S1+S3+S5
S_2=S2+S4+S6
All surfaces (isosurface) are define with countour3d (mayavi) : S1=mlab.contour3d(x,y,z,gyroid_1(x,y,z,e), contours = [0])
I want to define those two surfaces in order to use vtk later on to "close" the gap (clip function?) between them to make a solid
Thanks!
S_1=S1+S3+S5
S_2=S2+S4+S6
All surfaces (isosurface) are define with countour3d (mayavi) : S1=mlab.contour3d(x,y,z,gyroid_1(x,y,z,e), contours = [0])
# -*- coding: utf-8 -*- """ Created on Wed Jan 9 10:34:32 2019 @author: marie_pirotaise. """ import numpy as np import vtk # VTK version 7.0 import mayavi from mayavi import mlab # mayavi version 4.4.4 cos = np.cos sin = np.sin pi = np.pi "============================= FONCTIONS =====================================" # MILIEU def gyroid_1(x,y,z,e): return cos(x)*sin(y)+cos(y)*sin(z)+cos(z)*sin(x)+e/2 def gyroid_2(x,y,z,e): return cos(x)*sin(y)+cos(y)*sin(z)+cos(z)*sin(x)-(e/2) # SUP def gyroid_3(x,y,z,e,g): return cos(x)*sin(y)+cos(y)*sin(z)+cos(z)*sin(x)+e/2+g*(z-Nsup_int) def gyroid_4(x,y,z,e,g): return cos(x)*sin(y)+cos(y)*sin(z)+cos(z)*sin(x)-(e/2)-g*(z-Nsup_int) # INF def gyroid_5(x,y,z,e,g): return cos(x)*sin(y)+cos(y)*sin(z)+cos(z)*sin(x)+e/2+g*abs(z-Ninf_int) def gyroid_6(x,y,z,e,g): return cos(x)*sin(y)+cos(y)*sin(z)+cos(z)*sin(x)-(e/2)-g*abs(z-Ninf_int) "============================ PARAMETRES =====================================" # PARAMETRES A DEFINIR [nx, ny, nz] = [2, 2, 6] # Nombre de cellules h=2 # Nombre de cellules à épaisseur constantes M=100j # Maillage e=0.3 # Epaisseur g=0.1 # Gradient # PARAMETRES PRE-DEFINIS [Nx, Ny, Nz]=[nx*2*pi, ny*2*pi, nz*2*pi] H=h*2*pi #hauteur partie à épaisseur constante Nsup_int=H/2 Nsup_ext=Nz/2 Ninf_int=-Nsup_int Ninf_ext=-Nsup_ext "=============================== MAIN =======================================" # MILIEU x, y, z = np.mgrid[0:Nx:M,0:Ny:M,Ninf_int:Nsup_int:M] S1=mlab.contour3d(x,y,z,gyroid_1(x,y,z,e), contours = [0]) S2=mlab.contour3d(x,y,z,gyroid_2(x,y,z,e), contours = [0]) # PARTIE SUPERIEURE x, y, z = np.mgrid[0:Nx:M,0:Ny:M,Nsup_int:Nsup_ext:M] S3=mlab.contour3d(x,y,z,gyroid_3(x,y,z,e,g), contours = [0]) S4=mlab.contour3d(x,y,z,gyroid_4(x,y,z,e,g), contours = [0]) # PARTIE INFERIEURE x, y, z = np.mgrid[0:Nx:M,0:Ny:M,Ninf_ext:Ninf_int:M] S5=mlab.contour3d(x,y,z,gyroid_5(x,y,z,e,g), contours = [0]) S6=mlab.contour3d(x,y,z,gyroid_6(x,y,z,e,g), contours = [0]) mlab.show()
I want to define those two surfaces in order to use vtk later on to "close" the gap (clip function?) between them to make a solid
Thanks!