Discussion:
[MayaVi-users] display surface cut
Edouard Oudet
2017-02-02 15:48:07 UTC
Permalink
Considering the following mayavi instructions, I was able to display the
trace of the cut of a surface by a dynamic plane. Is it possible to
display the part of the surface which is only on one side of that plane ?
Thanks.


from numpy import pi, sin, cos, mgrid
from mayavi import mlab
dphi, dtheta = pi/250.0, pi/250.0
[phi,theta] = mgrid[0:pi+dphi*1.5:dphi,0:2*pi+dtheta*1.5:dtheta]
m0 = 4; m1 = 3; m2 = 2; m3 = 3; m4 = 6; m5 = 2; m6 = 6; m7 = 4;
r = sin(m0*phi)**m1 + cos(m2*phi)**m3 + sin(m4*theta)**m5 +
cos(m6*theta)**m7
x = r*sin(phi)*cos(theta)
y = r*cos(phi)
z = r*sin(phi)*sin(theta)
obj = mlab.mesh(x,y,z)
P = mlab.pipeline
scalar_cut_plane = P.scalar_cut_plane(obj,
plane_orientation='y_axes',view_controls=True)
scalar_cut_plane.implicit_plane.normal = 1,0,0
scalar_cut_plane.implicit_plane.widget.enabled = True

Loading...