2

I'm using Mayavi to plot an iso-surface of a gyroid. My problem is that I need a more solid structure by filling one side of the two generated areas. In the following pictures, you can see how my generated iso-surface looks like and how it should look like after filling one side.

My generated iso-surface:

my generated iso-surface

How it should look like:

How it should look like

The iso-surface can be generated by the following equation:

U = sin(2*pi * x/a) * cos(2*pi * y/a) + sin(2*pi * y/a) * cos(2*pi * z/a) \
    + sin(2*pi * z/a) * cos(2*pi * x/a)

I plotted the iso-surface = 0 by using this: mlab.contour3d(U, contours=[0])

I hope somebody can help me out.

funie200
  • 3,688
  • 5
  • 21
  • 34
Kev2002
  • 17
  • 2
  • I could do it using vedo (https://github.com/marcomusy/vedo), not sure if there an analogous way in mayavi. if interested I can post the solution. – mmusy Oct 22 '20 at 15:18
  • Thank you for your quick response.I'm thankful for any idea of solution. Is there just a plot command using vedo or do you have to solve it in a mathematical way, a boolean operation for example? – Kev2002 Oct 22 '20 at 17:40

1 Answers1

1

Using vedo:

from vedo import *
import numpy as np

a = 15
pi = np.pi
x, y, z = np.mgrid[:30, :30, :30]/a
U =   sin(2*pi* x) * cos(2*pi* y) + sin(2*pi* y) * cos(2*pi* z) \
    + sin(2*pi* z) * cos(2*pi* x)
iso = Volume(U).isosurface(0)
plane = Grid(sx=29,sy=29, pos=(14.5,14.5,0), resx=200, resy=200)
cpln = plane.cutWithMesh(iso).wireframe(0).c('tomato').lw(0)
show(iso, cpln, axes=1)

enter image description here

(note that the red-tomato "cap" is effectively a different mesh)

PS: you can also use CubicGrid(n=(29,29,29), spacing=(1,1,1), alpha=1) (instead of 6 planes). E.g.:

iso = Volume(U).isosurface(0).smoothLaplacian().c('silver').lw(1)
cube = CubicGrid(n=(29,29,29), spacing=(1,1,1))
cube.cutWithMesh(iso).c('silver').alpha(1)
show(iso, cube)

enter image description here

mmusy
  • 1,292
  • 9
  • 10