Esempio n. 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Demo -- A simple demonstration application illustrating Napack usage.");

            BasicVector vector          = new BasicVector(1.0, 2.0, 3.0);
            BasicVector secondaryVector = new BasicVector(2.0, 3.0, 4.0);
            BasicVector additionResult  = vector.Add(secondaryVector);

            Console.WriteLine($"Test Vector: ({vector.X}, {vector.Y}, {vector.Z})");
            Console.WriteLine("Done.");
        }
Esempio n. 2
0
 public static BasicVector Add(this BasicVector basicVector, BasicVector other)
 {
     return(new BasicVector(basicVector.X + other.X, basicVector.Y + other.Y, basicVector.Z + other.Z));
 }
Esempio n. 3
0
 public static double Distance(this BasicVector basicVector, BasicVector other)
 {
     return(Math.Sqrt(BasicVectorCoreExtensions.DistanceSqd(basicVector, other)));
 }
Esempio n. 4
0
        public static double DistanceSqd(this BasicVector basicVector, BasicVector other)
        {
            BasicVector differenceBasicVector = basicVector.Subtract(other);

            return(Math.Pow(differenceBasicVector.X, 2) + Math.Pow(differenceBasicVector.Y, 2) + Math.Pow(differenceBasicVector.Z, 2));
        }
Esempio n. 5
0
 public static BasicVector Subtract(this BasicVector basicVector, BasicVector other)
 {
     return(new BasicVector(basicVector.X - other.X, basicVector.Y - other.Y, basicVector.Z - other.Z));
 }
Esempio n. 6
0
 static void Main(string[] args)
 {
     BasicVector vector = new BasicVector(1.0, 2.0, 1.0);
     BasicVector secondaryVector = new BasicVector(2.0, 1.0, 2.0);
     Console.WriteLine("Napack Extension demo test: " + vector.Add(secondaryVector).X);
 }