Beispiel #1
0
        /// <summary>
        /// Create vector of n-dimensions with equal coordinates
        /// </summary>
        public Vector(int dimensions, double val)
        {
            _coordinates = new double[dimensions];
            IVector self = this;

            VectorOperations.Fill(ref self, val);
        }
Beispiel #2
0
        public static Vector operator*(Vector lhs, double s)
        {
            Vector res = new Vector(lhs.Dimensions);

            VectorOperations.ScalarMul(lhs, s, ref res);
            return(res);
        }
Beispiel #3
0
        public static Vector operator-(Vector lhs, IVector rhs)
        {
            Vector res = new Vector(lhs.Dimensions);

            VectorOperations.Sub(lhs, rhs, ref res);
            return(res);
        }
Beispiel #4
0
 /// <summary>
 /// Create the union of the left and right bounds.
 /// </summary>
 public static void Union(AABB left, AABB right, ref AABB dest)
 {
     VectorOperations.Copy(left.Lower, ref dest._min);
     VectorOperations.Copy(left.Upper, ref dest._max);
     // Selective enlargement to cope with possibly unbounded regions in right.
     dest.EnlargeLower(right.Lower);
     dest.EnlargeUpper(right.Upper);
 }
Beispiel #5
0
 /// <summary>
 /// Reset to empty state.
 /// </summary>
 public void Reset()
 {
     VectorOperations.Fill(ref _min, Double.MaxValue);
     VectorOperations.Fill(ref _max, Double.MinValue);
 }
 /// <summary>
 /// Calculate the square-length (L2 norm) of the given vector.
 /// </summary>
 public static double SquaredL2Norm(IVector a)
 {
     return(VectorOperations.Inner(a, a));
 }