Exemplo n.º 1
0
 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.");
     }
 }
Exemplo n.º 2
0
 public static void CheckPerpendicular(this Arrow first, Arrow second)
 {
     if (first.Dot(second) != 0)
     {
         throw new ArgumentException("Arrows must be perpendicular.");
     }
 }
Exemplo n.º 3
0
        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);
            }));
        }
Exemplo n.º 4
0
 public static int Magnitude(this Arrow arrow)
 {
     return(arrow.Dot(arrow));
 }