public void PGramDiagonalSurfacePerformanceTest() { DateTime startTime = DateTime.Now; double x1, x2, y1, y2, z1, z2, foo = 1; for (x1 = 0; x1 < 10000; x1++) { x2 = -3; y1 = 56; y2 = 12; z1 = -2; z2 = 23; Scientrace.NonzeroVector nzv1 = new Scientrace.NonzeroVector(x1, y1, z1); Scientrace.NonzeroVector nzv2 = new Scientrace.NonzeroVector(x2, y2, z2); Scientrace.Parallelogram a = new Scientrace.Parallelogram(new Scientrace.Location(1, 2, 3), nzv1, nzv2); //comparing surface calculated by sine of the angle between vectors and multiplication with their lengths with the lenght of the outproduct if (Math.Sin(Math.Acos(nzv1.toUnitVector().dotProduct(nzv2.toUnitVector())))*nzv1.length*nzv2.length != a.getSurfaceSize()) { //Assert.AreEqual(Math.Sin(Math.Acos(nzv1.toUnitVector().dotProduct(nzv2.toUnitVector())))*nzv1.length*nzv2.length, a.getSurface(), 1e-10); foo++; } } DateTime stopTime = DateTime.Now; TimeSpan duration = stopTime-startTime; Console.WriteLine(foo.ToString()+" siginificance failures"); //making sure these 10 000 dotproducts and crossproducts comparisons can be executed within 60 milliseconds Assert.Less(duration.Milliseconds, 60); }
public void PGramDiagonalSurfaceTest2() { double x1, x2, y1, y2, z1, z2; x1 = 4; x2 = -3; y1 = 56; y2 = 12; z1 = -2; z2 = 23; Scientrace.NonzeroVector nzv1 = new Scientrace.NonzeroVector(x1, y1, z1); Scientrace.NonzeroVector nzv2 = new Scientrace.NonzeroVector(x2, y2, z2); Scientrace.Parallelogram a = new Scientrace.Parallelogram(new Scientrace.Location(1, 2, 3), nzv1, nzv2); //comparing surface calculated by sine of the angle between vectors and multiplication with their lengths with the lenght of the outproduct Assert.AreEqual( Math.Sin(Math.Acos(nzv1.toUnitVector().dotProduct(nzv2.toUnitVector()))) * nzv1.length * nzv2.length, a.getSurfaceSize(), 1E-12); }
public void PGramDiagonalSurfacePerformanceTest() { DateTime startTime = DateTime.Now; double x1, x2, y1, y2, z1, z2, foo = 1; for (x1 = 0; x1 < 10000; x1++) { x2 = -3; y1 = 56; y2 = 12; z1 = -2; z2 = 23; Scientrace.NonzeroVector nzv1 = new Scientrace.NonzeroVector(x1, y1, z1); Scientrace.NonzeroVector nzv2 = new Scientrace.NonzeroVector(x2, y2, z2); Scientrace.Parallelogram a = new Scientrace.Parallelogram(new Scientrace.Location(1, 2, 3), nzv1, nzv2); //comparing surface calculated by sine of the angle between vectors and multiplication with their lengths with the lenght of the outproduct if (Math.Sin(Math.Acos(nzv1.toUnitVector().dotProduct(nzv2.toUnitVector()))) * nzv1.length * nzv2.length != a.getSurfaceSize()) { //Assert.AreEqual(Math.Sin(Math.Acos(nzv1.toUnitVector().dotProduct(nzv2.toUnitVector())))*nzv1.length*nzv2.length, a.getSurface(), 1e-10); foo++; } } DateTime stopTime = DateTime.Now; TimeSpan duration = stopTime - startTime; Console.WriteLine(foo.ToString() + " siginificance failures"); //making sure these 10 000 dotproducts and crossproducts comparisons can be executed within 60 milliseconds Assert.Less(duration.Milliseconds, 60); }
public void PGramDiagonalSurfaceTest1() { Scientrace.Parallelogram a = new Scientrace.Parallelogram(new Scientrace.Location(1, 2, 3), new Scientrace.NonzeroVector(3, 4, 5), new Scientrace.NonzeroVector(3, 4, 0)); Assert.AreEqual(25, a.getSurfaceSize()); }
public void PGramSquareSurfaceTest() { Scientrace.Parallelogram a = new Scientrace.Parallelogram(new Scientrace.Location(10, 10, 10), new Scientrace.NonzeroVector(3, 4, 0), new Scientrace.NonzeroVector(0, 0, 5)); Assert.AreEqual(25, a.getSurfaceSize()); }
public void PGramDiagonalSurfaceTest2() { double x1, x2, y1, y2, z1, z2; x1 = 4; x2 = -3; y1 = 56; y2 = 12; z1 = -2; z2 = 23; Scientrace.NonzeroVector nzv1 = new Scientrace.NonzeroVector(x1, y1, z1); Scientrace.NonzeroVector nzv2 = new Scientrace.NonzeroVector(x2, y2, z2); Scientrace.Parallelogram a = new Scientrace.Parallelogram(new Scientrace.Location(1, 2, 3), nzv1, nzv2); //comparing surface calculated by sine of the angle between vectors and multiplication with their lengths with the lenght of the outproduct Assert.AreEqual( Math.Sin(Math.Acos(nzv1.toUnitVector().dotProduct(nzv2.toUnitVector())))*nzv1.length*nzv2.length, a.getSurfaceSize(), 1E-12); }