/// <summary> /// Determines if two <see cref="IDirectional2D"/>s are parallel up to a custom angular tolerance. /// That is, if lines with those directions are within that angle of each other, the /// <see cref="IDirectional2D"/>s are considered "parallel." /// </summary> public static bool IsParallelTo(this IDirectional2D direction1, IDirectional2D direction2, Angle tolerance) { var angle = direction1.Direction.SmallestAngleBetween(direction2.Direction).ToSignedAngle(); return(angle.EqualsWithinTolerance(Angle.Zero, tolerance)); }
public static bool IsPerpendicularTo(this IDirectional2D direction1, IDirectional2D direction2) => direction1.Direction.RotateQuarterTurn().IsParallelTo(direction2);
public static bool IsParallelTo(this IDirectional2D direction1, IDirectional2D direction2) => direction1.Direction.SmallestAngleBetween(direction2.Direction).EqualsZero();