coords.Coords.project_on_plane#

Coords.project_on_plane(n=2, p=(0.0, 0.0, 0.0))#

Project a Coords on a plane.

Creates a parallel projection of the Coords on a plane.

Parameters#

n: int (0,1,2) or float array_like (3,)

The normal direction to the plane on which to project the Coords. If an int, it is a global axis.

p: float array_like (3,)

A point in the projection plane, by default the global origin.

Returns#

Coords

The points of the Coords projected on the specified plane.

Notes#

For projection on a plane parallel to a coordinate plane, it is far more efficient to specify the normal by an axis number rather than by a three component vector.

This method will also work if any or both of p and n have the same shape as self, or can be reshaped to the same shape. This will project each point on its individual plane.

Examples#

>>> X = Coords(np.arange(6).reshape(2,3))
>>> X.project_on_plane(n=0,p=[2.5,0.,0.])
Coords([[2.5, 1. , 2. ],
        [2.5, 4. , 5. ]])
>>> X.project_on_plane(n=[1.,1.,0.])
Coords([[-0.5, 0.5, 2. ],
        [-0.5, 0.5, 5. ]])