hexrd.gridutil module
- hexrd.gridutil.cellConnectivity(m, n, p=1, origin='ul')[source]
p x m x n (layers x rows x cols)
origin can be upper left – ‘ul’ <default> or lower left – ‘ll’
choice will affect handedness (cw or ccw)
- hexrd.gridutil.cellIndices(edges, points_1d)[source]
get indices in a 1-d regular grid.
edges are just that:
above the deltas are + and the index for the point is 1
here the deltas are - and the index for the point is 2
can handle grids with +/- deltas
be careful when using with a cyclical angular array! edges and points must be mapped to the same branch cut, and abs(edges[0] - edges[-1]) = 2*pi
- hexrd.gridutil.computeIntersection(line1, line2)[source]
compute intersection of two-dimensional line intersection Returns the intersection point as an array of length 2. If the lines are parallel (or equal) the function returns an empty array.
this is an implementation of two lines:
line1 = [ [x1, y1], [x2, y2] ] line2 = [ [x3, y3], [x4, y4] ]
- hexrd.gridutil.make_tolerance_grid(bin_width, window_width, num_subdivisions, adjust_window=False, one_sided=False)[source]
- hexrd.gridutil.sutherlandHodgman(subjectPolygon, clipPolygon)[source]
https://en.wikipedia.org/wiki/Sutherland%E2%80%93Hodgman_algorithm