resqpy.olio.triangulation.reorient¶
- resqpy.olio.triangulation.reorient(points, rough=True, max_dip=None, use_linalg=True, sample=500)[source]¶
Returns a reoriented copy of a set of points, such that z axis is approximate normal to average plane of points.
- Parameters
points (numpy float array of shape (..., 3)) – the points to be reoriented
rough (bool, default True) – if True, the resulting orientation will be within around 10 degrees of the optimum; if False, that reduces to around 2.5 degrees of the optimum; iugnored if use_linalg is True
max_dip (float, optional) – if present, the reorientation of perspective off vertical is limited to this angle in degrees
use_linalg (bool, default True) – if True, the numpy linear algebra svd function is used and rough is ignored
sample (int, default 500) – downsample points to this number for the purposes of determining normal vector
- Returns
numpy float array of the same shape as points, numpy xyz vector, numpy 3x3 matrix; the array being a copy of points rotated in 3D space to minimise the z range; the vector is a normal vector to the original points, in +ve z hemisphere; the matrix is rotation matrix used to transform the original points to the reoriented points
Notes
the original points array is not modified by this function; implicit xy & z units for points are assumed to be the same; the function may typically be called prior to the Delaunay triangulation, which uses an xy projection to determine the triangulation; the numpy linear algebra option seems to be memory intensive, not recommended; downsampling will occur (for normal vector determination) when the number of points exceeds double that given in the sample argument; set sample to None to use all points for normal vector determination