Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:48:53

0001 #!/usr/bin/env python
0002 
0003 import numpy as np
0004 import pyvista as pv
0005 
0006 
0007 
0008 def make_stage(sz):
0009      stage = np.zeros( (6,3), dtype=np.float32 )
0010      stage[0] = (-sz,   0,   0)
0011      stage[1] = ( sz,   0,   0)
0012      stage[2] = (  0, -sz,   0)
0013      stage[3] = (  0,  sz,   0)
0014      stage[4] = (  0,   0, -sz)
0015      stage[5] = (  0,   0,  sz)
0016      return stage 
0017 
0018 
0019 if __name__ == '__main__':
0020 
0021      path = "/tmp/CSGQueryTest.npy"
0022      isect = np.load(path)
0023 
0024 
0025      norm, t       = isect[:,0,:3], isect[:,0,3]
0026      pos, sd       = isect[:,1,:3], isect[:,1,3]
0027      ray_origin    = isect[:,2,:3] 
0028      ray_direction = isect[:,3,:3] 
0029 
0030 
0031      ll = np.zeros( (len(t), 2, 3), dtype=np.float32 )
0032      ll[:,0] = ray_origin
0033      ll[:,1] = pos
0034 
0035 
0036      SIZE = np.array([1280, 720])
0037      pl = pv.Plotter(window_size=SIZE*2 )
0038      
0039      stg = make_stage(10)
0040      pl.add_points( stg, color="yellow" )
0041 
0042      pl.add_points( pos, color="white" ) 
0043      pl.add_arrows( pos, norm , color="red", mag=1 )
0044      pl.add_points( ray_origin, color="magenta", point_size=16.0 )
0045 
0046      for i in range(len(ll)):
0047          pl.add_lines( ll[i].reshape(-1,3), color="blue" )
0048      pass  
0049 
0050      look = np.array( [0,0,0], dtype=np.float32 )
0051      up = np.array( [0,0,1], dtype=np.float32 )
0052      eye = np.array( [0,-20,0], dtype=np.float32 )
0053      zoom = 1 
0054 
0055      pl.set_focus(    look )
0056      pl.set_viewup(   up )
0057      pl.set_position( eye, reset=False )  
0058      pl.camera.Zoom(zoom)
0059 
0060      pl.show_grid()
0061 
0062      cp = pl.show()
0063 
0064 
0065 
0066 
0067