public static void CheckParallel(this Arrow first, Arrow second) { if (first.Dot(second) <= 0) { throw new ArgumentException("Arrows must point in the same general direction."); } }
public static void CheckPerpendicular(this Arrow first, Arrow second) { if (first.Dot(second) != 0) { throw new ArgumentException("Arrows must be perpendicular."); } }
public static IAuto <Arrow> Rotate(this Arrow axis) { axis.CheckUnit(); return(new Auto <Arrow>( morphF: arrow => { var projection = axis.Scale((Sign)axis.Dot(arrow)); return axis.Cross(arrow).Add(projection); })); }
public static int Magnitude(this Arrow arrow) { return(arrow.Dot(arrow)); }