Created
          April 8, 2022 12:36 
        
      - 
      
- 
        Save mstankie/4fcd8e3ac2e4a16b28e97f3a969c10e6 to your computer and use it in GitHub Desktop. 
    Generate (x,y,z) coordinates of N points arranged on 3D grid as Nx3 NumPy array
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import numpy as np | |
| x_coords = np.arange(3) | |
| y_coords = np.linspace(-1, 1, 11) | |
| z_coords = [0.0, 0.5, 1.0] | |
| point_grid = np.hstack([c.reshape(-1, 1) for c in np.meshgrid(x_coords, y_coords, z_coords)]) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
This may be extended by adding coordinates for other dimensions to
meshgridfunction.