add open border bounding box

This commit is contained in:
Michael Krayer 2022-02-22 13:54:38 +01:00
parent b7b250ca5f
commit 649f8b4161
1 changed files with 21 additions and 0 deletions

21
visu.py
View File

@ -4,6 +4,27 @@ def add_domain_bounds(plotter,bounds,color='black',line_width=2.):
plotter.add_mesh(domain,color=color,style='wireframe',line_width=line_width,opacity=0.999,lighting=False)
return
def add_domain_bounds_open(plotter,bounds,opacity_front=None,xlen=1.0,ylen=1.0,zlen=1.0,
color='black',line_width=2.):
import pyvista
x0,x1,y0,y1,z0,z1 = bounds
domain = pyvista.Line((x0,y0,z0),(x1,y0,z0)) + \
pyvista.Line((x0,y0,z0),(x0,y1,z0)) + \
pyvista.Line((x0,y0,z0),(x0,y0,z1)) + \
pyvista.Line((x1,y0,z0),(x1,y1,z0)) + \
pyvista.Line((x1,y0,z0),(x1,y0,z1)) + \
pyvista.Line((x0,y0,z1),(x1,y0,z1)) + \
pyvista.Line((x1,y0,z1),(x1,y1,z1)) + \
pyvista.Line((x0,y1,z0),(x1,y1,z0)) + \
pyvista.Line((x1,y1,z0),(x1,y1,z1))
plotter.add_mesh(domain,color=color,line_width=line_width,opacity=0.999,lighting=False)
if not opacity_front is None:
domain_front = pyvista.Line((x0+(1.-xlen)*(x1-x0),y1,z1),(x1,y1,z1)) + \
pyvista.Line((x0,y0,z1),(x0,ylen*y1,z1)) + \
pyvista.Line((x0,y1,z0),(x0,y1,zlen*z1))
plotter.add_mesh(domain_front,color=color,line_width=line_width,opacity=opacity_front,lighting=False)
return
def enable_shadows_hacked(pl):
# Reimplements pyvistas "enable_shadows()" method to also render translucent
# objects (without shadows). Can be used to add objects which do not throw