Beispiel #1
0
        public static TVector2D operator -(TVector2D a, TVector2D b)
        {
            double    n   = a.x - b.x;
            double    m   = a.y - b.y;
            TVector2D vec = new TVector2D(n, m);

            return(vec);
        }
Beispiel #2
0
        public virtual void VecEquals(TVector2D vec)
        {
            string equals = "";

            if (x == vec.x && y == vec.y)
            {
                equals = "Vec1 equals Vec2";
            }
            else
            {
                equals = "Vec1 not equals to vec2";
            }
            Console.WriteLine(equals);
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            TVector2D vec1 = new TVector2D();

            vec1.EnterVec();
            vec1.ShowVec();
            TVector2D vec2 = new TVector2D(22, 3);

            vec2.ShowVec();
            TVector2D vec3 = new TVector2D(vec1);

            vec3.ShowVec();
            vec3.EnterVec(8, 9);
            vec3.ShowVec();
            Console.WriteLine(vec1.VecLength());
            vec1.VecNormal();
            vec1.VecEquals(vec2);
            Console.WriteLine(vec1 + vec2);
            Console.WriteLine(vec1 - vec2);
            Console.WriteLine(vec1 * vec2);
        }
Beispiel #4
0
 public TVector2D(TVector2D vec)
 {
     this.x = vec.x;
     this.y = vec.y;
 }