skspatial.objects.Vector.is_perpendicular

Vector.is_perpendicular(other: Union[numpy.ndarray, Sequence], **kwargs: float) bool[source]

Check if the vector is perpendicular to another.

Two vectors \(u\) and \(v\) are perpendicular if

\[u \cdot v = 0\]
Parameters
otherarray_like

Other vector.

kwargsdict, optional

Additional keywords passed to math.isclose().

Returns
bool

True if the vector is perpendicular; false otherwise.

Examples

>>> from skspatial.objects import Vector
>>> Vector([0, 1]).is_perpendicular([1, 0])
True
>>> Vector([-1, 5]).is_perpendicular([3, 4])
False
>>> Vector([2, 0, 0]).is_perpendicular([0, 0, 2])
True

The zero vector is perpendicular to all vectors.

>>> Vector([0, 0, 0]).is_perpendicular([1, 2, 3])
True