Пример #1
0
        public IVector2D Multiply(float scalar)
        {
            IVector2D r = new Vector2D(X * scalar, Y * scalar);

            return r;
        }
Пример #2
0
        public IVector2D Negate()
        {
            IVector2D r = new Vector2D(-X, -Y);

            return r;
        }
Пример #3
0
        public IVector2D Divide(float divisor)
        {
            IVector2D r = new Vector2D(X / divisor, Y / divisor);

            return r;
        }
Пример #4
0
        public IVector2D Add(IVector2D v)
        {
            IVector2D r = new Vector2D(X + v.X, Y + v.Y);

            return r;
        }
Пример #5
0
        public IVector2D Substract(IVector2D v)
        {
            IVector2D r = new Vector2D(X - v.X, Y - v.Y);

            return r;
        }
Пример #6
0
        public IVector2D Rotate90()
        {
            IVector2D r = new Vector2D(-Y, X);

            return r;
        }
Пример #7
0
        public IVector2D Rotate(float degrees)
        {
            float radians = degrees.ToRadians();

            var sine = (float)Math.Sin(radians);
            var cosine = (float)Math.Cos(radians);

            IVector2D r = new Vector2D(X * cosine - Y * sine, X * sine - Y * cosine);

            return r;
        }