Get barycentric (area in 2D, volume in 3D) coordinates of points with coordinates coors w.r.t. the simplex given by s_coors.
Returns: | bc : array
|
---|
Test if points are in a 2D polygon.
Parameters: | polygon : array, (:, 2)
coors: array, (:, 2) :
|
---|---|
Returns: | flag : bool array
|
Notes
This is a semi-vectorized version of [1].
[1] PNPOLY - Point Inclusion in Polygon Test, W. Randolph Franklin (WRF)
Return indices of coordinates inside or outside a ball given by centre and radius.
Notes
All float comparisons are done using <= or >= operators, i.e. the points on the boundaries are taken into account.
Return indices of coordinates inside a tube given by centre, axis vector, inner and outer radii and length.
Parameters: | inside_radii : bool, optional
|
---|
Notes
All float comparisons are done using <= or >= operators, i.e. the points on the boundaries are taken into account.
Get areas of planar convex faces in 2D and 3D.
Parameters: | faces : array, shape (n, m)
coors : array
|
---|---|
Returns: | areas : array
|
For a given vector, get a unit vector perpendicular to it in 2D, or get two mutually perpendicular unit vectors perpendicular to it in 3D.
Compute the circumcentres of n_s simplices in 1D, 2D and 3D.
Parameters: | coors : array
force_inside_eps : float, optional
|
---|---|
Returns: | centres : array
|
Get volumes of simplices in nD.
Parameters: | cells : array, shape (n, d)
coors : array
|
---|---|
Returns: | volumes : array
|
Given spatial element coordinates, find the inverse mapping for points with coordinats X = X(xi), i.e. xi = xi(X).
Returns: | xi : array
|
---|
Create a rotation matrix \ull{R} corresponding to the rotation around a general axis \ul{d} by a specified angle \alpha.
\ull{R} = \ul{d}\ul{d}^T + \cos(\alpha) (I - \ul{d}\ul{d}^T) + \sin(\alpha) \skewop(\ul{d})
Parameters: | direction : array
angle : float
|
---|---|
Returns: | mtx : array
|
Notes
The matrix follows the right hand rule: if the right hand thumb points along the axis vector \ul{d} the fingers show the positive angle rotation direction.
Examples
Make transformation matrix for rotation of coordinate system by 90 degrees around ‘z’ axis.
>>> mtx = make_axis_rotation_matrix([0., 0., 1.], nm.pi/2)
>>> mtx
array([[ 0., 1., 0.],
[-1., 0., 0.],
[ 0., 0., 1.]])
Coordinates of vector [1, 0, 0]^T w.r.t. the original system in the rotated system. (Or rotation of the vector by -90 degrees in the original system.)
>>> nm.dot(mtx, [1., 0., 0.])
>>> array([ 0., -1., 0.])
Coordinates of vector [1, 0, 0]^T w.r.t. the rotated system in the original system. (Or rotation of the vector by +90 degrees in the original system.)
>>> nm.dot(mtx.T, [1., 0., 0.])
>>> array([ 0., 1., 0.])
Test if points with coordinates coors are in the simplex given by s_coors.