project_onto_plane

halotools.utils.project_onto_plane(x1, x2)[source] [edit on github]

Given a collection of vectors, x1 and x2, project each vector in x1 onto the plane normal to the corresponding vector x2.

Parameters:
x1 : ndarray

Numpy array of shape (npts, 3) storing a collection of 3d points

x2 : ndarray

Numpy array of shape (npts, 3) storing a collection of 3d points

Returns:
result : ndarray

Numpy array of shape (npts, 3) storing a collection of 3d points

Examples

Define a set of random 3D vectors.

>>> npts = int(1e4)
>>> x1 = np.random.random((npts, 3))
>>> x2 = np.random.random((npts, 3))

Find the projection of each vector in x1 onto a plane defined by each vector in x2.

>>> x3 = project_onto_plane(x1, x2)