discretize.utils.rotate_points_from_normals(xyz, v0, v1, x0=array([0., 0., 0.]))[source]#

Rotate a set of xyz locations about a specified point.

Rotate a grid of Cartesian points about a location x0 according to the rotation defined from vector v0 to v1.

Let \(\mathbf{x}\) represent an input xyz location, let \(\mathbf{x_0}\) be the origin of rotation, and let \(\mathbf{R}\) denote the rotation matrix from vector v0 to v1. Where \(\mathbf{x'}\) is the new xyz location, this function outputs the following operation for all input locations:

\[\mathbf{x'} = \mathbf{R (x - x_0)} + \mathbf{x_0}\]
xyz(n, 3) numpy.ndarray

locations to rotate

v0(3) numpy.ndarray

Starting orientation direction

v1(3) numpy.ndarray

Finishing orientation direction

x0(3) numpy.ndarray, optional

The origin of rotation.

(n, 3) numpy.ndarray

The rotated xyz locations.