Exemplo n.º 1
0
        public IVector2D Multiply(float scalar)
        {
            IVector2D r = new Vector2D(X * scalar, Y * scalar);

            return r;
        }
Exemplo n.º 2
0
        public IVector2D Negate()
        {
            IVector2D r = new Vector2D(-X, -Y);

            return r;
        }
Exemplo n.º 3
0
        public IVector2D Divide(float divisor)
        {
            IVector2D r = new Vector2D(X / divisor, Y / divisor);

            return r;
        }
Exemplo n.º 4
0
        public IVector2D Add(IVector2D v)
        {
            IVector2D r = new Vector2D(X + v.X, Y + v.Y);

            return r;
        }
Exemplo n.º 5
0
        public IVector2D Substract(IVector2D v)
        {
            IVector2D r = new Vector2D(X - v.X, Y - v.Y);

            return r;
        }
Exemplo n.º 6
0
        public IVector2D Rotate90()
        {
            IVector2D r = new Vector2D(-Y, X);

            return r;
        }
Exemplo n.º 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;
        }