def main(): ren = Rendering((200, 300), (1, 0, 0)) mat_sphere = SurfaceMaterial('orange_wall', (1, 0.7, 0.0), 0.8, (1, 1, 1), 0, 50, 1.0) asphere = Surface.from_sphere(( 0, 0, 0, ), 1, (1, 31), mat_sphere) mat_mobius = SurfaceMaterial('pink_metallic', (1, 0.8, 1), 0.1, (1, 1, 1), 0.9, 50, 1.0) amobius = Surface.from_mobius(mat_mobius) liver = Surface.from_STL_file('liver.stl') mat_head = VolumeMaterial('head', [(0, (0, 0, 0)), (1000, (1, 1, 1))], [(0, 0), (500, 0), (4000, 1)]) head = Volume.from_VTK_file('head.vtk', mat_head) ren.renderer.AddVolume(head) ren.renderer.AddActor(liver) ren.renderer.AddActor(asphere) ren.renderer.AddActor(amobius) ren.interactor.Initialize() ren.interactor.Start()
def sphere(self): param = SphereDialog(self) if param.exec_(): cx = float(param.x.text()) cy = float(param.y.text()) cz = float(param.z.text()) rad = float(param.radius.text()) rh = int(param.resh.text()) rv = int(param.resv.text()) surface = Surface.from_sphere( (cx, cy, cz), rad, (rh, rv), self.scene.material('surface_default')) if surface != None: self.add_surface(surface)