get_nearest#

Vector3d.get_nearest(x: Vector3d, inclusive: bool = False, tiebreak: bool = None) Vector3d[source]#

Return the vector in x with the smallest angle to this vector.

Parameters:
x

Set of vectors in which to find the one with the smallest angle to this vector.

inclusive

If False (default) vectors exactly parallel to this will not be considered.

tiebreak

If multiple vectors are equally close to this one, tiebreak will be used as a secondary comparison. By default equal to (0, 0, 1).

Returns:
v

Vector with the smallest angle to this vector.

Raises:
ValueError

If this is not a single vector.

Examples

>>> from orix.vector import Vector3d
>>> v1 = Vector3d([1, 0, 0])
>>> v1.get_nearest(Vector3d([[0.5, 0, 0], [0.6, 0, 0]]))
Vector3d (1,)
[[0.6 0.  0. ]]