示例#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;
        }