コード例 #1
0
 public override bool Equals(object?other)
 {
     if (other is ImmutableVector2D)
     {
         return(ImmutableVector2D.Equals(this, other));
     }
     return(false);
 }
コード例 #2
0
        protected BigRational[] MultiplyBase(ImmutableVector2D right)
        {
            var vector = new BigRational[Order];

            for (int rowIndex = 0; rowIndex < Order; rowIndex++)
            {
                BigRational value = 0;
                for (int columnIndex = 0; columnIndex < Order; columnIndex++)
                {
                    value += this.UnderlyingValues[rowIndex, columnIndex] * right.UnderlyingVector[columnIndex];
                }
                vector[rowIndex] = value;
            }
            return(vector);
        }
コード例 #3
0
        public bool Equals(ImmutableVector2D other)
        {
            if (this.UnderlyingVector.Count != other.UnderlyingVector.Count)
            {
                return(false);
            }

            for (int i = 0; i < this.UnderlyingVector.Count; i++)
            {
                if (this.UnderlyingVector[i] != other.UnderlyingVector[i])
                {
                    return(false);
                }
            }

            return(true);
        }
コード例 #4
0
 /// <summary>
 /// Multiply the matrix by a given vector.
 /// </summary>
 /// <returns>A new <see cref="ImmutableVector2D"/> with the result of the computation</returns>
 public ImmutableVector2D Multiply(ImmutableVector2D right)
 {
     return(new ImmutableVector2D(base.MultiplyBase(right)));
 }
コード例 #5
0
 /// <summary>
 /// Returns a new vector which is equal to this vector minus anright vector
 /// </summary>
 public ImmutableVector2D Subtract(ImmutableVector2D right)
 {
     return(new ImmutableVector2D(new[] { this.UnderlyingVector[0] - right.UnderlyingVector[0], this.UnderlyingVector[1] - right.UnderlyingVector[1] }));
 }
コード例 #6
0
 /// <summary>
 /// Returns a new vector which is the sum of two vectors together
 /// </summary>
 public ImmutableVector2D Add(ImmutableVector2D right)
 {
     return(new ImmutableVector2D(new[] { this.UnderlyingVector[0] + right.UnderlyingVector[0], this.UnderlyingVector[1] + right.UnderlyingVector[1] }));
 }