Esempio n. 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);
        }
Esempio n. 2
0
        public static Vector operator*(Vector lhs, double s)
        {
            Vector res = new Vector(lhs.Dimensions);

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

            VectorOperations.Sub(lhs, rhs, ref res);
            return(res);
        }
Esempio n. 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);
 }
Esempio n. 5
0
 /// <summary>
 /// Reset to empty state.
 /// </summary>
 public void Reset()
 {
     VectorOperations.Fill(ref _min, Double.MaxValue);
     VectorOperations.Fill(ref _max, Double.MinValue);
 }
Esempio n. 6
0
 /// <summary>
 /// Calculate the square-length (L2 norm) of the given vector.
 /// </summary>
 public static double SquaredL2Norm(IVector a)
 {
     return(VectorOperations.Inner(a, a));
 }