coords.Coords.project_on_cylinder#

Coords.project_on_cylinder(radius=1.0, dir=0, center=[0.0, 0.0, 0.0])#

Project the Coords on a cylinder with axis parallel to a global axis.

Given a cylinder with axis parallel to a global axis, the points of the Coords are projected from the axis onto the surface of the cylinder. The default cylinder has its axis along the x-axis and a unit radius. No points of the Coords should belong to the axis.

Parameters#

radius: float, optional

The radius of the sphere, default 1.

dir: int (0,1,2), optional

The global axis parallel to the cylinder’s axis.

center: float array_like (3,), optional

A point on the axis of the cylinder. Default is the origin of the global axes.

Returns#

Coords

A Coords with the input points projected on the specified cylinder.

Notes#

Projection is undefined for points lying on the cylinder axis. Such points will result in NaN values.

This is a projection from the axis of the cylinder. If you want a parallel projection on a cylindrical surface, you can use map().

Examples#

>>> X = Coords([[x,x,1.] for x in range(1,4)])
>>> X
Coords([[1., 1., 1.],
        [2., 2., 1.],
        [3., 3., 1.]])
>>> X.project_on_cylinder()
Coords([[1.    , 0.7071, 0.7071],
        [2.    , 0.8944, 0.4472],
        [3.    , 0.9487, 0.3162]])