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."); }
public static BasicVector Add(this BasicVector basicVector, BasicVector other) { return(new BasicVector(basicVector.X + other.X, basicVector.Y + other.Y, basicVector.Z + other.Z)); }
public static double Distance(this BasicVector basicVector, BasicVector other) { return(Math.Sqrt(BasicVectorCoreExtensions.DistanceSqd(basicVector, other))); }
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)); }
public static BasicVector Subtract(this BasicVector basicVector, BasicVector other) { return(new BasicVector(basicVector.X - other.X, basicVector.Y - other.Y, basicVector.Z - other.Z)); }
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); }