com1DFA.DFAtools.getNormalMesh

getNormalMesh(dem, num)[source]

Compute normal to surface at grid points

Get the normal vectors to the surface defined by a DEM. Either by adding the normal vectors of the adjacent triangles for each points (using 4, 6 or 8 adjacent triangles). Or use the next point in x direction and the next in y direction to define two vectors and then compute the cross product to get the normal vector

Parameters
  • dem (dict) –

    header :

    dem header (cellsize, ncols, nrows)

    rasterData2D numpy array

    elevation at grid points

  • num (int) – chose between 4, 6 or 8 (using then 4, 6 or 8 triangles) or 1 to use the simple cross product method (with the diagonals)

Returns

dem

dem dict updated with:
Nx: 2D numpy array

x component of the normal vector field on grid points

Ny: 2D numpy array

y component of the normal vector field on grid points

Nz: 2D numpy array

z component of the normal vector field on grid points

outOfDEM: 2D boolean numpy array

True if the cell is out the dem, False otherwise

Return type

dict