import torch


def is_perpendicular(
    pt1: torch.Tensor,  # N x 2
    pt2: torch.Tensor,  # N x 2
    pt3: torch.Tensor,  # N x 2
    tol: float = 1e-1,
) -> torch.Tensor:
    """Checks if the two vectors (pt1 - pt2) amd (pt1 - pt3)
    are perpendicular to each other.
    """
    vec1 = pt1 - pt2  # N x 2
    vec1 /= torch.norm(vec1, dim=1, keepdim=True)
    vec2 = pt1 - pt3  # N x 2
    vec2 /= torch.norm(vec2, dim=1, keepdim=True)  # N x 2
    return (vec1 * vec2).sum(1).abs() < tol