coords.Coords.directional_size#

Coords.directional_size(n, p=None, return_points=False)#

Returns the extreme distances from the plane p,n.

Parameters#

n: a single int or a float array_like (3,)

The direction of the normal to the plane. If an int, it is the number of a global axis. Else it is a vector with 3 components.

p: array_like (3,), optional

Coordinates of a point in the plane. If not provided, the center() of the Coords is used.

return_points: bool

If True, also return a Coords with two points along the line (p,n) and at the extreme distances from the plane (p,n).

Returns#

dmin: float

The minimal (signed) distance of a point of the Coords to the plane (p,n). The value can be negative or positive.

dmax: float

The maximal (signed) distance of a point of the Coords to the plane (p,n). The value can be negative or positive.

points: Coords (2,3), optional

If return_points=True is provided, also returns a Coords holding two points on the line (p,n) with minimal and maximal distance from the plane (p,n). These two points together with the normal n define two parallel planes such that all points of self are between or on the planes.

Notes#

The maximal size of self in the direction n is found from the difference dmax - dmin`. See also directional_width().

See also#

Examples#

>>> X = Coords([[[0.,0.,0.],[3.,0.,0.],[0.,3.,0.]]])
>>> X.directional_size([1,0,0])
(-1.5, 1.5)
>>> X.directional_size([1,0,0],[1.,0.,0.])
(-1.0, 2.0)
>>> X.directional_size([1,0,0],return_points=True)
(-1.5, 1.5, Coords([[0. , 1.5, 0. ],
        [3. , 1.5, 0. ]]))